Portfolio API
View account balances, positions, exposure, and trading history.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET /api/sdk/portfolio/balances | Get account balances | |
| GET /api/sdk/portfolio/balances/:asset | Get balance for specific asset | |
| GET /api/sdk/portfolio/positions | Get open positions | |
| GET /api/sdk/portfolio/positions/:asset | Get position for specific asset | |
| GET /api/sdk/portfolio/exposure | Get portfolio exposure | |
| GET /api/sdk/portfolio/exposure/:asset | Get exposure for specific asset | |
| GET /api/sdk/portfolio/summary | Get portfolio summary | |
| GET /api/sdk/portfolio/pnl | Get P&L breakdown | |
| GET /api/sdk/portfolio/transactions | Get transaction history | |
| GET /api/sdk/portfolio/trades | Get trade history | |
| GET /api/sdk/portfolio/available/:asset | Get available balance for trading |
The Balance Object
{
"asset": "BTC",
"total": 10.5,
"available": 8.0,
"locked": 2.5,
"pendingDeposit": 0,
"pendingWithdrawal": 0,
"usdValue": 525000.00
}
Attributes
| Attribute | Type | Description |
|---|---|---|
asset | string | Asset symbol |
total | number | Total balance |
available | number | Available for trading |
locked | number | Locked in open orders |
pendingDeposit | number | Pending deposits |
pendingWithdrawal | number | Pending withdrawals |
usdValue | number | USD equivalent value |
Get Balances
Get account balances for all or specific assets.
GET /api/sdk/portfolio/balances
Required Scope: READ
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
assets | string | No | Comma-separated list of asset symbols |
Example Request
# Get all balances
curl -X GET https://api.zenotc.com/api/sdk/portfolio/balances \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
# Get specific assets
curl -X GET "https://api.zenotc.com/api/sdk/portfolio/balances?assets=BTC,ETH,USD" \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
balances = api_request("GET", "/api/sdk/portfolio/balances")
Response
{
"balances": [
{
"asset": "BTC",
"total": 10.5,
"available": 8.0,
"locked": 2.5,
"usdValue": 525000.00
},
{
"asset": "ETH",
"total": 100.0,
"available": 100.0,
"locked": 0,
"usdValue": 250000.00
},
{
"asset": "USD",
"total": 100000.00,
"available": 75000.00,
"locked": 25000.00,
"usdValue": 100000.00
}
]
}
Get Asset Balance
Get balance for a specific asset.
GET /api/sdk/portfolio/balances/:asset
Required Scope: READ
Path Parameters
| Parameter | Type | Description |
|---|---|---|
asset | string | Asset symbol |
Example Request
curl -X GET https://api.zenotc.com/api/sdk/portfolio/balances/BTC \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
Returns a single Balance object.
Get Positions
Get open positions.
GET /api/sdk/portfolio/positions
Required Scope: READ
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
asset | string | No | Filter by asset symbol |
Example Request
curl -X GET https://api.zenotc.com/api/sdk/portfolio/positions \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
positions = api_request("GET", "/api/sdk/portfolio/positions")
Response
{
"positions": [
{
"asset": "BTC",
"quantity": 5.0,
"side": "long",
"averageEntryPrice": 48000.00,
"currentPrice": 50000.00,
"marketValue": 250000.00,
"costBasis": 240000.00,
"unrealizedPnl": 10000.00,
"unrealizedPnlPercent": 4.17,
"realizedPnl": 5000.00
}
]
}
Position Attributes
| Attribute | Type | Description |
|---|---|---|
asset | string | Asset symbol |
quantity | number | Position size |
side | string | long or short |
averageEntryPrice | number | Average entry price |
currentPrice | number | Current market price |
marketValue | number | Current market value |
costBasis | number | Total cost of position |
unrealizedPnl | number | Unrealized profit/loss |
unrealizedPnlPercent | number | Unrealized P&L percentage |
realizedPnl | number | Realized profit/loss |
Get Asset Position
Get position for a specific asset.
GET /api/sdk/portfolio/positions/:asset
Required Scope: READ
Path Parameters
| Parameter | Type | Description |
|---|---|---|
asset | string | Asset symbol |
Errors
| Code | Description |
|---|---|
| 404 | No position found for asset |
Get Exposure
Get portfolio exposure summary.
GET /api/sdk/portfolio/exposure
Required Scope: READ
Example Request
curl -X GET https://api.zenotc.com/api/sdk/portfolio/exposure \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"totalExposure": 875000.00,
"netExposure": 775000.00,
"longExposure": 775000.00,
"shortExposure": 0,
"cashBalance": 100000.00,
"leverage": 1.0,
"byAsset": [
{
"asset": "BTC",
"exposure": 525000.00,
"weight": 60.0,
"side": "long"
},
{
"asset": "ETH",
"exposure": 250000.00,
"weight": 28.6,
"side": "long"
},
{
"asset": "USD",
"exposure": 100000.00,
"weight": 11.4,
"side": "neutral"
}
]
}
Get Asset Exposure
Get exposure for a specific asset.
GET /api/sdk/portfolio/exposure/:asset
Required Scope: READ
Path Parameters
| Parameter | Type | Description |
|---|---|---|
asset | string | Asset symbol |
Get Portfolio Summary
Get a comprehensive portfolio summary.
GET /api/sdk/portfolio/summary
Required Scope: READ
Example Request
curl -X GET https://api.zenotc.com/api/sdk/portfolio/summary \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"totalValue": 875000.00,
"cashBalance": 100000.00,
"positionsValue": 775000.00,
"totalPnl": 25000.00,
"totalPnlPercent": 2.94,
"dayPnl": 8500.00,
"dayPnlPercent": 0.98,
"unrealizedPnl": 15000.00,
"realizedPnl": 10000.00,
"openPositions": 2,
"openOrders": 5,
"buyingPower": 175000.00
}
Get P&L
Get profit and loss breakdown.
GET /api/sdk/portfolio/pnl
Required Scope: READ
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
period | string | 24h | Period: 1h, 24h, 7d, 30d |
Example Request
curl -X GET "https://api.zenotc.com/api/sdk/portfolio/pnl?period=7d" \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"period": "7d",
"totalPnl": 45000.00,
"totalPnlPercent": 5.43,
"realizedPnl": 30000.00,
"unrealizedPnl": 15000.00,
"fees": 1250.00,
"netPnl": 43750.00,
"byAsset": [
{
"asset": "BTC",
"pnl": 35000.00,
"pnlPercent": 7.29,
"trades": 12
},
{
"asset": "ETH",
"pnl": 10000.00,
"pnlPercent": 4.17,
"trades": 8
}
],
"startValue": 830000.00,
"endValue": 875000.00
}
Get Transactions
Get transaction history (deposits, withdrawals, trades).
GET /api/sdk/portfolio/transactions
Required Scope: READ
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
asset | string | - | Filter by asset |
type | string | - | Filter: deposit, withdrawal, trade, fee |
page | integer | 1 | Page number |
limit | integer | 50 | Results per page (max 100) |
Example Request
curl -X GET "https://api.zenotc.com/api/sdk/portfolio/transactions?type=trade&limit=20" \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"transactions": [
{
"transactionId": "txn_abc123",
"type": "trade",
"asset": "BTC",
"quantity": 0.5,
"price": 50000.00,
"value": 25000.00,
"fee": 12.50,
"feeCurrency": "USD",
"side": "buy",
"orderId": "ord_xyz789",
"timestamp": "2024-01-15T10:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
}
}
Get Trade History
Get detailed trade history.
GET /api/sdk/portfolio/trades
Required Scope: READ
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
asset | string | - | Filter by asset |
side | string | - | Filter: buy or sell |
startDate | string | - | ISO 8601 date |
endDate | string | - | ISO 8601 date |
page | integer | 1 | Page number |
limit | integer | 50 | Results per page (max 100) |
Example Request
curl -X GET "https://api.zenotc.com/api/sdk/portfolio/trades?asset=BTC&startDate=2024-01-01&limit=20" \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"trades": [
{
"tradeId": "trade_abc123",
"orderId": "ord_xyz789",
"asset": "BTC",
"side": "buy",
"quantity": 0.5,
"price": 50000.00,
"value": 25000.00,
"fee": 12.50,
"feeCurrency": "USD",
"timestamp": "2024-01-15T10:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 85,
"totalPages": 5
}
}
Get Available Balance
Get the available balance for trading a specific asset.
GET /api/sdk/portfolio/available/:asset
Required Scope: READ
Path Parameters
| Parameter | Type | Description |
|---|---|---|
asset | string | Asset symbol |
Example Request
curl -X GET https://api.zenotc.com/api/sdk/portfolio/available/BTC \
-H "X-API-Key: your_api_key" \
-H "X-API-Timestamp: 1705312200000" \
-H "X-API-Signature: your_signature"
Response
{
"asset": "BTC",
"available": 8.0,
"locked": 2.5,
"pendingSettlement": 0,
"availableForBuy": 1.5,
"availableForSell": 8.0
}
| Attribute | Type | Description |
|---|---|---|
available | number | Available balance |
locked | number | Locked in orders |
pendingSettlement | number | Pending trade settlement |
availableForBuy | number | Max quantity you can buy (based on USD balance) |
availableForSell | number | Max quantity you can sell |