def __init__(self, api_key: str, api_secret: str, passphrase: str, is_debug=False): super().__init__(api_key, api_secret, passphrase, is_debug=is_debug) self.account_api = account_api.AccountAPI(self.api_key, self.api_secret, self.passphrase, False) self.spot_api = spot_api.SpotAPI(self.api_key, self.api_secret, self.passphrase, False) self.margin_api = lever_api.LeverAPI(self.api_key, self.api_secret, self.passphrase, False) self.futures_api = futures_api.FutureAPI(self.api_key, self.api_secret, self.passphrase, False) self.swap_api = swap_api.SwapAPI(self.api_key, self.api_secret, self.passphrase, False) self.options_api = option_api.OptionAPI(self.api_key, self.api_secret, self.passphrase, False) self.information_api = information_api.InformationAPI( self.api_key, self.api_secret, self.passphrase, False) self.index_api = index_api.IndexAPI(self.api_key, self.api_secret, self.passphrase, False)
# 公共-获取平台总持仓量 (20次/2s) # result = swapAPI.get_holds('') # 公共-获取当前限价 (20次/2s) # result = swapAPI.get_limit('') # 公共-获取强平单 (20次/2s) # result = swapAPI.get_liquidation('', '') # 公共-获取合约资金费率 (20次/2s) # result = swapAPI.get_funding_time('') # 公共-获取合约标记价格 (20次/2s) # result = swapAPI.get_mark_price('') # 公共-获取合约历史资金费率 (20次/2s) # result = swapAPI.get_historical_funding_rate('') # option api test # 期权合约API optionAPI = option.OptionAPI(api_key, secret_key, passphrase, False) # 单个标的指数持仓信息 (20次/2s) # result = optionAPI.get_specific_position('') # 单个标的物账户信息 (20次/2s) # result = optionAPI.get_underlying_account('') # 下单 (20次/s) # result = optionAPI.take_order('', '', '', '', match_price='0') # 批量下单 (20次/2s) # result = optionAPI.take_orders('', [ # {"instrument_id": "", "side": "", "price": "", "size": "", "order_type": "0", "match_price": "0"}, # {"instrument_id": "", "side": "", "price": "", "size": "", "order_type": "0", "match_price": "0"} # ]) # 撤单 (20次/s) # result = optionAPI.revoke_order('', '') # 批量撤单 (20次/2s) # result = optionAPI.revoke_orders('', order_ids=["", ""])
# 公共-获取合约资金费率 (20次/2s) # result = swapAPI.get_funding_time('XRP-USD-SWAP') # 公共-获取合约标记价格 (20次/2s) # result = swapAPI.get_mark_price('XRP-USD-SWAP') # 公共-获取合约历史资金费率 (能查询最近7天的数据)(20次/2s) # result = swapAPI.get_historical_funding_rate('XRP-USD-SWAP') # 指数API # index api test indexAPI = index.IndexAPI(api_key, seceret_key, passphrase, True) # 公共-获取指数成分 (20次/2s) # result = indexAPI.get_index_constituents('BTC-USD') # 期权合约API # option api test optionAPI = option.OptionAPI(api_key, seceret_key, passphrase, True) # 单个标的指数持仓信息 (20次/2s) # result = optionAPI.get_specific_position('TBTC-USD') # 单个标的物账户信息 (20次/2s) # result = optionAPI.get_underlying_account('TBTC-USD') # 下单 (40次/2s) # result = optionAPI.take_order('TBTC-USD-191213-7000-C', 'buy', '', '1', match_price='1') # 批量下单 (每个标的指数最多可批量下10个单)(20次/2s) # result = optionAPI.take_orders('TBTC-USD', [ # {"instrument_id": "TBTC-USD-191213-6000-C", "side": "buy", "price": "0.1835", "size": "1", "order_type": "0", "match_price": "0"}, # {"instrument_id": "TBTC-USD-191213-7000-P", "side": "buy", "price": "0.0126", "size": "1", "order_type": "0", "match_price": "0"} # ]) # 撤单 (40次/2s) # result = optionAPI.revoke_order('TBTC-USD', order_id='125259570520055808') # 批量撤单 (每个标的指数最多可批量撤10个单)(20次/2s) # result = optionAPI.revoke_orders('TBTC-USD', order_ids=["155801767097874432", "155803099442657280"])