Ejemplo n.º 1
0
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!")
Ejemplo n.º 2
0
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!")
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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