コード例 #1
0
def request_order_detail_channel(order_id, client_req_id=None):
    channel = dict()
    channel["op"] = "req"
    channel["topic"] = "orders.detail"
    channel["order-id"] = str(order_id)
    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 request_order_list_channel(symbol, account_id, states_str=None, client_req_id=None, more_key={}):
    channel = dict()
    try:
        channel["op"] = "req"
        channel["account-id"] = account_id
        channel["topic"] = "orders.list"
        channel["symbol"] = symbol
        if states_str and len(states_str):
            channel["states"] = str(states_str)
        channel["cid"] = str(client_req_id) if client_req_id else str(get_current_timestamp())
        channel = dict_add_new(channel, more_key)

    except Exception as e:
        print(e)
    return json.dumps(channel)
コード例 #4
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)
コード例 #5
0
def request_market_detail_channel(symbol):
    channel = dict()
    channel["req"] = "market." + symbol + ".detail"
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)
コード例 #6
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)
コード例 #7
0
ファイル: channels.py プロジェクト: notechats/notecoin
def request_mbp_channel(symbol, levels):
    channel = dict()
    channel["req"] = "market.{symbol}.mbp.{levels}".format(symbol=symbol,
                                                           levels=levels)
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)
コード例 #8
0
ファイル: channels.py プロジェクト: notechats/notecoin
def mbp_full_channel(symbol, levels):
    channel = dict()
    channel["sub"] = "market.{symbol}.mbp.refresh.{levels}".format(
        symbol=symbol, levels=levels)
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)
コード例 #9
0
ファイル: channels.py プロジェクト: notechats/notecoin
def kline_channel(symbol, interval):
    channel = dict()
    channel["sub"] = "market." + symbol + ".kline." + interval
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)
コード例 #10
0
ファイル: channels.py プロジェクト: notechats/notecoin
def price_depth_bbo_channel(symbol):
    channel = dict()
    channel["sub"] = "market." + symbol + ".bbo"
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)
コード例 #11
0
ファイル: channels.py プロジェクト: notechats/notecoin
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)
コード例 #12
0
ファイル: channels.py プロジェクト: notechats/notecoin
def trade_detail_channel(symbol):
    channel = dict()
    channel["sub"] = "market." + symbol + ".trade.detail"
    channel["id"] = str(get_current_timestamp())
    return json.dumps(channel)