Position object
| Field | Description |
|---|---|
id | Unique position identifier |
account_id | Account that holds this position |
symbol | Ticker symbol |
asset_id | Unique asset identifier |
currency | ISO 4217 currency code |
quantity | Number of shares held (can be fractional) |
average_cost_basis | Volume-weighted average purchase price |
total_cost_basis | quantity * average_cost_basis |
current_price | Latest market price |
market_value | quantity * current_price |
unrealized_pl | market_value - total_cost_basis |
unrealized_pl_percent | Unrealized P&L as a percentage |
price_source | Where the price came from (ALPACA, NAYA, DATABASE, UNAVAILABLE) |
price_confidence | Freshness of the price (REAL_TIME, DELAYED, END_OF_DAY, STALE, UNAVAILABLE) |
price_timestamp | When the price was last updated |
last_transaction_at | When the position was last affected by a transaction |
created_at | When the position was created |
updated_at | When the position was last updated |
Querying positions
How positions update
| Event | Effect on position |
|---|---|
| Buy order fills | Creates or increases position; recalculates average_cost_basis |
| Sell order fills | Decreases position; removes if fully sold |
| Market price changes | Updates current_price, market_value, unrealized_pl |
| Stock split | Adjusts quantity and average_cost_basis proportionally |
Key endpoints
| Method | Path | Description |
|---|---|---|
GET | /trading/accounts/{id}/positions | List all positions |
GET | /trading/accounts/{id}/positions/{position_id} | Get position details |