GitHubBlog

Search Documentation

Search for a page in the docs

Trading Setup

You do not need a broker account to use OpenAlice. Research, watchlists, issues, workspace automation, and Inbox all work without trading credentials.

Connect a broker only when you want Alice to prepare orders against a real account model. Start with paper or demo trading. Live trading should come after you have tested the workflow yourself.

The Safe First Path

  1. Open the Web UI's Trading page.
  2. Add an account through the setup wizard.
  3. Pick a paper, demo, or testnet mode.
  4. Let the wizard test the connection before saving.
  5. Ask Alice to stage a small test order.
  6. Review the Trading-as-Git commit.
  7. Approve the push only if the intent looks right.

OpenAlice Trading settings showing the UTA setup entry point

Alice can stage and commit trading intent, but execution still requires your approval in the Web UI. Treat that approval wall as the core safety boundary.

What a Connected Account Gives Alice

Each connected account becomes a Unified Trading Account. Alice sees a consistent account surface instead of a raw broker API:

CapabilityWhat Alice can do
Account stateRead cash, equity, buying power, positions, and open orders where the broker reports them
Contract searchFind tradeable contracts and produce aliceId identifiers
Order stagingPrepare orders inside the Trading-as-Git staging area
Commit historyExplain what changed and why before anything is pushed
Approved pushSend approved operations to the broker
SyncTrack fills, cancellations, rejections, and observed external orders
SnapshotsCapture account state for the equity curve

The broker itself stays behind the UTA boundary. In normal use, you pick the account and contract; Alice does not need to reason about each broker's native API shape.

PresetMarketsBest first modeNotes
alpacaUS stocks and ETFsPaperThe easiest first securities account. Paper and live use separate API keys.
bybitCrypto spot and derivativesDemo Trading or TestnetDemo Trading uses real market data with simulated fills; Testnet is a separate environment.
okxCrypto spot and derivativesDemo TradingRequires demo-specific API keys from OKX's demo console.
binanceCrypto spot and futuresDemo TradingUses Binance's demo simulator. Use demo keys, not live keys.
ibkr-twsStocks, options, futures, FX, bondsPaper TWS / GatewayPowerful but heavier. Requires TWS or IB Gateway running locally.
longbridgeHK, US, CN A-shares via Stock Connect, SG equitiesPaperUses Longbridge OpenAPI credentials. Access tokens expire and must be rotated manually.
mock-simulatorSimulated accountLocal testingNo real broker or money. Useful for UI and workflow testing.

Keyless Data Accounts

OpenAlice also starts with keyless read-only crypto data accounts for Binance, OKX, and Bybit. Those are for public market data only; they cannot place orders and do not appear as portfolio accounts.

Adding an Account

The setup wizard has three steps:

StepWhat happens
PickChoose a preset from the catalog.
ConfigureFill in the fields for that broker and mode. Password-like fields are masked.
Test & saveOpenAlice connects to the broker with those credentials. Save is enabled only after the test passes.

This catches the common setup mistakes before anything is stored: bad keys, wrong region, using live keys against a demo endpoint, or missing broker-specific fields.

Broker credentials are sealed at rest. The account store is encrypted under a machine-bound key, so the setup wizard is the normal way to add or edit accounts. See Data & Credentials.

Broker Notes

Alpaca

Alpaca is the simplest paper-trading path for US equities and ETFs. Create Paper keys in the Alpaca dashboard, choose Paper mode in OpenAlice, and test the connection.

Alpaca is also the first broker where attached take-profit / stop-loss brackets are supported end to end. See Orders & Execution.

Crypto Exchanges

Binance, OKX, Bybit, Bitget, Hyperliquid, and ccxt-custom use the CCXT engine behind their presets. Modes are exchange-specific:

  • Demo, testnet, and live credentials are usually separate.
  • Some exchanges use real market data with simulated fills; others use separate testnet markets.
  • If a requested demo/sandbox mode is not supported by that exchange, OpenAlice refuses the connection instead of silently falling back to live.

Attached TP/SL is refused on CCXT venues until support is verified per exchange. Place the entry first, then place a separate protective stop or take-profit order.

IBKR

IBKR connects through a local TWS or IB Gateway socket. There are no API keys in OpenAlice; you run TWS/Gateway locally and enable socket clients.

Default ports:

ModeTWSIB Gateway
Paper74974002
Live74964001

IBKR is powerful, but it is not the easiest first account. Start with it if you already use TWS/Gateway and understand its account model.

Longbridge

Longbridge supports HK, US, CN A-shares through Stock Connect, and SG equities. It uses appKey, appSecret, and an access token from Longbridge OpenAPI. The access token is time-limited and must be rotated manually.

Contract Identity

Every tradeable contract gets an aliceId:

alpaca-paper|AAPL
bybit-demo|BTC/USDT:USDT
ibkr-live|265598

The left side is the OpenAlice account id. The right side is the broker-native contract key. This makes "AAPL in Alpaca Paper" distinct from "AAPL in IBKR Live", even when the market symbol looks the same.

Alice and the Web UI use aliceId whenever an order needs to target one exact contract.

Contract search runs across your configured accounts:

GET /api/trading/contracts/search?pattern=AAPL&assetClass=equity

The Web UI also shows a Tradeable Contracts card in market analysis panels. Click a result to open the order entry surface for that account and contract.

Some brokers can enumerate their full market catalog. Others, like IBKR, search server-side. For IBKR, search can return expandable directories such as bond issuers, FX families, option chains, or futures months; expand them to concrete contracts before trading.

Multiple Accounts

You can connect multiple accounts at the same time:

[
  { "id": "alpaca-paper", "presetId": "alpaca" },
  { "id": "bybit-demo", "presetId": "bybit" },
  { "id": "ibkr-paper", "presetId": "ibkr-tws" }
]

Each account has its own UTA, operation history, health state, snapshots, and contract namespace. Reading tools can query one account or all enabled accounts.

Runtime Management

The Trading page lets you:

  • add an account
  • edit credentials
  • enable or disable an account
  • reconnect a degraded account
  • open the account detail page
  • place a manual order

The account detail page reads like a small exchange frontend: positions, orders, equity curve, account panel, and manual order entry. It shows only metrics the broker actually reports; missing broker fields are omitted rather than faked.

Safety Checklist

Before using live funds:

  • Run through the full flow on paper or demo first.
  • Confirm the account mode in the Trading page.
  • Use small size.
  • Read the commit before approving push.
  • Check broker-specific caveats for order type and TP/SL support.
  • Keep live and demo API keys separate.

Next Steps