You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
# -*- coding: utf-8 -*-
|
|
from utils import utility
|
|
from utils import config
|
|
|
|
from huobi.client.account import AccountClient
|
|
from huobi.client.trade import TradeClient
|
|
from huobi.constant import *
|
|
from huobi.utils import *
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
config.loads('./conf_huobi/config.json')
|
|
order_list_submitted = []
|
|
|
|
trade_client = TradeClient(api_key=config.api_key, secret_key=config.api_secret)
|
|
account_client = AccountClient(api_key=config.api_key, secret_key=config.api_secret)
|
|
|
|
account_spot = account_client.get_account_by_type_and_symbol(account_type=AccountType.SPOT, symbol=None)
|
|
account_id_test = account_spot.id
|
|
direct_tmp = QueryDirection.NEXT
|
|
LogInfo.output("==============test case 1 for {direct}===============".format(direct=direct_tmp))
|
|
for symbol in config.symbol_spot:
|
|
print(symbol)
|
|
list_obj = trade_client.get_open_orders(symbol=symbol, account_id=account_id_test, direct=direct_tmp)
|
|
for order in list_obj:
|
|
if order.state == 'submitted':
|
|
order_list_submitted.append(str(order.id))
|
|
print(order.id)
|
|
print(order)
|
|
#LogInfo.output_list(list_obj)
|
|
|
|
|
|
# direct_tmp = QueryDirection.PREV
|
|
# LogInfo.output("==============test case 2 for {direct}===============".format(direct=direct_tmp))
|
|
# list_obj = trade_client.get_open_orders(symbol=symbol, account_id=account_id_test, direct=direct_tmp)
|
|
# LogInfo.output_list(list_obj)
|
|
|
|
|
|
|
|
|
|
# #启动新实例 发个通知
|
|
# utility.alert(f"{utility.cn_time()} 火币订单监控启动")
|
|
|
|
# while True:
|
|
# try:
|
|
# time.sleep(20)
|
|
#
|
|
# except Exception as error:
|
|
# utility.alert(error)
|
|
# time.sleep(5)
|
|
|