Skip to content

How to use placeOrder correctly in a RESTful Python script #57

@shaunster666

Description

@shaunster666

I'm currently using placeOrder like this:

` try:
market = coin
side = "sell"
order_type = "stopLoss"
order_body = {
"amount": amount, # Amount to sell
"triggerAmount": triggerAmount, # Trigger price for the stop-loss
"triggerType": "price" ,
"triggerReference": "bestBid"
}

    # Place the order
    response = bitvavo.placeOrder(
        market=coin,
        side=side,
        orderType=order_type,
        body=order_body
    )
    except Exception as e:
        print(f"An error occurred while placing the order: {e}")

`

But if something is amiss it never executes the print line after the exception

Apologies for bothering you about this but I'm a newbie to all this so thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions