Skip to content

Add entire position TPSL support (new order)#80

Merged
alexex10 merged 2 commits intostarknetfrom
feature/add-entire-position-tpsl-support
Mar 16, 2026
Merged

Add entire position TPSL support (new order)#80
alexex10 merged 2 commits intostarknetfrom
feature/add-entire-position-tpsl-support

Conversation

@alexex10
Copy link
Contributor

@alexex10 alexex10 commented Mar 16, 2026

Changes

  • Add entire position TPSL support (as a part of new order)

In the next PR I will support "independent" TPSL creation (after that we can release a new version).

# examples/create_limit_order_with_position_tpsl.py

[2026-03-16 15:54:24,003 90288 8828265024 DEBUG] Sending GET https://api.starknet.sepolia.extended.exchange/api/v1/info/markets?
[2026-03-16 15:54:25,681 90288 8828265024 INFO] Creating LIMIT order object with TPSL for market: ETH-USD
[2026-03-16 15:54:25,683 90288 8828265024 INFO] Placing order...
[2026-03-16 15:54:25,683 90288 8828265024 DEBUG] Placing an order: id=3256670774275045932423044400483329861472404627462665445901551545911968344211
[2026-03-16 15:54:25,683 90288 8828265024 DEBUG] Sending POST https://api.starknet.sepolia.extended.exchange/api/v1/user/order, headers={<RequestHeader.ACCEPT: 'Accept'>: 'application/json', <RequestHeader.CONTENT_TYPE: 'Content-Type'>: 'application/json', <RequestHeader.USER_AGENT: 'User-Agent'>: 'X10PythonTradingClient/0.0.17', <RequestHeader.API_KEY: 'X-Api-Key'>: '6c9a7ffba37265164ee37e6ccf78cd85'}
[2026-03-16 15:54:26,519 90288 8828265024 INFO] Order is placed: {
    "status": "OK",
    "data": {
        "id": 2033512211630149632,
        "external_id": "3256670774275045932423044400483329861472404627462665445901551545911968344211"
    },
    "error": null,
    "pagination": null
}
[2026-03-16 15:54:26,519 90288 8828265024 DEBUG] Sending GET https://api.starknet.sepolia.extended.exchange/api/v1/user/orders/2033512211630149632
[2026-03-16 15:54:27,331 90288 8828265024 INFO] Found placed order: {
    "status": "OK",
    "data": {
        "id": 2033512211630149632,
        "account_id": 3039,
        "external_id": "3256670774275045932423044400483329861472404627462665445901551545911968344211",
        "market": "ETH-USD",
        "type": "LIMIT",
        "side": "BUY",
        "status": "NEW",
        "status_reason": null,
        "price": "2034.20",
        "average_price": null,
        "qty": "0.001",
        "filled_qty": "0",
        "reduce_only": false,
        "post_only": true,
        "payed_fee": "0",
        "created_time": 1773662066731,
        "updated_time": 1773662066739,
        "expiry_time": null,
        "time_in_force": "GTT",
        "tp_sl_type": "POSITION",
        "take_profit": {
            "trigger_price": "2044.38",
            "trigger_price_type": "LAST",
            "price": "2054.55",
            "price_type": "LIMIT",
            "status": "UNTRIGGERED"
        },
        "stop_loss": {
            "trigger_price": "2024.03",
            "trigger_price_type": "LAST",
            "price": "2013.86",
            "price_type": "LIMIT",
            "status": "UNTRIGGERED"
        }
    },
    "error": null,
    "pagination": null
}
[2026-03-16 15:54:27,331 90288 8828265024 INFO] Cancelling placed order...
[2026-03-16 15:54:27,331 90288 8828265024 DEBUG] Sending DELETE https://api.starknet.sepolia.extended.exchange/api/v1/user/order/2033512211630149632, headers={<RequestHeader.ACCEPT: 'Accept'>: 'application/json', <RequestHeader.CONTENT_TYPE: 'Content-Type'>: 'application/json', <RequestHeader.USER_AGENT: 'User-Agent'>: 'X10PythonTradingClient/0.0.17', <RequestHeader.API_KEY: 'X-Api-Key'>: '6c9a7ffba37265164ee37e6ccf78cd85'}
[2026-03-16 15:54:27,518 90288 8828265024 INFO] Placed order is cancelled

@alexex10 alexex10 marked this pull request as ready for review March 16, 2026 12:02
@alexex10 alexex10 changed the title Add entire position TPSL support Add entire position TPSL support (new order) Mar 16, 2026
@alexex10 alexex10 merged commit 9d23310 into starknet Mar 16, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants