Beispiel #1
0
def create(special):

    record = Keys.query.filter(Keys.url == special).first()
    # Class initialisation for bitmarket API
    yolo = Yolo(record.public_key, record.private_key)
    yolo.cancel_all()
    yolo.make_best()
    return "Made best offer!"
Beispiel #2
0
def display(special):
    # Query database for keys
    record = Keys.query.filter(Keys.url == special).first()
    # Class initialisation for bitmarket API
    yolo = Yolo(record.public_key, record.private_key)
    balance = str(yolo.get_balance())
    positions = yolo.swap_list()
    # Setting cookie
    # cutoff level
    cut = yolo.get_cutoff()
    rsp = make_response(render_template("display.html",
                        balance=balance,
                        positions=positions,
                        cut=cut,
                        special=special))
    rsp.set_cookie('key', 'value')
    return rsp
Beispiel #3
0
def display(special):
    # Query database for keys
    record = Keys.query.filter(Keys.url == special).first()
    # Class initialisation for bitmarket API
    yolo = Yolo(record.public_key, record.private_key)
    balance = str(yolo.get_balance())
    positions = yolo.swap_list()
    # Setting cookie
    # cutoff level
    cut = yolo.get_cutoff()
    rsp = make_response(
        render_template("display.html",
                        balance=balance,
                        positions=positions,
                        cut=cut,
                        special=special))
    rsp.set_cookie('key', 'value')
    return rsp
Beispiel #4
0
def create(special):

    record = Keys.query.filter(Keys.url == special).first()
    # Class initialisation for bitmarket API
    yolo = Yolo(record.public_key, record.private_key)
    yolo.cancel_all()
    yolo.make_best()
    return "Made best offer!"
Beispiel #5
0
# connect to db
# get keys list
# for each key perform update

from app import Keys, db
from swaper import Yolo, BitapiException

import time
import logging

#logging.basicConfig(level=logging.DEBUG)

k = Keys.query.all()

for i in k:
    try:
        y = Yolo(key=i.public_key, secret=i.private_key)
        print y.cancel_all()
        print y.make_best()
    except BitapiException as e:
        print(e.args[0])
        if e.args[0]['errorMsg'] == 'Invalid API key':
            print "Key to be removed :_: "
            Keys.query.filter_by(private_key=i.private_key).delete()
            db.session.commit()
    except Exception as e:
        logging.exception('General Exception')
        # print e