You are viewing a single comment's thread from:

RE: I Need To Be Cancelled

in Synergy Builders2 months ago

The only thing that jumps out at me is that one of them you are sending a list [] and the other one you are sending a dict {}, which should be also be a list in:

    if 'type' in order and '_id' in order:
        payload = [{
            "contractName": "market",
            "contractAction": "cancel",
            "contractPayload": {
                "type": order["type"],
                "id": str(order["_id"])
            }
        }]
    elif 'orderId' in order:
        payload = { # <-- This one is missing the [
            "contractName": "market",
            "contractAction": "cancel",
            "contractPayload": {
                "orderId": str(order["orderId"])
            }
        } # <--- and the closing ]
    else:
        print("[CANCEL ERROR] Order missing required fields for cancellation:", order)
        return False
Sort:  

Everything shut down when my main computer updated. I'm going to have to make a script to run the trading bots on booting of the Pi's I have. I'll check my code out as soon as I can.