docs

Exchange Order Node

The Exchange Order node executes real trades on your connected exchange account. It supports market, limit, stop, trailing-stop, and bracket orders across multiple exchanges — Alpaca for stocks and crypto, Coinbase for crypto, Hyperliquid and Trade XYZ for perpetuals, OKX for crypto derivatives, and Papernick for paper trading. Every field can be hardcoded or dynamically driven by upstream nodes via the f(x) toggle.

Exchange Order
Alpaca • BTC/USD • USD

Configuration

Exchange & Account
Order

Configuration

Exchange & Account

FieldDescription
ExchangeThe exchange to execute on. Changing the exchange resets all fields to safe defaults to prevent unsupported configurations from being silently carried over.
AccountAPI credentials for the selected exchange. The dropdown filters automatically to credentials that match your chosen exchange.
Asset ClassOptional. Declares the asset type (crypto, stock, etf, fx, futures, perp). Controls symbol format, shorting context, and which features are available. Shown only when the selected exchange supports multiple asset classes (e.g. Alpaca handles both stocks and crypto).
ActionPlace Order executes a new order. Close All Positions closes everything open on the account — no other fields are required.

Order

FieldDescription
SymbolThe trading pair — e.g. BTC/USD, ETH/USDT, or AAPL for stocks on Alpaca. Supports the f(x) toggle for dynamic values. When a credential is selected, a live bid/ask ticker appears below the symbol showing real-time prices updated every second.
SideBuy / Long or Sell / Short. For spot assets (crypto, stock, ETF), selling liquidates an existing holding. For derivatives (perp, futures, FX), selling opens a short. A contextual note appears based on the Asset Class selection.
Order TypeSee Order Types below. Price fields (Limit Price, Stop Price) appear directly under Order Type when relevant.
Sizing ModeControls how the Amount value is interpreted. See Sizing Modes.
AmountThe quantity to trade. The label updates to match Sizing Mode ("Amount (USD)", "Amount (%)", "Risk (USD)"). Supports the f(x) toggle.
Max Position SizeOptional. Caps the resolved amount to this value regardless of sizing mode.
Skip Zero AmountWhen enabled (default), the node returns status: "skipped" if the resolved amount is 0 or invalid instead of failing.

Order Types

The Order Type field determines how and when your order executes. Price fields appear directly under Order Type when a specific type is selected.

TypeDescriptionExtra Fields
MarketExecutes immediately at the best available price.None
LimitWaits until the price reaches your target.Limit Price
StopTriggers a market order when price hits the stop.Stop Price
Stop-LimitTriggers a limit order when price hits the stop.Stop Price + Limit Price
Trailing StopFollows price by a delta percentage; triggers on reversal.Trailing Delta (%)

Unsupported order types for the selected exchange are shown greyed out in the dropdown. Check the Supported Exchanges table for per-exchange capabilities.


Price Fields & Bid/Ask Offset Mode

All price fields — Limit Price, Stop Price, and bracket SL/TP — support two entry modes.

Fixed Mode

Enter a specific price. The current bid, ask, and last prices are shown below the field as reference. If only a last price is available (e.g. some crypto feeds), it is shown as "Last: X" instead of bid/ask.

Offset Mode

Click the ≈ offset button to switch to offset mode. Price is expressed as an expression relative to the live market:

bid - 0.1%     → 0.1% below the current bid
ask + 100      → $100 above the current ask
bid + 0%       → exactly the bid price

The format is (bid|ask)(+|-)(amount)(%?):

  • Reference: bid or ask
  • Operator: + to add, - to subtract
  • Amount: a number — absolute dollars, or a percentage if % is appended

When only a last price is available (no live bid/ask from the exchange), the offset resolves using last and a (last) indicator appears next to the computed result so you know which price was used. Click the button to return to fixed mode.

Offset values resolve at execution time using the live market price — they are not stored as absolute numbers.


Sizing Modes

Sizing Mode controls how the Amount field is interpreted at runtime.

ModeLabelDescription
Raw AmountAmountTrade exactly this quantity of the asset (e.g. 0.01 BTC).
USD NotionalAmount (USD)Enter a dollar value. The node fetches the live price and converts to asset quantity automatically.
Portfolio %Amount (%)Enter a percentage of your total portfolio value (e.g. 5 = 5%). The node fetches your net worth and calculates the quantity.
Risk-BasedRisk (USD)Enter your maximum risk in dollars. Position size = risk ÷ stop-loss distance. Requires a stop order type or a bracket stop-loss to be configured.

Bracket Orders (SL/TP)

Enable Bracket Orders (SL/TP) to attach a stop-loss and take-profit to your order simultaneously.

The node uses native bracket support on exchanges that offer it (Alpaca, Coinbase, OKX) and falls back to attached TP/SL orders on others (Hyperliquid, Trade XYZ). Papernick does not support bracket orders.

Bracket Leg Configuration

Each leg (stop-loss and take-profit) has:

