@@ -18,6 +18,14 @@ def on_query_subscribed_quote(symbols, focus_keys, limit, used):
1818 :param limit: 当前 tigerid 可以订阅的合约数量
1919 :param used: 目前已订阅的合约数量
2020 :return:
21+ 返回示例:
22+ symbols: ['00700', 'SPY'],
23+ focus_keys: {'00700': ['ask_size', 'latest_price', 'ask_price', 'prev_close', 'open', 'minute', 'low', 'volume',
24+ 'bid_price', 'bid_size', 'high', 'close'], 'SPY': ['ask_size', 'latest_price', 'ask_price', 'prev_close',
25+ 'open', 'minute', 'low', 'volume', 'bid_price', 'bid_size', 'high', 'close']},
26+ limit: 100,
27+ used: 2
28+
2129 """
2230 print (symbols , focus_keys , limit , used )
2331
@@ -29,19 +37,56 @@ def on_quote_changed(symbol, items, hour_trading):
2937 :param items: list,每个元素是一个tuple,对应订阅的字段名称和值
3038 :param hour_trading: 是否为盘前盘后的交易
3139 :return:
40+ items 数据示例
41+ [('latest_price', 339.8), ('ask_size', 42500), ('ask_price', 340.0), ('bid_size', 1400), ('bid_price', 339.8),
42+ ('high', 345.0), ('prev_close', 342.4), ('low', 339.2), ('open', 344.0), ('volume', 7361440),
43+ ('minute', {'p': 339.8, 'a': 341.084, 't': 1568098440000, 'v': 7000, 'h': 340.0, 'l': 339.8}),
44+ ('timestamp', '1568098469463')]
3245 """
3346 print (symbol , items , hour_trading )
3447
3548
3649def on_order_changed (account , items ):
50+ """
51+
52+ :param account:
53+ :param items:
54+ :return:
55+ items 数据示例:
56+ [('order_type', 'LMT'), ('symbol', 'ABCD'), ('order_id', 1000101463), ('sec_type', 'STK'), ('filled', 100),
57+ ('quantity', 100), ('segment', 'summary'), ('action', 'BUY'), ('currency', 'USD'), ('id', 173612806463631360),
58+ ('order_time', 1568095814556), ('time_in_force', 'DAY'), ('identifier', 'ABCD'), ('limit_price', 113.7),
59+ ('outside_rth', True), ('avg_fill_price', 113.7), ('trade_time', 1568095815418),
60+ ('status', <OrderStatus.FILLED: 'Filled'>)]
61+ """
3762 print (account , items )
3863
3964
4065def on_asset_changed (account , items ):
66+ """
67+
68+ :param account:
69+ :param items:
70+ :return:
71+ items 数据示例:
72+ [('equity_with_loan', 721583.83), ('gross_position_value', 1339641.94),
73+ ('excess_liquidity', 378624.18), ('available_funds', 320059.1), ('initial_margin_requirement', 497419.25),
74+ ('buying_power', 2293551.51), ('cash', 950059.0), ('segment', 'summary'), ('net_liquidation', 817685.72),
75+ ('maintenance_margin_requirement', 439061.54)]
76+ """
4177 print (account , items )
4278
4379
4480def on_position_changed (account , items ):
81+ """
82+
83+ :param account:
84+ :param items:
85+ :return:
86+ items 数据示例:
87+ [('symbol', 'ABCD'), ('market_price', 3.68525), ('market_value', 0.0), ('sec_type', 'STK'),
88+ ('segment', 'summary'), ('currency', 'USD'), ('quantity', 0.0), ('average_cost', 3.884548)]
89+ """
4590 print (account , items )
4691
4792
0 commit comments