新增cross_order.py 文件
# -*- coding: utf-8 -*-import pandas as pdfrom gate_api import ApiClient, Configuration, FuturesApi, FuturesOrderfrom gate_api.exceptions import GateApiExceptionfrom gate_api.config import key, secret, hostimport weixinimport time
pd.set_option('expand_frame_repr', False)
config = Configuration(key=key, secret=secret, host=host)
futures_api = FuturesApi(ApiClient(config))
pd.set_option('expand_frame_repr', False)
config = Configuration(key=key, secret=secret, host=host)
futures_api = FuturesApi(ApiClient(config))
# 交易对集合# symbol:交易对
symbol_pool = ['BTC_USDT', 'ETH_USDT']
def get_orderbook_ask(symbol='EOS_USDT'):""" 查看买一的价格 @param symbol: 币种 @return: """ result = futures_api.list_futures_order_book(settle='usdt', contract=symbol)return float(result.asks[0].p)def get_orderbook_bid(symbol='EOS_USDT'):""" 查看卖一的价格
symbol_pool = ['BTC_USDT', 'ETH_USDT']