How to use _tick method in avocado

Best Python code snippet using avocado_python

tick.py

Source:tick.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2#3# Copyright 2017 Ricequant, Inc4#5# Licensed under the Apache License, Version 2.0 (the "License");6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16from rqalpha.utils.datetime_func import convert_date_time_ms_int_to_datetime17class Tick(object):18 def __init__(self, order_book_id, tick):19 self._order_book_id = order_book_id20 self._tick = tick21 @property22 def order_book_id(self):23 return self._order_book_id24 @property25 def datetime(self):26 dt = convert_date_time_ms_int_to_datetime(self._tick["date"], self._tick["time"])27 return dt28 @property29 def open(self):30 return self._tick['open']31 @property32 def last(self):33 return self._tick['last']34 @property35 def high(self):36 return self._tick['high']37 @property38 def low(self):39 return self._tick['low']40 @property41 def prev_close(self):42 return self._tick['prev_close']43 @property44 def volume(self):45 return self._tick['volume']46 @property47 def total_turnover(self):48 return self._tick['total_turnover']49 @property50 def open_interest(self):51 return self._tick['open_interest']52 @property53 def prev_settlement(self):54 return self._tick['prev_settlement']55 # FIXME: use dynamic creation56 @property57 def b1(self):58 return self._tick['b1']59 @property60 def b2(self):61 return self._tick['b2']62 @property63 def b3(self):64 return self._tick['b3']65 @property66 def b4(self):67 return self._tick['b4']68 @property69 def b5(self):70 return self._tick['b5']71 @property72 def b1_v(self):73 return self._tick['b1_v']74 @property75 def b2_v(self):76 return self._tick['b2_v']77 @property78 def b3_v(self):79 return self._tick['b3_v']80 @property81 def b4_v(self):82 return self._tick['b4_v']83 @property84 def b5_v(self):85 return self._tick['b5_v']86 @property87 def a1(self):88 return self._tick['a1']89 @property90 def a2(self):91 return self._tick['a2']92 @property93 def a3(self):94 return self._tick['a3']95 @property96 def a4(self):97 return self._tick['a4']98 @property99 def a5(self):100 return self._tick['a5']101 @property102 def a1_v(self):103 return self._tick['a1_v']104 @property105 def a2_v(self):106 return self._tick['a2_v']107 @property108 def a3_v(self):109 return self._tick['a3_v']110 @property111 def a4_v(self):112 return self._tick['a4_v']113 @property114 def a5_v(self):115 return self._tick['a5_v']116 @property117 def limit_up(self):118 return self._tick['limit_up']119 @property120 def limit_down(self):121 return self._tick['limit_down']122 def __repr__(self):123 items = []124 for name in dir(self):125 if name.startswith("_"):126 continue127 items.append((name, getattr(self, name)))128 return "Tick({0})".format(', '.join('{0}: {1}'.format(k, v) for k, v in items))129 def __getitem__(self, key):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful