示例#1
0
 def request_account_list_channel(_client_req_id=None):
     channel = dict()
     channel["op"] = "req"
     channel["topic"] = "accounts.list"
     channel["cid"] = str(_client_req_id) if _client_req_id else str(
         get_current_timestamp())
     return json.dumps(channel)
示例#2
0
 def request_kline_channel(symbol,
                           _interval,
                           _from_ts_second=None,
                           to_ts_second=None):
     channel = dict()
     channel["req"] = "market." + symbol + ".kline." + _interval
     channel["id"] = str(get_current_timestamp())
     if _from_ts_second:
         channel["from"] = int(_from_ts_second)
     if to_ts_second:
         channel["to"] = int(to_ts_second)
     return json.dumps(channel)
示例#3
0
 def kline_channel(symbol, _interval):
     channel = dict()
     channel["sub"] = "market." + symbol + ".kline." + _interval
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#4
0
 def request_mbp_channel(symbol, level):
     channel = dict()
     channel["req"] = "market.{symbol}.mbp.{level}".format(
         symbol=symbol, level=level)
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#5
0
 def mbp_full_channel(symbol, level):
     channel = dict()
     channel["sub"] = "market.{symbol}.mbp.refresh.{level}".format(
         symbol=symbol, level=level)
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#6
0
 def request_trade_detail_channel(symbol):
     channel = dict()
     channel["req"] = "market." + symbol + ".trade.detail"
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#7
0
 def market_detail_channel(_symbol):
     channel = dict()
     channel["sub"] = "market." + _symbol + ".detail"
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#8
0
 def request_price_depth_channel(symbol, step_type="step0"):
     channel = dict()
     channel["req"] = "market." + symbol + ".depth." + step_type
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#9
0
 def price_depth_bbo_channel(symbol):
     channel = dict()
     channel["sub"] = "market." + symbol + ".bbo"
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)
示例#10
0
 def price_depth_channel(symbol, step_type=DepthStep.STEP0):
     channel = dict()
     channel["sub"] = "market." + symbol + ".depth." + step_type
     channel["id"] = str(get_current_timestamp())
     return json.dumps(channel)