Portfolio Node
The Portfolio node fetches real-time data from your connected exchange accounts — positions, cash balances, net worth, P&L, trade history, and order history. Use it to give your workflows full visibility into what you currently hold so they can make smarter trading decisions.
Configuration
Portfolio Configuration
Configuration
| Field | Description |
|---|---|
| Exchange | The exchange to pull portfolio data from. Options: Alpaca, Coinbase, Hyperliquid, PaperNick, Trade XYZ. Default: Alpaca. |
| Credential | API credential for the selected exchange. The dropdown filters to credentials matching the exchange type. You must add credentials in Settings > Credentials before they appear here. |
| Data Type | What data to fetch. All Portfolio Data (default) returns everything. Choose a specific type — Positions Only, Cash Balance, Net Worth, Profit & Loss, Trade History, or Order History — to reduce payload size and speed up execution. |
| Description | Optional label to help you identify what this node is for in complex workflows. |
Supported Exchanges
| Exchange | Type | Notes |
|---|---|---|
| Alpaca | Stocks & crypto | Supports paper trading mode. Default exchange. |
| Coinbase | Crypto | Requires API key, secret, and passphrase. |
| Hyperliquid | Crypto perpetuals | Uses wallet public/private keys. Supports sub-accounts via main account address. |
| PaperNick | Simulated | NickAI's built-in paper trading exchange for testing workflows without real funds. |
| Trade XYZ | Crypto | Uses wallet-based authentication similar to Hyperliquid. |
Position Sizing Pattern
The most common use of the Portfolio node is calculating how much to buy based on what you already hold. Connect it alongside a Price Data node into a Function node that computes position size, then route the result to an Exchange Order.
In the Function node, you can access the portfolio data to calculate how much to allocate:
// Allocate 5% of available cash to BTC
const cash = portfolio.cashBalance;
const price = price_data.data.prices[0].current;
const quantity = (cash * 0.05) / price;
return { quantity, price, cash };
Portfolio Monitoring Pattern
Feed portfolio data into an LLM for analysis, then use a Conditional node to act on the results. This is useful for automated rebalancing, risk alerts, or portfolio health checks.
The LLM can analyze your positions for concentration risk, unrealized loss thresholds, or sector imbalances — then the Conditional node routes alerts only when action is needed.
Output
When Data Type is set to All Portfolio Data, the node returns the full structure below. When set to a specific type, only the relevant fields are populated.
Positions
Each entry in the {portfolio.positions} array contains:
| Path | Type | Description |
|---|---|---|
| {portfolio.positions[0].symbol} | string | Trading pair or ticker symbol (e.g., BTC/USD, AAPL) |
| {portfolio.positions[0].amount} | number | Quantity held |
| {portfolio.positions[0].lastPrice} | number | Current market price |
| {portfolio.positions[0].entryPrice} | number | Average entry price |
| {portfolio.positions[0].value} | number | Current market value (amount * lastPrice) |
| {portfolio.positions[0].unrealizedPnL} | number | Unrealized profit or loss in dollars |
| {portfolio.positions[0].unrealizedPnLPercent} | number | Unrealized P&L as a percentage of entry cost |
Balances & Totals
| Path | Type | Description |
|---|---|---|
| {portfolio.cashBalance} | number | Available cash not allocated to positions |
| {portfolio.netWorth} | number | Total portfolio value (positions + cash) |
| {portfolio.pnl} | number | Total profit and loss across all positions |
Trade History
Returned when data type is All or Trade History. Each entry in {portfolio.trades}:
| Path | Type | Description |
|---|---|---|
| {portfolio.trades[0].id} | string | Trade identifier |
| {portfolio.trades[0].symbol} | string | Trading pair |
| {portfolio.trades[0].side} | string | buy or sell |
| {portfolio.trades[0].amount} | number | Quantity traded |
| {portfolio.trades[0].price} | number | Execution price |
| {portfolio.trades[0].timestamp} | date | When the trade executed |
Order History
Returned when data type is All or Order History. Each entry in {portfolio.orders}:
| Path | Type | Description |
|---|---|---|
| {portfolio.orders[0].symbol} | string | Trading pair |
| {portfolio.orders[0].side} | string | buy or sell |
| {portfolio.orders[0].type} | string | market or limit |
| {portfolio.orders[0].amount} | number | Order quantity |
| {portfolio.orders[0].price} | number | Order price |
| {portfolio.orders[0].status} | string | Order status (e.g., filled, canceled, open) |
| {portfolio.orders[0].createdAt} | date | When the order was placed |
Metadata
| Path | Type | Description |
|---|---|---|
| {portfolio.metadata.exchange} | string | Which exchange this data came from |
| {portfolio.metadata.timestamp} | date | When the data was fetched |
| {portfolio.metadata.positionCount} | number | Number of open positions |
| {portfolio.metadata.totalValue} | number | Computed total portfolio value |
| {portfolio.metadata.tradesCount} | number | Number of trades returned |
| {portfolio.metadata.ordersCount} | number | Number of orders returned |
portfolio with your node's edge label. If the edge connecting this node to the next is labeled my_holdings, use {my_holdings.positions} instead.Next Steps
- Exchange Order Node — Place trades based on portfolio analysis.
- Price Data Node — Combine market prices with portfolio data for position sizing.
- Function Node — Write custom logic to calculate allocation, rebalance, or filter positions.
- LLM Node — Feed portfolio data to an AI model for risk analysis and trade recommendations.
- Conditional Node — Route workflow logic based on portfolio thresholds (e.g., P&L limits, position concentration).
- Credentials — Set up exchange API keys to connect your accounts.