| | |
| | | huaxin_trade_data_update.add_position_list() |
| | | elif ctype == "deal_list": |
| | | huaxin_trade_data_update.add_deal_list() |
| | | elif ctype == "position_list": |
| | | elif ctype == "delegate_list": |
| | | huaxin_trade_data_update.add_delegate_list("手动刷新") |
| | | send_response({"code": 0, "data": {}}, client_id, request_id) |
| | | elif type_ == outside_api_command_manager.API_TYPE_COMMON_REQUEST: |
| | |
| | | |
| | | def test(): |
| | | time.sleep(5) |
| | | while True: |
| | | print("获取持仓:", huaxin_trade_data_update.add_position_list()) |
| | | time.sleep(3) |
| | | # print("获取资金:", huaxin_trade_api.get_money()) |
| | | # print("获取成交:", huaxin_trade_api.get_deal_list()) |
| | | # print("下单:", huaxin_trade_api.order(1, "127075", 10, 140.5, blocking=True)) |
| | |
| | | # middle_api_protocol.SERVER_HOST = "192.168.3.122" |
| | | manager = outside_api_command_manager.NewApiCommandManager() |
| | | manager.init(middle_api_protocol.SERVER_HOST, middle_api_protocol.SERVER_PORT, |
| | | command_callback, [("trade_cb", 20)]) |
| | | command_callback, [("trade_cb", 50)]) |
| | | manager.run(blocking=False) |
| | | |
| | | threading.Thread(target=test, daemon=True).start() |