FieldDescription
Typemarket — leg executes as a market order when triggered. limit — leg executes as a limit order; requires Limit Price.
Trigger Modepercentage (default) — value is % from entry price. absolute — value is a fixed price.
ValueThe stop-loss or take-profit level. In percentage mode: 2 = 2% from fill price.
Limit PriceOnly for limit type legs. Supports fixed values and bid/ask offset expressions.

Supported Expressions

Bracket values support:

  • Fixed price (e.g. 48000)
  • Percentage from entry (e.g. 2 in percentage mode = 2% SL)
  • Bid/ask offset expressions (bid - 2%)
  • Dynamic f(x) expressions ({edge.stopLevel})

Bracket orders are automatically disabled when Reduce-Only is active, since reducing a position doesn't support brackets.


Time-in-Force (TIF)

Time-in-Force controls how long an order remains active if not immediately filled.

TIFDescription
GTCGood Till Cancelled — stays open until filled or manually cancelled.
IOCImmediate or Cancel — fills whatever is available instantly, cancels the rest.
FOKFill or Kill — must fill completely in one shot, or the entire order is cancelled.
DAYExpires at end of the trading day.

Unsupported TIF options for the selected exchange are shown greyed out. See the Supported Exchanges table for per-exchange availability.


Advanced Options

Open the Advanced Options section for execution control fields.

FieldDescription
Time-in-ForceHow long the order stays open. Greyed options are unsupported by the selected exchange.
Post-OnlyGuarantees maker execution — the order is rejected if it would take liquidity. Supported on Coinbase, Hyperliquid, Trade XYZ, OKX.
Reduce-OnlyOnly reduces an existing position; never increases it. Used to safely close perp/futures positions without accidentally opening a new one. Supported on Hyperliquid, Trade XYZ, OKX.
LeverageSet the leverage multiplier for supported exchanges (Hyperliquid, Trade XYZ, OKX). Enter an integer — e.g. 5 for 5× leverage.
Margin ModeCross (shared margin pool) or Isolated (per-position margin). Supported on OKX (both) and Trade XYZ (isolated only).

Fields unsupported by the selected exchange are shown with a tooltip explaining why they are disabled.


TWAP & VWAP Execution

Open the Execution & Metadata section to enable algorithmic execution strategies.

TWAP (Time-Weighted Average Price)

TWAP splits your order into equal slices executed at regular intervals, reducing market impact for large orders.

FieldDescription
Enable TWAPToggle to activate TWAP mode.
SlicesNumber of equal sub-orders (2–100).
Interval (ms)Time between slices in milliseconds (1,000–300,000).

Example: Amount = 1 BTC, Slices = 5, Interval = 60,000 ms → places 0.2 BTC every 60 seconds over 5 minutes.

TWAP is supported on Alpaca, Coinbase, Hyperliquid, Trade XYZ, and OKX. Not available on Papernick.

VWAP (Volume-Weighted Average Price)

Enable VWAP to target the volume-weighted average price over the execution window. VWAP is supported on Alpaca and OKX via their native algo order endpoints.


Execution & Metadata

FieldDescription
Order TagA string label attached to the order for audit trail filtering and grouping. Useful for identifying orders from specific workflows or strategies.
Order PrioritySort priority for the Order Sequencer node (lower number = executes first).
DescriptionHuman-readable notes about this trade — stored in the audit trail but not sent to the exchange.

Supported Exchanges

ExchangeAsset ClassesOrder TypesTIFBracketsLeverageTWAP/VWAP
Alpacacrypto, stock, etfmarket, limit, stop, stop_limit, trailing_stopgtc, ioc, fok, dayNativeCrossBoth
Coinbasecryptomarket, limit, stop, stop_limitgtc, ioc, fokNativeNoTWAP
Hyperliquidcrypto, perpmarket, limit, stop, stop_limitgtc, iocAttachedCrossTWAP
Trade XYZperpmarket, limit, stop, stop_limitgtc, iocAttachedIsolatedTWAP
OKXcrypto, futures, perpmarket, limit, stop, stop_limit, trailing_stopgtc, ioc, fokNativeCross + IsolatedBoth
Papernickcrypto, stock, etfmarket, limitgtc, ioc, fok, dayNoNoNo

Native brackets — the exchange handles SL/TP atomically with the entry order.
Attached brackets — NickAI places separate TP/SL orders immediately after the entry fills.


Symbol Normalization

Common symbol variations are normalized automatically:

  • BTCBTC/USD
  • BTCUSDBTC/USD
  • ETHETH/USD

This works for all major crypto symbols. For stocks on Alpaca, use the standard ticker (e.g. AAPL, TSLA). For OKX perpetuals, use the swap format: BTC-USDT-SWAP. For Hyperliquid and Trade XYZ perps, use the base currency only: BTC, ETH.


Asset Classes & Shorting

Asset Class Field

The Asset Class field declares what type of instrument you are trading. It is optional but affects symbol format, available order types, and contextual notes in the UI.

