[Add] 增加订阅用户自己交易信息的接口:OkexFutureApi.OkexFutureWebSocketClient.subscribeUserTrade

This commit is contained in:
nanoric 2018-10-17 05:47:36 -04:00
parent b90d997456
commit 028d344fc0

View File

@ -519,6 +519,14 @@ class OkexFutureWebSocketClient(OkexFutureWebSocketBase):
'channel': 'ok_sub_futureusd_' + easySymbol + '_ticker_' + contractType 'channel': 'ok_sub_futureusd_' + easySymbol + '_ticker_' + contractType
}) })
#----------------------------------------------------------------------
def subscribeUserTrade(self):
# todo: 没有测试条件
self.sendPacket({
'event': 'addChannel',
'channel': 'ok_sub_futureusd_trades'
})
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def defaultOnPacket(self, packets): def defaultOnPacket(self, packets):
@ -557,6 +565,8 @@ class OkexFutureWebSocketClient(OkexFutureWebSocketBase):
# channel.symbol, channel.remoteContractType, *tradeInfo # channel.symbol, channel.remoteContractType, *tradeInfo
# )) # ))
# self.onTrades(trades) # self.onTrades(trades)
# todo: 没有测试条件
elif channel.type == ChannelType.UserTrade: elif channel.type == ChannelType.UserTrade:
self.onUserTrade(OkexFutureUserTradeInfo( self.onUserTrade(OkexFutureUserTradeInfo(
symbol=packet['symbol'], # str # btc_usd ltc_usd eth_usd etc_usd bch_usd symbol=packet['symbol'], # str # btc_usd ltc_usd eth_usd etc_usd bch_usd