Python module:
from scalarlib import venue (alias: from scalarlib import brokerage)Venue Registry
Scalar Field connects to multiple trading venues organized by asset class. You can view portfolios, place trades, and run automated strategies on any active venue.
Each active venue has a dedicated page covering connection, order semantics, and available data functions: Hyperliquid, Polymarket, Jupiter DEX, Robinhood, Alpaca, and Public.com.
Enterprise Plan Connections
Read-only portfolio connections to Interactive Brokers and Fidelity are available on the Enterprise plan. They are linked via Plaid from the Portfolio page — the same place other venues are connected — and provide portfolio and holdings viewing only, with no trade execution.Asset-Class Groups
Venues are organized into compatibility groups by the instruments they trade. Strategies are compatible with any venue in the same group — for example, a US equities strategy can run on Alpaca Paper today and migrate to Alpaca Live, Public.com, or Webull when those venues launch.Connecting a Venue
- Alpaca: OAuth flow — click “Connect” on the Portfolio page, authorize with your Alpaca account, and you are linked immediately.
- Public.com: Click “Connect” on the Portfolio page and authorize with your Public.com account.
- Polymarket: Wallet-based — Scalar Field provisions a managed wallet on Polygon. Fund it with USDC to start trading. No external wallet connection required. Polymarket Paper needs no setup — it is auto-provisioned with virtual USDC on first use.
- Jupiter DEX: Wallet-based — Scalar Field provisions a managed Solana wallet. Fund it with USDC to trade tokenized equities (xStocks) and any verified Solana token.
- Hyperliquid: Wallet-based — fund your Arbitrum wallet with USDC and bridge it to Hyperliquid from the Portfolio page. Hyperliquid Paper needs no setup — it is auto-provisioned with virtual USDC on first use.
- Robinhood: OAuth flow — click “Connect” on the Portfolio page and authorize with your Robinhood account. Trading is limited to equities and ETFs (no options or crypto orders).
Venue Functions Reference
Thevenue module provides functions for account data, positions, balances, trade history, and order placement. These functions are available in chat code execution. For automated strategy agents, use the strategy module instead (see Strategies).
venue.account()
Returns a snapshot of all connected venues with balances, positions, and metadata.
Parameters
Return Schema
Returns{"accounts": [...]} where each account contains fields relevant to its type:
Brokerage accounts (Alpaca):
Exchange accounts (Polymarket):
Wallet accounts (Jupiter DEX / Solana):
Position fields (common across venue types):
venue.positions()
Returns a flat list of all positions across all venues, each tagged with its venue name.
Parameters
Return Schema
Returns a list of position dicts. Each position includes avenue field plus the standard position fields (symbol, qty, avg_price, price, market_value, cost_basis, unrealized_pnl). Polymarket positions additionally include token_id, title, outcome, and slug.
venue.balances()
Returns cash and token balances across venues.
Parameters
Return Schema
Returns a list of balance dicts:Exchange accounts (Polymarket) are skipped — they hold positions, not fungible balances. Polymarket funds live in the
WALLET_POL wallet.venue.history()
Returns unified financial history across all venues — trades, transfers, dividends, and fees — sorted newest first.
Parameters
Return Schema
Returns a list of history dicts:venue.trade()
Places a buy or sell order on a connected venue. Direct execution — no approval workflow.
Parameters
Return Schema
Alpaca orders may return
"PENDING" — the order is submitted but not yet filled. Jupiter and Polymarket orders are synchronous and always block until the fill completes.Important Notes
- Fractional shares: All venues support fractional orders. When computing quantity from a dollar budget, use
round(budget / price, 2)— neverint(), which floors to 0 when the budget is less than one share price. - Dust positions: On Jupiter and Polymarket, selling an entire position may leave a tiny residual quantity due to rounding (e.g. 0.0001 tokens worth 0.10` as effectively closed.
- Settlement delay: After a Jupiter or Polymarket trade, positions and balances may take a moment to reflect the fill due to on-chain settlement. Allow a brief delay before re-querying.