POST Flatten Positions

Flatten positions by account and/or instrument.

Flatten positions by account and/or instrument

POST /v1/api/accounts/{account}/positions/flatten

Flatten allows for flattening all positions and orders in an account or for a specific instrument in an account. Differs from Flatten Everything, which flattens all positions and order in all accounts for all instruments.

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <token>

Query Parameters

NameTypeRequiredDescription

account

string

Required

Name of account in NT8

Body

NameTypeRequiredDescription

instrument

string

Optional

Optional name of instrument

Code Examples (coming soon)

// Some code

Response

{
    "closedPositions": [
        {
            "type": "NinjaTrader.Cbi.Position",
            "account": "Sim101",
            "instrument": "MES 12-24",
            "instrumentType": "Future",
            "marketPosition": "Short",
            "quantity": 1,
            "averagePrice": 5803.25,
            "marketPrice": 5802.0,
            "unrealizedProfitLoss": 6.25
        }
    ],
    "success": true
}

Last updated