Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error When trying to modify SL #13

Open
swaran2 opened this issue Dec 4, 2023 · 0 comments
Open

Error When trying to modify SL #13

swaran2 opened this issue Dec 4, 2023 · 0 comments

Comments

@swaran2
Copy link

swaran2 commented Dec 4, 2023

Hey all, I'm trying to implement a system where there are multiple TP levels and everytime the price reaches those levels the SL will move upwards like to entry, tp1 and so on. I've been using the amend method and I get this issue. From what I see the order is placed with the original TP and SL.

# Place the order for entry 1
    orderlinkid_entry1 = f"t{int(time.time())}-test-postonly"
    response_entry1 = session.place_order(
        category="linear",
        symbol=coin,
        side=side,
        orderType="Limit",
        qty=str(formatted_qty),
        price=entry1,
        timeInForce="PostOnly",
        orderlinkid=orderlinkid_entry1,
        isLeverage=1,
        orderFilter="Order",
        takeProfit=str(tp5),  # Target 5
        stopLoss=str(sl),  # SL
        tpTriggerBy="MarkPrice",
        slTriggerB="IndexPrice",
        tpslMode="Partial",
        tpOrderType="Limit",
        slOrderType="Limit",
        tpSize="20",
        slSize="100",
        tpLimitPrice=str(tp1),
        slLimitPrice=str(sl),  # SL
    )

    ## Amending Stop Loss to Entry as soon as TP1 is reached

    print(session.amend_order(
        category="linear",
        symbol=coin,
        orderLinkId=orderlinkid_entry1,
        triggerPrice=str(tp1),
        stopLoss=str(entry1),
    ))

Error Message :

pybit.exceptions.InvalidRequestError: order not exists or too late to replace (ErrCode: 110001) (ErrTime: 04:33:13).
Request → POST https://api-testnet.bybit.com/v5/order/amend: {"category": "linear", "symbol": "CHZUSDT", "orderLinkId": "t1701664392-test-postonly", "triggerPrice": "0.0778", "stopLoss": "0.0735"}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant