Home>

I want my order to be canceled if I place a buy limit at a price above the current price

I have put a command equivalent to post-only as params, but at present the order is not canceled and the market is executed as it is.
(It seems that "execInst": "ParticipateDoNotInitiate" at the bottom of the corresponding source code is not working with the same behavior as simply putting a limit price)
No particular error is returned at runtime.
Bybit's normal order screen has a post-only checkbox, so it should be a feature.
However, even if I check the order relation of the bybit api specification, it seems that the post-only command is not found.

Error message
Corresponding source code
order = bybit.create_order (
    symbol = "BTC/USD",
    type = "limit",
    side = "buy",
    amount = 1000,
    price = 17000,
    params = {"execInst": "ParticipateDoNotInitiate"})
What I tried

Please describe here what you have tried for the problem.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

  • Answer # 1

    import ccxt
    bybit = ccxt.bybit ({"apiKey": "key", "secret": "secret"})

    order = bybit.private_post_order_create ({"side": sides,
    "symbol": "BTCUSD", "order_type": "Limit",
    "qty": qtys, "price": prices, "time_in_force": "PostOnly"})

    Can go