Skip to main content

Portfolio API

View account balances, positions, exposure, and trading history.

Endpoints

MethodEndpointDescription
GET /api/sdk/portfolio/balancesGet account balances
GET /api/sdk/portfolio/balances/:assetGet balance for specific asset
GET /api/sdk/portfolio/positionsGet open positions
GET /api/sdk/portfolio/positions/:assetGet position for specific asset
GET /api/sdk/portfolio/exposureGet portfolio exposure
GET /api/sdk/portfolio/exposure/:assetGet exposure for specific asset
GET /api/sdk/portfolio/summaryGet portfolio summary
GET /api/sdk/portfolio/pnlGet P&L breakdown
GET /api/sdk/portfolio/transactionsGet transaction history
GET /api/sdk/portfolio/tradesGet trade history
GET /api/sdk/portfolio/available/:assetGet 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

AttributeTypeDescription
assetstringAsset symbol
totalnumberTotal balance
availablenumberAvailable for trading
lockednumberLocked in open orders
pendingDepositnumberPending deposits
pendingWithdrawalnumberPending withdrawals
usdValuenumberUSD equivalent value

Get Balances

Get account balances for all or specific assets.

GET /api/sdk/portfolio/balances

Required Scope: READ

Query Parameters

ParameterTypeRequiredDescription
assetsstringNoComma-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

ParameterTypeDescription
assetstringAsset 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

ParameterTypeRequiredDescription
assetstringNoFilter 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

AttributeTypeDescription
assetstringAsset symbol
quantitynumberPosition size
sidestringlong or short
averageEntryPricenumberAverage entry price
currentPricenumberCurrent market price
marketValuenumberCurrent market value
costBasisnumberTotal cost of position
unrealizedPnlnumberUnrealized profit/loss
unrealizedPnlPercentnumberUnrealized P&L percentage
realizedPnlnumberRealized profit/loss

Get Asset Position

Get position for a specific asset.

GET /api/sdk/portfolio/positions/:asset

Required Scope: READ

Path Parameters

ParameterTypeDescription
assetstringAsset symbol

Errors

CodeDescription
404No 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

ParameterTypeDescription
assetstringAsset 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

ParameterTypeDefaultDescription
periodstring24hPeriod: 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

ParameterTypeDefaultDescription
assetstring-Filter by asset
typestring-Filter: deposit, withdrawal, trade, fee
pageinteger1Page number
limitinteger50Results 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

ParameterTypeDefaultDescription
assetstring-Filter by asset
sidestring-Filter: buy or sell
startDatestring-ISO 8601 date
endDatestring-ISO 8601 date
pageinteger1Page number
limitinteger50Results 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

ParameterTypeDescription
assetstringAsset 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
}
AttributeTypeDescription
availablenumberAvailable balance
lockednumberLocked in orders
pendingSettlementnumberPending trade settlement
availableForBuynumberMax quantity you can buy (based on USD balance)
availableForSellnumberMax quantity you can sell