Close One Leg
Submit a MARKET exit for one filled owner in the current run. All other legs continue running.
Endpoint URL
Local Host : POST http://127.0.0.1:5000/api/v1/strategy/close_leg
Ngrok Domain : POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/strategy/close_leg
Custom Domain: POST https://<your-custom-domain>/api/v1/strategy/close_legSample API Request
{
"apikey": "<your_app_apikey>",
"strategy_id": 7,
"leg_id": 2
}Sample cURL Request
curl -X POST http://127.0.0.1:5000/api/v1/strategy/close_leg \
-H 'Content-Type: application/json' \
-d '{
"apikey": "<your_app_apikey>",
"strategy_id": 7,
"leg_id": 2
}'Sample API Response
Request Body
apikey
Your OpenAlgo API key
Mandatory
-
strategy_id
Positive Strategy RMS id
Mandatory
-
leg_id
Positive configured leg id
Mandatory
-
Response Fields
status
string
success or error
run_id
integer
Current run containing the leg
leg_id
integer
Leg requested by the caller
run_stopped
boolean
True only when this call already proved the last owner flat
exits
array
Exit result for the leg
Notes
leg_idis the configuration id indata.legs[].idfrom Strategy Status, not an order or run id.A normal broker acknowledgement is asynchronous, so
run_stoppedis usuallyfalseeven for the last leg. A later fill can finalise the run.A refused exit, an unfilled entry, a non-open leg, or a missing current run returns HTTP 409 and does not open an opposing configured-size position.
Manual leg closure does not invoke trail-to-entry for the remaining legs.
Back to: Strategy RMS API
Last updated