示例#1
0
文件: tools.py 项目: isvirin/7pay_in
def depth():
    if len(request.args) == 0:
        mess = 'len(request.args)==0'
        print mess
        return mess
    import exch_client
    exchg = db.exchgs[request.args[0]]
    pair = request.args[1]
    exch_client.conn(exchg)
    sells, pays = exch_client.depth(exchg.name, pair)
    exch_client.conn_close(exchg)
    return dict(sells=sells, buy=pays)
示例#2
0
def get_from_exch(db, exchg):
    if exchg.API_type == 'btc-e_3':
        return from_btc_e_3(db, exchg)
    elif exchg.API_type == 'poloniex':
        return from_poloniex(db, exchg)
    elif exchg.API_type == 'livecoin':
        return from_livecoin(db, exchg)
    elif exchg.API_type == 'cryptsy':
        return from_cryptsy(db, exchg)
    else:
        conn = exch_client.conn(exchg)
        res = from_btc_e(db, exchg)
        exch_client.conn_close(exchg)
        return res
示例#3
0
def get_all(db, turn3):
    curr_usd = db(db.currs.abbrev == 'USD').select().first()
    if not curr_usd:
        print 'can\'t find USD currency'
        return

    for exchg in db(db.exchgs).select():
        #print exchg
        if not exchg.used: continue

        print exchg.name
        if exchg.API_type == 'btc-e_3':
            from_btc_e_3(db, exchg)
            continue
        elif exchg.API_type == 'fiat':
            if turn3:
                form_fiats(db, exchg, curr_usd)
            continue
        conn = exch_client.conn(exchg)
        if exchg.API_type == 'cryptsy':
            from_cryptsy(db, exchg)  #, conn)
        else:
            from_btc_e(db, exchg)
            exch_client.conn_close(exchg)