Skip to main content
Execution sits behind one interface. A backtest uses SimulationExchange; live trading swaps in LimeTraderSdkExchange and runs the same strategy file. Lime is the reference adapter — another broker means subclassing the same exchange interface.
Live trading places real orders. It runs from your own terminal or job, never through the local MCP server, which has no order tool by design.

Run

run_live_trading is synchronous: it runs its own event loop on a real-time clock. See examples/run_live_trading.py.

Credentials and account

  • By default the exchange reads Lime Trader SDK credentials from the environment. To use a credentials file, construct LimeTraderSdkExchange(..., lime_sdk_credentials_file=...) and pass it as exchange=.
  • Market data from Lime reads LIME_SDK_CREDENTIALS_FILE.
  • If the credentials give access to several brokerage accounts, set LIME_SDK_ACCOUNT_ID. Automatic selection is refused for safety.

What the adapter does

  • Async throughout.
  • Orders are validated by the broker and rounded down to whole lots (whole shares).
  • Fills are deduplicated from the account’s trades.
  • Capital allocation per strategy: with capital_limit, the strategy sees the account’s positions but trades its allocated capital, not the whole account’s cash.
  • A single-tick clock for scheduled deployments.

Order guards

Opt-in, read from the environment when the exchange is constructed (so a strategy can’t relax them midway). All are unset by default.

Before going live

  • Backtest with next-bar fills and a real commission (--commission-per-share), not the CLI’s zero default.
  • Make sure every TICKER@MIC you trade resolves in your asset database.
  • Start with the guards on and a small capital_limit.