コード例 #1
0
 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)
コード例 #2
0
    # 公共-获取单个期权合约详细定价
    # result = optionAPI.get_option_instruments_summary(underlying='', instrument_id='')
    # 公共-获取深度数据
    # result = optionAPI.get_depth(instrument_id='', size='')
    # 公共-获取成交数据
    # result = optionAPI.get_trades(instrument_id='', after='', before='', limit='')
    # 公共-获取某个Ticker信息
    # result = optionAPI.get_specific_ticker('')
    # 公共-获取K线数据
    # result = optionAPI.get_kline(instrument_id='', start='', end='', granularity='')
    # 公共-获取历史结算/行权记录
    # result = optionAPI.get_history_settlement(instrument_id='', start='', end='', limit='')

# information api test
# 合约交易数据API
    informationAPI = information.InformationAPI(api_key, secret_key, passphrase, False)
    # 公共-多空持仓人数比
    # result = informationAPI.get_long_short_ratio(currency='', start='', end='', granularity='')
    # 公共-持仓总量及交易量
    # result = informationAPI.get_volume(currency='', start='', end='', granularity='')
    # 公共-主动买入卖出情况
    # result = informationAPI.get_taker(currency='', start='', end='', granularity='')
    # 公共-多空精英趋向指标
    # result = informationAPI.get_sentiment(currency='', start='', end='', granularity='')
    # 公共-多空精英平均持仓比例
    # result = informationAPI.get_margin(currency='', start='', end='', granularity='')

# index api test
# 指数API
    indexAPI = index.IndexAPI(api_key, secret_key, passphrase, False)
    # 公共-获取指数成分