Experimental endpoints

List all account positions

BETA
get
https://api.snaptrade.com/api/v1/accounts/{accountId}/positions/all

Returns a paginated list of all positions in the specified account.

The results list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the instrument.kind discriminator to determine the schema for each position's instrument.

Stock positions may also include cash_equivalent, and may include tax_lots when tax lot data is enabled for the account.

If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see this guide on how to fix a disabled connection.

Execute an API Request

Path
accountIdstring (format: uuid)required

Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.

Query
userIdstringrequired

SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.

userSecretstringrequired

SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.

pageinteger (format: int32)

The page number to return. Defaults to 1.

page_sizeinteger (format: int32)

The number of positions to return per page. Defaults to 100 with a maximum of 1000.

Authorization
Request
Installation
$
npm install snaptrade-typescript-sdk
1
import { Snaptrade } from "snaptrade-typescript-sdk";
2
3
const snaptrade = new Snaptrade({
4
clientId: "PARTNER_CLIENT_ID",
5
consumerKey: "CONSUMER_KEY",
6
});
7
8
const response =
9
await snaptrade.experimentalEndpoints.getAllAccountPositions(
10
{
11
accountId:
12
"917c8734-8470-4a3e-a18f-57c3f2ee6631",
13
userId: "snaptrade-user-123",
14
userSecret:
15
"adf2aa34-8219-40f7-a6b3-60156985cc61",
16
page: 1,
17
pageSize: 100,
18
},
19
);
20
console.log(response.data);

Response fields

object

A paginated list of all account positions.

countinteger

The total number of positions available across all pages.

nextstring (format: uri) or null

The URL for the next page of results, or null if there is no next page.

previousstring (format: uri) or null

The URL for the previous page of results, or null if there is no previous page.

resultsarray of objects

Positions returned for the current page.

1
{
2
"count": 2,
3
"next": "https://api.snaptrade.com/api/v1/accounts/917c8734-8470-4a3e-a18f-57c3f2ee6631/positions/all?page=2",
4
"previous": "http://example.com",
5
"results": [
6
{
7
"instrument": {
8
"kind": "stock",
9
"id": "1ef3a5d3-4a9b-40b2-b8d1-cc35f74d6324",
10
"symbol": "AAPL",
11
"raw_symbol": "AAPL",
12
"description": "Apple Inc.",
13
"currency": "USD",
14
"exchange": "XNAS",
15
"figi_instrument": {
16
"figi_code": "BBG000B9Y5X2",
17
"figi_share_class": "BBG001S5N8V8"
18
}
19
},
20
"units": "10.5",
21
"price": "123.45",
22
"cost_basis": "118.2",
23
"currency": "USD",
24
"cash_equivalent": false,
25
"tax_lots": [
26
{
27
"original_purchase_date": "2022-01-15T10:30:00Z",
28
"quantity": "10",
29
"purchased_price": "100.50",
30
"cost_basis": "1005.00",
31
"current_value": "1200.00",
32
"position_type": "LONG",
33
"lot_id": "12345678"
34
}
35
]
36
}
37
]
38
}