Пример #1
0
def place_order():

    global edicts
    order = json_loads(prototype_order())
    order['header']['wif'] = wif
    order['edicts'] = edicts
    broker(order)
    edicts = []
Пример #2
0
def cancel_all():

    global edicts
    edicts = [{'op': 'cancel', 'ids': ['1.7.X']}]
    order = json_loads(prototype_order())
    order['header']['wif'] = wif
    order['edicts'] = edicts
    broker(order)
    edicts = []
Пример #3
0
def place_order(edicts, mode):
    """
    Places BUY and SELL orders given a list of edicts
    Calls manualSIGNING.py with broker(order) method
    """
    order = json_loads(prototype_order())
    order["header"]["wif"] = mode["wif"]
    order["edicts"] = edicts
    live_chart_edicts(edicts)
    if not mode["paper"]:
        broker(order)
    else:
        print(order)
Пример #4
0
def cancel_all(mode):
    """
    Cancels all outstanding orders
    Calls manualSIGNING.py with broker(order) method
    """
    edicts = [{"op": "cancel", "ids": ["1.7.X"]}]
    order = json_loads(prototype_order())
    order["header"]["wif"] = mode["wif"]
    order["edicts"] = edicts
    if not mode["paper"]:
        broker(order)
    else:
        print(order)
Пример #5
0
def log_in():

    global authenticated
    edicts = [{"op": "login"}]
    order = json_loads(prototype_order())
    order["header"]["wif"] = wif
    order["edicts"] = edicts
    authenticated = broker(order)
Пример #6
0
def log_in():

    global edicts
    edicts = [{'op': 'login'}]
    order = json_loads(prototype_order())
    order['header']['wif'] = wif
    order['edicts'] = edicts
    authenticated = broker(order)
    edicts = []
    return authenticated
Пример #7
0
def fee_maintainer(mode):
    """
    If holding less than 0.5 BTS, then buy 1.5 BTS
    Gathers balances via metaNODE.txt
    Calls manualSIGNING.py with broker(order) method
    Pays with market currency, unless BTS: Then pay with assets
    """
    metaNODE = Bitshares_Trustless_Client()
    nodes = metaNODE["whitelist"]
    precision = metaNODE["currency_precision"]
    account_name = metaNODE["account_name"]
    account_id = metaNODE["account_id"]
    bts = metaNODE["bts_balance"]
    cid = metaNODE["currency_id"]
    if metaNODE["currency"] == "BTS":
        cid = metaNODE["asset_id"]
        precision = metaNODE["asset_precision"]
    del metaNODE
    print("BTS Balance: %.2f" % bts)
    if bts < 0.5:
        order = {
            "edicts": [{
                "op": "buy",
                "amount": 1.5,
                "price": 99999,
                "expiration": 0
            }],
            "header": {
                "asset_id": "1.3.0",
                "currency_id": cid,
                "asset_precision": 5,
                "currency_precision": precision,
                "account_id": account_id,
                "account_name": account_name,
                "wif": mode["wif"],
            },
            "nodes":
            nodes,
        }
        if not mode["paper"]:
            broker(order)
        else:
            print(order)
Пример #8
0
def authenticate(mode):
    """
    Matches Private Key to Account Name via Public Key
    Calls manualSIGNING.py with broker(order) method
    """
    edicts = [{"op": "login"}]
    order = json_loads(prototype_order())
    order["header"]["wif"] = mode["wif"]
    order["edicts"] = edicts
    authenticated = broker(order)
    return authenticated