Positions #

The positions API provides information about an account’s current open positions. The response will include information such as cost basis, shares traded, and market value, which will be updated live as price information is updated. Once a position is closed, it will no longer be queryable through this API.

Get open positions

GET /v2/positions
Retrieves a list of the account’s open positions.

Response

An array of Position object

Get an open position

GET /v2/positions/{symbol}
Retrieves the account’s open position for the given symbol.

Parameters

Path Parameters

Attribute Type Requirement Description
symbol string
Optional
symbol or asset_id

Response

A Position object

Errors

404 Not found
Position is not found.

Close all positions

DELETE /v2/positions
Closes (liquidates) all of the account’s open long and short positions. A response will be provided for each order that is attempted to be cancelled. If an order is no longer cancelable, the server will respond with status 500 and reject the request.

Parameters

Query Parameters

Attribute Type Requirement Description
cancel_orders boolean
Optional
If true is specified, cancel all open orders before liquidating all positions.

Response

HTTP 207 Multi-Status with body; an array of objects that include the order id and http status code for each status request.

Errors

500
Failed to liquidate.

Close a position

DELETE /v2/positions/{symbol}
Closes (liquidates) the account’s open position for the given symbol. Works for both long and short positions.

Parameters

Path Parameters

Attribute Type Requirement Description
symbol string
Optional
symbol or asset_id

Query Parameters

Attribute Type Requirement Description
qty decimal
Optional
the number of shares to liquidate. Can accept up to 9 decimal points. Cannot work with percentage
percentage decimal
Optional
percentage of position to liquidate. Must be between 0 and 100. Would only sell fractional if position is originally fractional. Can accept up to 9 decimal points. Cannot work with qty

Response

An Order object

Errors

404 Not found
Position is not found.

Position Entity #

Example #

{
  "asset_id": "904837e3-3b76-47ec-b432-046db621571b",
  "symbol": "AAPL ",
  "exchange": "NASDAQ",
  "asset_class": "us_equity",
  "avg_entry_price": "100.0",
  "qty": "5",
  "qty_available": "4",
  "side": "long",
  "market_value": "600.0",
  "cost_basis": "500.0",
  "unrealized_pl": "100.0",
  "unrealized_plpc": "0.20",
  "unrealized_intraday_pl": "10.0",
  "unrealized_intraday_plpc": "0.0084",
  "current_price": "120.0",
  "lastday_price": "119.0",
  "change_today": "0.0084"
}

Properties #

Attribute Type Description
asset_id string<uuid> Asset ID
symbol string Symbol name of the asset
exchange string Exchange name of the asset (ErisX for crypto)
asset_class string Asset class name
avg_entry_price string Average entry price of the position
qty string<int> The number of shares
qty_available string<int> Total number of shares available minus open orders
side string “long”
market_value string<number> Total dollar amount of the position
cost_basis string<number> Total cost basis in dollar
unrealized_pl string<number> Unrealized profit/loss in dollars
unrealized_plpc string<number> Unrealized profit/loss percent (by a factor of 1)
unrealized_intraday_pl string<number> Unrealized profit/loss in dollars for the day
unrealized_intraday_plpc string<number> Unrealized profit/loss percent (by a factor of 1)
current_price string<number> Current asset price per share
lastday_price string<number> Last day’s asset price per share based on the closing value of the last trading day
change_today string<number> Percent change from last day price (by a factor of 1)
Edit Edit this page