コード例 #1
0
ファイル: app.py プロジェクト: dariomadi/OpenExchange
def cancelorder(old_order_id):
    if not is_logged_in(session):
        return home_page("ltc_btc",danger="Please log in to perform that action.")
    uid = session['userid']
    if old_order_id not in redis.smembers(str(uid)+"/orders"):
        return home_page("ltc_btc",danger="Unable to cancel the specified order!")    
    orderid = generate_password_hash(str(random.random()))
    redis.hmset(orderid, {"ordertype":'cancel', "uid":uid, 'old_order_id':old_order_id})
    redis.rpush("order_queue",orderid)
    return home_page("ltc_btc", dismissable="Cancelled order!")
コード例 #2
0
ファイル: app.py プロジェクト: BobbyBooShay/OpenExchange
def cancelorder(old_order_id):
    if not is_logged_in(session):
        return home_page("ltc_btc",danger="Please log in to perform that action.")
    uid = session['userid']
    if old_order_id not in redis.smembers(str(uid)+"/orders"):
        return home_page("ltc_btc",danger="Unable to cancel the specified order!")    
    orderid = generate_password_hash(str(random.random()))
    redis.hmset(orderid, {"ordertype":'cancel', "uid":uid, 'old_order_id':old_order_id})
    redis.rpush("order_queue",orderid)
    return home_page("ltc_btc", dismissable="Cancelled order!")
コード例 #3
0
ファイル: app.py プロジェクト: dariomadi/OpenExchange
def openorders(uid):
    if not is_logged_in(session):
        return home_page("ltc_btc",danger="Please log in to perform that action.")
    orders = redis.smembers(str(uid)+"/orders")
    r = []
    for o in orders:
        c = redis.hgetall(o)
        base_currency = c['instrument'][0:c['instrument'].find("_")]
        quote_currency = c['instrument'][c['instrument'].find("_")+1:]
        instrument = (base_currency+"/"+quote_currency).upper()
        r.append([instrument, c['ordertype'], c['price'] + " " + instrument, str(float(c['amount'])/config.get_multiplier(base_currency)) + " " + base_currency.upper(), o])
    return r
コード例 #4
0
ファイル: app.py プロジェクト: BobbyBooShay/OpenExchange
def openorders(uid):
    if not is_logged_in(session):
        return home_page("ltc_btc",danger="Please log in to perform that action.")
    orders = redis.smembers(str(uid)+"/orders")
    r = []
    for o in orders:
        c = redis.hgetall(o)
        base_currency = c['instrument'][0:c['instrument'].find("_")]
        quote_currency = c['instrument'][c['instrument'].find("_")+1:]
        instrument = (base_currency+"/"+quote_currency).upper()
        r.append([instrument, c['ordertype'], c['price'] + " " + instrument, str(int(c['amount'])/config.get_multiplier(base_currency)) + " " + base_currency.upper(), o])
    return r