Exemplo n.º 1
0
 def __init__(self, symbol, period, request, trades_max_size=2000):
     """
     symbol:交割合约如"BTC_CW"表示BTC当周合约,"BTC_NW"表示BTC次周合约,"BTC_CQ"表示BTC季度合约
     symbol:永久合约如"BTC_USD"
     """
     self._symbol = symbol
     self._request = request
     self._period = period
     self._trades_max_size = trades_max_size
     self._ch = "market.{s}.trade.detail".format(s=self._symbol.upper())
     SingleTask.run(self._init)
Exemplo n.º 2
0
 def __init__(self, strategy):
     """
     symbol:交割合约btc、bch
     contract_type当周:"this_week", 次周:"next_week", 季度:"quarter"
     symbol:永续合约BTC
     contract_type续合约:"BTC-USD"
     """
     self._strategy = strategy
     self._platform = self._strategy.platform
     self._symbol = self._strategy.symbol
     self._contract_type = self._strategy.trade_symbol
     self._ch = "orders.{symbol}".format(symbol=self._symbol)
     SingleTask.run(self._init)
Exemplo n.º 3
0
 def __init__(self, symbol, period, klines, request, klines_max_size=200):
     """
     symbol:如"BTC_CW"表示BTC当周合约,"BTC_NW"表示BTC次周合约,"BTC_CQ"表示BTC季度合约
     symbol:如"BTC_USD"...
     period:1min, 5min, 15min, 30min, 60min,4hour,1day,1week, 1mon
     """
     self._symbol = symbol
     self._period = period
     self._klines = klines
     self._request = request
     self._klines_max_size = klines_max_size
     self._ch = "market.{s}.kline.{p}".format(s=self._symbol.upper(),
                                              p=self._period)
     SingleTask.run(self._init)
Exemplo n.º 4
0
 def __init__(self, platform, symbol, contract_type, orders, request):
     """
     symbol:交割合约btc、bch
     contract_type当周:"this_week", 次周:"next_week", 季度:"quarter"
     symbol:永续合约BTC
     contract_type续合约:"BTC-USD"
     """
     self._platform = platform
     self._symbol = symbol
     self._orders = orders
     self._contract_type = contract_type
     self._request = request
     self._ch = "orders.{symbol}".format(symbol=self._symbol)
     SingleTask.run(self._init)
Exemplo n.º 5
0
 def __init__(self, strategy, period):
     """
     strategy:策略类
     symbol:如"BTC_CW"表示BTC当周合约,"BTC_NW"表示BTC次周合约,"BTC_CQ"表示BTC季度合约
     symbol:如"BTC_USD"...
     period:1min, 5min, 15min, 30min, 60min,4hour,1day,1week, 1mon
     """
     self._strategy = strategy
     self._symbol = self._strategy.mark_symbol
     self._max_size = self._strategy.klines_max_size
     self._period = period
     self._ch = "market.{s}.kline.{p}".format(s=self._symbol.upper(),
                                              p=self._period)
     SingleTask.run(self._init)
Exemplo n.º 6
0
 async def connected_callback(self):
     """
     链接成功
     """
     SingleTask.run(self._connected_callback)
Exemplo n.º 7
0
 def __init__(self, strategy):
     self._strategy = strategy
     self._symbol = self._strategy.symbol
     self._platform = self._strategy.platform
     SingleTask.run(self._init)