Asset ClassDescriptionTypical Exchanges
cryptoSpot cryptocurrencyAlpaca, Coinbase, OKX, Papernick
stockUS equityAlpaca, Papernick
etfExchange-traded fundAlpaca, Papernick
perpPerpetual futures (no expiry)Hyperliquid, Trade XYZ, OKX
futuresDated futures contractOKX
fxForeign exchangeFuture support

Sell Behavior by Asset Class

Asset ClassSell Behavior
crypto, stock, etfSells existing holdings. Shorting requires margin and exchange support — most spot accounts do not allow it.
perp, futures, fxOpens a short position. Use Reduce-Only to safely close a short without accidentally opening a new one.

The properties panel shows a contextual note when you select Sell / Short based on your Asset Class choice.


Workflow Examples

AI-Driven Trading

BTC Price
CoinGecko
Market Analyst
Claude Sonnet 4.6
Buy Signal?
signal = buy
Buy BTC
Alpaca
No Signal Alert

USD Notional Sizing

Set Sizing Mode to USD Notional to trade a fixed dollar amount instead of a fixed quantity. The node converts automatically using the live price.

Sizing Mode:  USD Notional
Amount (USD): 500

At execution, if BTC is at $50,000, the node buys 500 / 50000 = 0.01 BTC.

Limit Order with Bid Offset

Use offset mode to set a limit order 0.1% below the current bid:

Order Type:   Limit
Limit Price:  bid - 0.1%    (offset mode)

This places a passive buy slightly below market without hardcoding a price.

Bracket Order with Percentage SL/TP

Bracket Orders:  enabled
Stop-Loss:       2      (2% below entry, percentage mode)
Take-Profit:     5      (5% above entry, percentage mode)

The exchange attaches a stop-loss 2% below fill price and a take-profit 5% above simultaneously. On Hyperliquid and Trade XYZ, these are placed as separate orders immediately after the entry fills.

Risk-Based Position Sizing

Order Type:   Stop-Limit
Stop Price:   48,000
Sizing Mode:  Risk-Based
Risk (USD):   200

If BTC is at $50,000 and the stop is at $48,000, the stop-loss distance is $2,000. The node sizes the position as 200 / 2000 = 0.1 BTC — risking exactly $200 on the trade.

TWAP for Large Orders

Sizing Mode:    USD Notional
Amount (USD):   50,000
Enable TWAP:    true
Slices:         10
Interval (ms):  30,000

Places 10 orders of $5,000 each every 30 seconds, spreading $50,000 over 5 minutes to minimize slippage.

Multi-Asset Rebalancing

Rebalance Calc
JavaScript
Buy BTC
Alpaca
Sell ETH
Alpaca
Buy SOL
Alpaca

Each Exchange Order node reads its own edge for side, symbol, and amount — {btc_order.side}, {eth_order.amount} — so one Function node drives multiple trades with different parameters.


Pricing

The Exchange Order node is free — 0 credits per execution. Trades execute on your exchange using your own funds and are subject to your exchange's own fees. NickAI charges nothing on top.


Output

After the order executes, the node outputs a structured result object.

PathDescription
{label.order.id}Exchange order ID.
{label.order.symbol}Normalized trading symbol (e.g. BTC/USD).
{label.order.side}buy or sell.
{label.order.type}market, limit, etc.
{label.order.requestedAmount}The resolved amount sent to the exchange.
{label.order.filledAmount}The actual filled quantity.
{label.order.avgFillPrice}Average fill price.
{label.order.fees}Fees paid on the trade.
{label.order.slippage}Slippage from expected price.
{label.order.executionLatencyMs}Round-trip latency in milliseconds.
{label.order.bracketOrderIds}SL/TP order IDs when brackets are enabled.
{label.order.status}filled, submitted, skipped, closed_all, etc.
{label.skipped}true if the order was skipped (zero amount with Skip Zero Amount enabled).
{label.skipReason}Why the order was skipped.
{label.audit}Execution audit trail: exchange, action, orderType, sizingMode, resolvedAmount, timestamp.

Error Handling

ErrorCause
"Symbol is required"Symbol field is empty or expression resolved to nothing.
"Side must be either 'buy' or 'sell'"Side resolved to an unexpected value.
"Amount must be a positive number"Amount is 0, negative, or NaN after resolution.
"Limit price is required…"Limit order selected but no limit price provided.
"Risk-based sizing requires a stop-loss distance"Risk-based mode needs a stop price to calculate position size.
"Credential not found"Selected credential was deleted or doesn't belong to your account.
"Invalid credential type"Credential type doesn't match the selected exchange.

Next Steps

  • Function Node — Calculate position sizes, convert dollar amounts, prepare dynamic order parameters.
  • Conditional Node — Gate trades on signals, thresholds, or risk checks.
  • Price Data Node — Fetch live market prices to feed into trading logic.
  • Portfolio Node — Check positions and balances before placing orders.