pytdx
pytdx copied to clipboard
active1和active2字段应该是成交总笔数
不知道这个问题是否已经解决,我也只看了几只股票,导出分笔数据后,成交总笔数和这两个字段的值是一样的。
另外reversed_bytes2字段应该是当前成交价格和上个成交价格的差价。
我记得我之前全写了一遍 找不到issue是哪个了2333
感谢说明,为了向后兼容,应该不会修改dataframe的字段名了,不过可以更新到文档里
在大部分股票里面 确实是总笔数 不过有的票他的值会小的很离谱 @vagrantTime
In [36]: QA.QA_fetch_get_stock_realtime('tdx','000001')
Out[36]:
servertime reversed_bytes0 active1 active2 last_close open high low price cur_vol s_vol ... ask_vol3 bid3 bid_vol3 ask4 ask_vol4 bid4 bid_vol4 ask5 ask_vol5 bid5 bid_vol5 datetime code ...
2019-08-26 10:18:05.823542 000001 10:17:53.256 10178876 962 962 14.65 14.42 14.5 14.15 14.25 74 368978 ... 198 14.22 1667 14.28 1084 14.21 2873 14.29 274 14.2 3551
[1 rows x 33 columns]
In [37]: QA.QA_fetch_get_stock_realtime('tdx','000008')
Out[37]:
servertime reversed_bytes0 active1 active2 last_close open high low price cur_vol s_vol ... ask_vol3 bid3 bid_vol3 ask4 ask_vol4 bid4 bid_vol4 ask5 ask_vol5 bid5 bid_vol5
datetime code ...
2019-08-26 10:18:10.979587 000008 10:18:03.330 10180555 449 449 3.5 3.45 3.46 3.43 3.46 2 14715 ... 2107 3.43 4608 3.49 1699 3.42 2341 3.5 3459 3.41 2249
[1 rows x 33 columns]
@vagrantTime @rainx 不过从分笔看 他确实是小...
[553 rows x 9 columns]
In [39]: QA.QA_fetch_get_stock_transaction_realtime('tdx','000008').tail()
e:\quantaxis\QUANTAXIS\QAFetch\QATdx.py:1033: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
for i in range(3)], axis=0)
Out[39]:
buyorsell num price time vol date datetime code order
datetime
2019-08-26 10:37:00 1.0 1.0 3.45 10:37 5.0 2019-08-26 2019-08-26 10:37:00 000008 549
2019-08-26 10:37:00 0.0 1.0 3.46 10:37 3.0 2019-08-26 2019-08-26 10:37:00 000008 550
2019-08-26 10:38:00 0.0 4.0 3.46 10:38 50.0 2019-08-26 2019-08-26 10:38:00 000008 551
2019-08-26 10:38:00 0.0 1.0 3.46 10:38 3.0 2019-08-26 2019-08-26 10:38:00 000008 552
2019-08-26 10:38:00 0.0 1.0 3.46 10:38 3.0 2019-08-26 2019-08-26 10:38:00 000008 553
从分笔和实时5挡对照来看 他们确实是一致的 但是也确实存在非常大的滞后 @rainx
In [44]: QA.QA_fetch_get_stock_transaction_realtime('tdx','000008').tail()
e:\quantaxis\QUANTAXIS\QAFetch\QATdx.py:1033: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
for i in range(3)], axis=0)
Out[44]:
buyorsell num price time vol date datetime code order
datetime
2019-08-26 10:38:00 0.0 1.0 3.46 10:38 3.0 2019-08-26 2019-08-26 10:38:00 000008 552
2019-08-26 10:38:00 0.0 1.0 3.46 10:38 3.0 2019-08-26 2019-08-26 10:38:00 000008 553
2019-08-26 10:39:00 0.0 1.0 3.46 10:39 2.0 2019-08-26 2019-08-26 10:39:00 000008 554
2019-08-26 10:39:00 1.0 7.0 3.45 10:39 258.0 2019-08-26 2019-08-26 10:39:00 000008 555
2019-08-26 10:39:00 1.0 1.0 3.45 10:39 1.0 2019-08-26 2019-08-26 10:39:00 000008 556
In [45]: QA.QA_fetch_get_stock_realtime('tdx','000008')
Out[45]:
servertime reversed_bytes0 active1 active2 last_close open high low price cur_vol s_vol ... ask_vol3 bid3 bid_vol3 ask4 ask_vol4 bid4 bid_vol4 ask5 ask_vol5 bid5 bid_vol5
datetime code ...
2019-08-26 10:40:07.158226 000008 10:39:59.736 10399956 558 558 3.5 3.45 3.46 3.43 3.45 30 18824 ... 2192 3.43 4778 3.49 1659 3.42 2926 3.5 3556 3.41 1469
[1 rows x 33 columns]
In [46]: QA.QA_fetch_get_stock_transaction_realtime('tdx','000008').tail()
e:\quantaxis\QUANTAXIS\QAFetch\QATdx.py:1033: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
for i in range(3)], axis=0)
Out[46]:
buyorsell num price time vol date datetime code order
datetime
2019-08-26 10:39:00 0.0 1.0 3.46 10:39 2.0 2019-08-26 2019-08-26 10:39:00 000008 554
2019-08-26 10:39:00 1.0 7.0 3.45 10:39 258.0 2019-08-26 2019-08-26 10:39:00 000008 555
2019-08-26 10:39:00 1.0 1.0 3.45 10:39 1.0 2019-08-26 2019-08-26 10:39:00 000008 556
2019-08-26 10:40:00 1.0 1.0 3.45 10:40 30.0 2019-08-26 2019-08-26 10:40:00 000008 557
2019-08-26 10:40:00 1.0 1.0 3.45 10:40 5.0 2019-08-26 2019-08-26 10:40:00 000008 558
In [47]: QA.QA_fetch_get_stock_realtime('tdx','000008')
Out[47]:
servertime reversed_bytes0 active1 active2 last_close open high low price cur_vol s_vol ... ask_vol3 bid3 bid_vol3 ask4 ask_vol4 bid4 bid_vol4 ask5 ask_vol5 bid5 bid_vol5
datetime code ...
2019-08-26 10:40:41.965212 000008 10:40:17.736 10402956 559 559 3.5 3.45 3.46 3.43 3.45 5 18829 ... 2099 3.43 4778 3.49 1659 3.42 2924 3.5 3556 3.41 1469
[1 rows x 33 columns]
In [48]: QA.QA_fetch_get_stock_transaction_realtime('tdx','000008').tail()
e:\quantaxis\QUANTAXIS\QAFetch\QATdx.py:1033: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.
To accept the future behavior, pass 'sort=False'.
To retain the current behavior and silence the warning, pass 'sort=True'.
for i in range(3)], axis=0)
Out[48]:
buyorsell num price time vol date datetime code order
datetime
2019-08-26 10:39:00 0.0 1.0 3.46 10:39 2.0 2019-08-26 2019-08-26 10:39:00 000008 554
2019-08-26 10:39:00 1.0 7.0 3.45 10:39 258.0 2019-08-26 2019-08-26 10:39:00 000008 555
2019-08-26 10:39:00 1.0 1.0 3.45 10:39 1.0 2019-08-26 2019-08-26 10:39:00 000008 556
2019-08-26 10:40:00 1.0 1.0 3.45 10:40 30.0 2019-08-26 2019-08-26 10:40:00 000008 557
2019-08-26 10:40:00 1.0 1.0 3.45 10:40 5.0 2019-08-26 2019-08-26 10:40:00 000008 558
可以看出 实时的首先reserve就慢于真实时间, 然后active 出现559的时候, transaction还是在558上晃悠