Skip to content

Commit 80c19a0

Browse files
committed
parse depth quote push data
1 parent ee4b14e commit 80c19a0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tigeropen/common/consts/quote_keys.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class QuoteChangeKey(Enum):
1717
bid_price = 'bidPrice'
1818
bid_size = 'bidSize'
1919
minute = 'mi'
20+
bid_depth = 'bidDepth'
21+
ask_depth = 'askDepth'
2022

2123

2224
@unique

tigeropen/examples/push_client_demo.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ def on_quote_changed(symbol, items, hour_trading):
4343
('high', 345.0), ('prev_close', 342.4), ('low', 339.2), ('open', 344.0), ('volume', 7361440),
4444
('minute', {'p': 339.8, 'a': 341.084, 't': 1568098440000, 'v': 7000, 'h': 340.0, 'l': 339.8}),
4545
('timestamp', '1568098469463')]
46+
深度行情 items 数据示例. 最多只推送前 40 档, 由 3 个等长数组构成,分别代表:price(价格)/volume(数量)/count(单量),
47+
相邻档位价格可能一样, 其中 count 是可选的
48+
[('bid_depth',
49+
'[[127.87,127.86,127.86,127.86,127.85,127.85,127.85,127.84,127.84,127.84,127.84,127.83,127.83, 127.83,127.83,127.83,127.82,127.81,127.8,127.8,127.8,127.8,127.8,127.8,127.8,127.79,127.79,127.78, 127.78, 127.75,127.68,127.6,127.6,127.55,127.5,127.5,127.5,127.5,127.29,127.28],
50+
[69,2,5,20,1,1,1,18,1,70,80,40,2,330,330,1,40,80,20,10,131,2,30,50,300,1,38,1,1,15,6,20,1,3,100,15,25,30,49,43]
51+
]'),
52+
('ask_depth',
53+
'[[127.91,127.94,127.95,127.95,127.95,127.95,127.95,127.96,127.98,127.98,127.98,127.98,127.99,127.99, 128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0, 128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0,128.0],
54+
[822,4,98,50,5,5,500,642,300,40,1,36,19,1,1,1,1,50,1,1,50,1,100,10,1,1,10,1,1,1,1,5,1,8,1,1,120,70,1,4]
55+
]'),
56+
('timestamp', 1621933454191)]
57+
4658
"""
4759
print(symbol, items, hour_trading)
4860

0 commit comments

Comments
 (0)