docs

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.

My Portfolio
Alpaca

Configuration

Portfolio Configuration

Configuration

FieldDescription
ExchangeThe exchange to pull portfolio data from. Options: Alpaca, Coinbase, Hyperliquid, PaperNick, Trade XYZ. Default: Alpaca.
CredentialAPI 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 TypeWhat 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.
DescriptionOptional label to help you identify what this node is for in complex workflows.

Supported Exchanges

ExchangeTypeNotes
AlpacaStocks & cryptoSupports paper trading mode. Default exchange.
CoinbaseCryptoRequires API key, secret, and passphrase.
HyperliquidCrypto perpetualsUses wallet public/private keys. Supports sub-accounts via main account address.
PaperNickSimulatedNickAI's built-in paper trading exchange for testing workflows without real funds.
Trade XYZCryptoUses 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.

My Portfolio
Alpaca
BTC Price
BTC/USD
Position Sizer
Calculate qty
Buy BTC
Market 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.

Portfolio
Alpaca
Risk Analyzer
Claude Sonnet 4.6
High Risk?
risk = high
Alert Email
Risk warning

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:

PathTypeDescription
{portfolio.positions[0].symbol}stringTrading pair or ticker symbol (e.g., BTC/USD, AAPL)
{portfolio.positions[0].amount}numberQuantity held
{portfolio.positions[0].lastPrice}numberCurrent market price
{portfolio.positions[0].entryPrice}numberAverage entry price
{portfolio.positions[0].value}numberCurrent market value (amount * lastPrice)
{portfolio.positions[0].unrealizedPnL}numberUnrealized profit or loss in dollars
{portfolio.positions[0].unrealizedPnLPercent}numberUnrealized P&L as a percentage of entry cost

Balances & Totals

PathTypeDescription
{portfolio.cashBalance}numberAvailable cash not allocated to positions
{portfolio.netWorth}numberTotal portfolio value (positions + cash)
{portfolio.pnl}numberTotal profit and loss across all positions

Trade History

Returned when data type is All or Trade History. Each entry in {portfolio.trades}:

PathTypeDescription
{portfolio.trades[0].id}stringTrade identifier
{portfolio.trades[0].symbol}stringTrading pair
{portfolio.trades[0].side}stringbuy or sell
{portfolio.trades[0].amount}numberQuantity traded
{portfolio.trades[0].price}numberExecution price
{portfolio.trades[0].timestamp}dateWhen the trade executed

Order History

Returned when data type is All or Order History. Each entry in {portfolio.orders}:

PathTypeDescription
{portfolio.orders[0].symbol}stringTrading pair
{portfolio.orders[0].side}stringbuy or sell
{portfolio.orders[0].type}stringmarket or limit
{portfolio.orders[0].amount}numberOrder quantity
{portfolio.orders[0].price}numberOrder price
{portfolio.orders[0].status}stringOrder status (e.g., filled, canceled, open)
{portfolio.orders[0].createdAt}dateWhen the order was placed

Metadata

PathTypeDescription
{portfolio.metadata.exchange}stringWhich exchange this data came from
{portfolio.metadata.timestamp}dateWhen the data was fetched
{portfolio.metadata.positionCount}numberNumber of open positions
{portfolio.metadata.totalValue}numberComputed total portfolio value
{portfolio.metadata.tradesCount}numberNumber of trades returned
{portfolio.metadata.ordersCount}numberNumber of orders returned

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.