Skip to content

Broker accounts ​

A broker account is a read-only key to the place you actually trade. It answers three questions nobody should be retyping by hand: what did I fill, what am I holding, what do I have working.

Manage them in Settings → Brokers, or from the Brokers button any module that reads your book puts next to its account picker. Both render the same screen.

Read only, unless you switch trading on

Broker accounts read, and only read, until you turn Trading on for one. The credentials asked for here are the read-only kind, so give exactly that: where a broker can issue a view-only key, the form says so. Interactive Brokers (Gateway), every crypto exchange listed below and the app's own Paper trading account take orders, each behind its own switch and, paper aside, its own password prompt; the permissions in the table are for reading, and trading needs a key that can place orders. Alpaca, OANDA, TradeStation, FOREX.com, Capital.com, NinjaTrader and Interactive Brokers (Flex) only read. See Trading from the chart for the list and each broker's key, and Paper trading.

Not to be confused with data connectors: those read prices, these read your account. Two different credentials, two different lists, two different grants, on purpose.

What you need to connect ​

BrokerCredentialsPermission to grantReads
Alpacaapi_key, api_secretTrading API key of the environment you pick (live or paper, they are separate keys)fills, positions, orders, holdings
Binanceapi_key, api_secretEnable Reading, plus Enable Spot & Margin Trading only if trading is on. No withdrawalsfills, orders, holdings
Binance USDⓈ-M Futuresapi_key, api_secretEnable Reading, plus Enable Futures only if trading is on. No withdrawalsfills, positions, orders, margin balances
Bitfinexapi_key, api_secretRead on Account, Wallets, Orders, Positions and History. No write, no withdrawalfills, positions, orders, holdings
Bitgetapi_key, api_secret, api_passphraseRead-only. No trade, no withdrawfills, positions, orders, holdings
Bybitapi_key, api_secretRead-Only key of a unified trading account, HMAC or RSA. No trade, no withdrawfills, positions, orders, holdings
Bybit EUapi_key, api_secretRead-Only key created on bybit.eu, HMAC or RSA. No trade, no withdrawfills, orders, holdings
Deribitapi_key (Client Id), api_secret (Client Secret)Scopes account:read and trade:read only. No trading, no withdrawalfills, positions, orders, holdings
Gate.ioapi_key, api_secretAPI v4 key, read-only on Spot and Perpetual Futures. No read-write, no withdrawfills, positions, orders, holdings
KuCoinapi_key, api_secret, api_passphraseGeneral permission only. No Spot, Margin, Futures or Withdrawalfills, orders, holdings
KuCoin Futuresapi_key, api_secret, api_passphraseGeneral permission only. No Futures, no Withdrawalfills, positions, orders
MEXCapi_key, api_secretSpot Account and Order read, futures Order and Position read. No trading, no withdrawalfills, positions, orders, holdings
OKXapi_key, api_secret, api_passphraseRead only. No trade, no withdrawfills, positions, orders, holdings
OANDAapi_token + the account idA personal access token. OANDA has no read-only token: the same one can tradefills, positions, orders, holdings
Coinbase Advanced Tradeapi_private_key + the full key nameCDP key, View only, created as Ed25519. No Trade, no Transferfills, orders, holdings
TradeStationclient_id, client_secret, refresh_token + the account idOAuth sign-in granting ReadAccount, MarketData, openid, offline_access. Not Tradefills, positions, orders, holdings
FOREX.com (StoneX)username, password, app_keyYour login plus the AppKey StoneX issues. No read-only credential existsfills, positions, orders, holdings
Capital.comapi_key, identifier, api_passwordAn API key (two-factor must be on) and its custom password. No read-only gradefills, positions, orders, holdings
NinjaTraderusername, password, cid, secPlatform login plus the developer API key pair. No read-only keyfills, positions, orders, holdings
Krakenapi_key, api_secretQuery Ledger & Trade History, and Query Open Ordersfills, orders, holdings
Kraken Futuresapi_key, api_secretA key made on the futures site, General API: Read Only, Withdrawal API: No Accessfills, positions, orders, holdings
Interactive Brokers (Flex)flex_token + a Flex query idFlex Web Service token: it reads statements, it cannot tradefills, positions, holdings
Interactive Brokers (Gateway)none (Gateway host and port)IB Gateway or TWS signed in, Enable ActiveX and Socket Clients ticked. Leave Read-Only API ticked unless trading is onpositions, orders, the last 7 days of fills
Paper tradingnoneNone: it runs inside the app, see Paper tradingfills, positions, orders

Secrets are write-only: the app only ever knows which names are set. They can be typed in, or plugged from the Vault so one key serves several accounts.

Per-broker notes ​

  • Alpaca: the Environment setting is live or paper, and has to be said rather than guessed, since the two live on different hosts with different keys. Alpaca reports no commission on a fill, so imported trades carry no fees: correct for commission-free equities, short of the truth for crypto and options, whose fees arrive as separate account activities.
  • Binance, spot and futures alike, answers its trade history one instrument at a time, so a pull has to name the instruments (BTCUSDT, ETHEUR). KuCoin spot does the same (BTC-USDT), and so does MEXC on both books. Every other broker here answers the whole account.
  • Three crypto venues stop at 90 days. Bitget, OKX and Binance futures serve three months of fills over the API and no more; anything older is a download from their web site. The import modal shows the limit and refuses a period that starts before it, rather than returning a quiet half-answer.
  • Bybit serves two years of fills, a week per call. Its Books to read setting (spot, linear, inverse, option, all by default) works like Bitget's: a book you do not trade is worth turning off. Its Site setting names the site that issued the key (global, or a regional one: tr, kz, ae, jp, hk…, or testnet), since a key works on that site only. A self-generated (RSA) key works too: paste its private key in PEM as the secret. Test connection says whether the key could trade, and refuses a classic account, which Bybit no longer serves.
  • Bybit inverse fills are not imported. An inverse contract (BTCUSD) is counted in USD and pays its profit in the coin, quantity × (1/entry − 1/exit), which the journal does not compute. Its positions and orders are read, converted to coins. Option fills are imported, as options.
  • Bybit EU is its own broker. bybit.eu is a separate platform from bybit.com, with its own spot book and its own keys.
  • Gate.io reads two books with one key, chosen by Books to read (spot, futures, both by default): spot, and the USDT-settled perpetuals, whose fills come in contracts valued by the contract size Gate.io publishes. A unified account's balances are read from the unified account. Gate.io names no key's permissions over the API, so Test connection cannot tell a read-only key from one that could trade. BTC-settled and dated futures, margin and stop orders are not read.
  • KuCoin is two brokers. Spot and futures are separate platforms, read with the same key: KuCoin for spot, KuCoin Futures for the USDT- and USDC-margined contracts (coin-margined ones are not read). Spot fills are answered one pair at a time, so a pull names the pairs (BTC-USDT); futures fills come for the whole account, counted in contracts and valued by the contract size KuCoin publishes. Test connection says whether the key could trade. A margin account is not read.
  • MEXC reads two books with one key, chosen by Books to read (spot, futures, both by default): spot, and the perpetuals settled in USDT, USDC or USD1, whose fills come in contracts valued by the contract size MEXC publishes. Both answer their trade history one instrument at a time: name spot pairs as BTCUSDT and contracts as BTC_USDT, and each book reads the names written its way. MEXC serves 30 days of spot fills over the API; anything older is an export from its web site. A key not bound to an IP address expires after 90 days. Coin-settled futures and stop orders are not read.
  • Bitfinex reads the whole account with one key: the exchange, margin and funding wallets, spot pairs and perpetuals alike, and every fill in one list, with no instrument to name and no history limit. Give OpenTraderWorld a key of its own: Bitfinex refuses a key that another program has used with a larger nonce. Instruments keep Bitfinex's spelling (tBTCUSD, tBTCF0:USTF0) and currencies its codes (UST is USDt).
  • Deribit reads every kind with one key and keeps fills for good: options, USDC-settled futures and spot are imported, by currency rather than by instrument, so nothing has to be named. Inverse fills are not imported (BTC-PERPETUAL, BTC-27DEC26), for the same reason as on Bybit; their positions and orders are read, converted to coins.
  • Kraken Futures is its own broker. It is a separate platform from Kraken spot, with its own keys, made on the futures site. Its Environment setting is live or demo: the demo (demo-futures.kraken.com) is another host with its own sign-up and keys, and a demo account never reads live. Multi-collateral contracts (PF_XBTUSD, FF_XBTUSD_261225) are read in coins. Inverse contracts (PI_, FI_) show as positions and orders converted to coins at their price; their fills are not imported, for the same reason as on Bybit. The fee of a fill is read without its currency, which the API does not state. Fills come for the whole account, 1000 a page; past 100 pages the history API makes the walk wait about 6 seconds a page.
  • A derivatives account is not a spot one. Bitfinex, Bitget, Bybit, Deribit, Gate.io, Kraken Futures, KuCoin Futures, MEXC, OKX and Binance futures can be short, so This account can go short is ticked by default there. On a Bitget or Bybit account set to the spot book only, untick it: a spot sale with nothing open is the sale of a coin bought earlier, not a short.
  • A contract is counted in contracts. OKX reports derivative fills in contracts and publishes what one is worth (ctVal × ctMult), which is read from its instrument list and carried as the trade's point value. Bitget USDT-M, Bybit linear and Binance USDⓈ-M contracts are sized in the base coin, so theirs is one. Coin-M (inverse) fills are not imported anywhere: they are sized in quote currency and their PnL is not a quantity times a price. Bybit's inverse positions and orders are read, converted to coins.
  • TradeStation is the only OAuth one. There is no static key: a one-time browser sign-in produces a refresh token, which the app exchanges for a 20-minute access token as it goes. Grant ReadAccount, MarketData, openid and offline_access at that sign-in and leave Trade out; a token that could trade would be a standing risk for nothing. TradeStation serves 90 days of closed orders; anything older is a statement from its own site. A fill here is an order leg, since TradeStation publishes closed orders rather than executions, and the identity a re-sync deduplicates on is the order id plus the leg's place in it.
  • FOREX.com signs in, it does not use a key. The credentials are the account's own username and password plus the AppKey StoneX issues once its API terms are signed, so the same login can trade: treat it as a full-access secret and change the password when you remove the account. A trade imported from there carries no commission, because StoneX bills the spread; if your account is charged commission instead, the numbers here will be short of the truth. The trade-history endpoint takes no end date and no cursor, so a wide period is walked forward in pages of 200.
  • Capital.com answers one day at a time. Its activity log caps the range between two dates at 24 hours, so a year of trading costs a call per day; periods wider than 400 days are refused by name rather than left to run into the rate limiter. Every instrument on the platform is a CFD, so a share CFD is filed as a derivative and not as the share, which is what a tax form wants. A deal id names a position rather than a fill, so the identity a re-sync deduplicates on is the deal, its timestamp and its direction together.
  • NinjaTrader allows two sessions per login, and a third closes the oldest: this connector holds one, and a trading application signed in beside it holds the other. Its trading API is the Tradovate platform it acquired, which is why the errors say tradovateapi. It answers the fills its session can see and publishes no depth limit, so check the oldest row the first pull returns before relying on it for a tax year. A futures point value is read from the contract's product, never assumed from the root.
  • OANDA gives no read-only token. The personal access token that reads this account can also trade it, so the form says so: treat it as a full-access credential and revoke it when you remove the account. Nothing in the app ever uses it to write.
  • Interactive Brokers is two brokers, neither with an API key. Interactive Brokers (Flex) reads a saved report through the Flex Web Service: setup, the period rule and the time-zone setting have their own section below. Interactive Brokers (Gateway) connects to the IB Gateway or TWS you run, reads positions, working orders and the last 7 days of fills live, and can trade from the chart. Journal imports still come from Flex.
  • Rate limits are the broker's, and each row shows the one that applies. IBKR is the strict one: it builds the statement on demand and refuses a second request while one is still generating.

Connect one ​

  1. Add account, pick the broker, and name it: the name is what module pickers show, so Kraken main beats Kraken 2.
  2. Fill the credentials, or pick them from the Vault. An account missing one is shown as incomplete and skipped by every module until you set it.
  3. Fill the non-secret settings the broker needs: an environment (Alpaca, Binance, Binance futures, OKX, OANDA, TradeStation, Capital.com, NinjaTrader, Kraken Futures, Deribit live or test), an account id (OANDA, TradeStation, Capital.com, FOREX.com, NinjaTrader), the OKX region (global, eea or us), Bitget's Demo trading, the Coinbase key name, the IBKR Flex query id and time zone, the IB Gateway host and port, the Bybit, Bybit EU or Gate.io site (Gate.io: live or testnet), or the books to read (Bitget, Bybit, Gate.io, MEXC).
  4. Choose the modules it serves, or all modules.
  5. Test connection reaches the broker and reports what answered: the account number and status, how many assets carry a balance, or which statement the Flex token returned. If something is wrong, the error names the setting to change.

Grants are enforced server-side: a module asking for an account it was never given is refused.

Background trading ​

An order nobody is watching leave, from a trade on alert or a trading bot, needs a permission of its own on the account: Background trading, in Settings → Brokers on an account with trading on.

  • Sign background trading opens the terms and a list of statements. Tick every one, type the account name, then Sign. When the trading lock is on and the account is not paper, the authenticator code is asked too.
  • What you signed is kept with its date, the environment (paper, sandbox or live), the language and whether a code was verified, under Signatures.
  • It is signed once per account, by you: an AI agent or an Automator workflow cannot sign it.
  • Turn off background trading asks nothing and disarms everything armed on the account. Turning it on again asks for a new signature.

What it lets you do ​

Several destinations, one shape. Whatever you import and wherever it lands, a broker import runs on the same two rails as a file import:

  1. Pull, then look. The app asks the broker, folds the answer into what the module stores (positions for the journal, a balance sheet for the portfolio, closed disposals for the tax form) and shows it to you. Nothing is written at this step, so a pull you do not like costs nothing.
  2. Commit, and keep the thread. Everything written carries the id of that import, so it stays one object afterwards: Revert deletes exactly what it created and nothing else, Keep, untrack cuts the link and leaves the rows in place. Both live in the import history of the module.

Duplicates are the rail's job, not yours. Each imported row is fingerprinted, so pulling an overlapping period again recognises what is already filed, marks it in the preview and writes it once.

Import trades into the journal ​

Journal → Import → Pull from a broker. Pick the account, the period and the book to file into, and the fills come back folded into positions, previewed before anything is written.

  1. The account. Only the ones granted to the journal are listed, and an incomplete one says so. The last account and period used for a book are remembered, so the next pull is two clicks.
  2. The period, by date or with the 7 / 30 / 90 / 365 days chips. Read it as the window the fills fall in, not the window the trades closed in: a position is folded from the fills inside the period, so start early enough to catch the entry.
  3. The instruments. Binance, KuCoin spot and MEXC answer their history one instrument at a time, so the symbols are required there and Suggest offers what the account holds. Everywhere else the field is a filter: leave it empty for the whole account.
  4. Shorts. A spot account cannot be short, so a sell with nothing open is reported as a row error naming the fix (widen the period) rather than turned into a phantom short. On a margin account, tick This account can go short.
  5. Preview, then import. The counters are fills, trades, of which closed and open, plus what is already in the book and what could not be built. Each line says which it is before you commit.
  • Same destination and same folding as a file import, minus the mapping: an API answers typed fields, so the questions a CSV raises (which column is the date, is the decimal a comma) do not exist here.
  • Re-running is safe. A position's identity is its opening fill, so widening the window and pulling again refreshes what has closed since and leaves the rest alone, instead of filing the same trade twice.
  • A refresh is mechanical only. Prices, quantities, fees and dates come from the broker again; your notes, tags, strategy and template fields are yours and survive it.

Align a portfolio on what the account holds ​

Portfolio → From a broker. It reads a balance sheet, not a trade history: the difference against your ledger is shown line by line, and you choose which lines to align. Each one you accept writes the single operation that makes the portfolio agree.

  • A symbol the portfolio already holds resolves itself; anything else is asked, because "BTC" on an exchange is a string and an asset here is a price source.
  • Cost basis is never invented. Interactive Brokers publishes one and it is used. The crypto exchanges publish a quantity and nothing else, so those lines say so and default to today's price, the one price nobody can mistake for a claim about the past.
  • Take the price from the exchange. On a line with no cost basis, one click asks the venue what the asset trades at right now and fills the price in. The line then names the market that answered (BTCUSDT, XBT/USD), and says so when that market prices in something other than the asset's own currency: a Binance price is in USDT, not in dollars. An asset the venue does not price is left alone rather than valued from somewhere else, and you type the price yourself.

Alpaca, Binance (spot and futures), Bitfinex, Bitget, Bybit, Bybit EU, Coinbase, Deribit, Gate.io, Kraken, KuCoin, MEXC, OKX, OANDA and TradeStation answer that question. Interactive Brokers Flex does not: a statement is not a quote feed, FOREX.com prices a market by its numeric id rather than by the name a portfolio line carries, and NinjaTrader serves prices through a separate market-data entitlement. Interactive Brokers (Gateway), KuCoin Futures, Kraken Futures and paper accounts do not answer it either. Capital.com answers with the mid of the two sides it deals on.

Draw your book on the chart ​

Chart → Broker book. Sync an account and its positions and working orders are drawn as price levels on the chart of the matching instrument, average cost for a position, limit and stop for an order. Matching is on the ticker, punctuation aside. A position with no average cost gets no line and is counted as such.

With Entry and exit markers on (Chart settings → Trading), the account's fills on the instrument are drawn as markers at their price and bar, over the last 30 days at most and as far back as the broker serves fills.

Count an account in your net worth ​

MyWealth → Link a portfolio or a broker account → Broker account. An account granted to MyWealth becomes an asset valued at its equity as the broker states it, read at most once an hour. See MyWealth.

Read a tax year ​

Taxes → From a broker. Pulls the fills, folds them into closed positions and totals what was realized inside the tax year, split across the capital, derivative and crypto lines of the form. It writes nothing: you apply the numbers to the form, and save the scenario yourself.

  • The window is not the tax year. What you sold in March was bought earlier, and without that purchase there is no cost basis: move the start date back far enough to cover it. A disposal whose purchase is missing is reported, never valued against nothing.
  • Each closed position is converted at the rate of its own exit date. One that has no rate is listed and left out of the totals rather than added in the wrong money.

Interactive Brokers: the Flex Web Service ​

The Interactive Brokers (Flex) broker is read through Flex, the report service of Account Management: you save a query describing what you want in a statement, and the app fetches that statement over HTTPS with a token.

Why Flex and not TWS ​

The market-data connector and the Interactive Brokers (Gateway) broker speak the TWS socket to a Gateway you run yourself. That socket is the right tool for the present, and the wrong one for history: it answers open positions, working orders and the fills of the last 7 days, so import my trades for March has no socket form at all. Flex serves a period, which is exactly the question an import asks.

The practical difference:

Flex Web ServiceTWS / IB Gateway socket
What you runnothing, it is an HTTPS callGateway or TWS, logged in, on the machine
Historythe query's period, up to a year backthe last 7 days of fills
Credentiala token that reads reportsyour live session, able to trade
Used here forjournal import, portfolio holdings, tax year, chart positionsprices, charts, live bars, positions, working orders, fill markers, orders from the chart

Why it is the safe way in ​

  • The token cannot trade. It is issued for the Flex Web Service and that service serves statements. There is no order endpoint behind it to forget to disable, no permission checkbox to get wrong. Compare that with an exchange API key, where read-only is a box you have to remember to tick.
  • Nothing is left listening. No Gateway running, no API port open, no Trusted IP to declare, nothing waiting on your machine while the app is idle.
  • It expires on its own. IBKR gives a token a lifetime and mails a reminder before it lapses. A forgotten token stops working instead of staying valid forever.
  • The query is the fence. A token can only return what the queries you saved describe. Keep the query to trades and open positions and that is all the app can ever see, whatever it asks for.
  • Like every credential here, the token is write-only in the app: it can be typed in or plugged from the Vault, and is never shown again.

How a pull actually runs ​

  1. The app calls SendRequest with your token and query id. IBKR answers with a reference code and starts building the statement.
  2. It then polls GetStatement with that code until the XML arrives, which is normally a few seconds and can be longer for a wide query. A statement still generating is the expected answer to the first tries, not an error.
  3. The statement is parsed into fills (Trade rows at execution level) and holdings (Open Positions), and the app filters those on the period you picked.

If IBKR is still generating after a minute the app says so rather than hanging: narrow the query's date range, or try again in a moment.

Set it up ​

  1. The token: Account Management → Settings → Flex Web Service. Generate one, copy it once, note the expiry date.

  2. The query: Account Management → Performance & Reports → Flex Queries → new Activity query. Include:

    • Trades, level of detail Execution, for the journal and the tax form;
    • Open Positions, for the portfolio alignment and the chart overlay.

    Save it and note the query id, the number shown next to its name.

  3. In OpenTraderWorld: add the account, paste the token, fill Flex query id and Statement time zone, then Test connection. It reports the account number, the period the statement covers and how many trade rows it carries, which is the fastest way to see that the query is missing a section.

Two settings that decide whether the import is right

The period is the query's, not yours. A Flex query carries its own date range (Last 365 Calendar Days, Year to Date, a custom window) and the web service takes no dates at all. The dates you pick in the app filter what the statement returned, so a query set to Last 30 days will never yield March however far back you ask, and IBKR does not serve more than a year. Set the query wide, filter in the app.

A Flex statement never names its time zone. It stamps the query's own zone and says nothing about which one, so set Statement time zone to that zone by name (America/New_York, Europe/Paris) or every fill lands on the wrong hour, and intraday trades land on the wrong day. A named zone follows daylight saving; Statement time offset (fixed minutes off UTC, -300 New York in winter) is still read when no zone is set.

What Flex does not do ​

  • No working orders, so on a Flex account the chart overlay draws positions at their average cost and no order levels. An Interactive Brokers (Gateway) account draws its orders too.
  • No quotes. A statement is not a price feed: the portfolio's take the price from the exchange button is offered by the API brokers, not here. What IBKR does publish is a cost basis, which is the number that matters for a ledger.
  • One statement at a time. IBKR builds it on demand and refuses a second request while one is generating, so back-to-back pulls on the same query wait for each other.

Module grants ​

ModuleWhat it reads
Trading Journalthe period's fills, for the import
Portfolio Trackerwhat the account holds
Chartspositions, working orders and fills, for the chart overlay
Trading Botsthe account a bot sends its orders to, with trading on
MyWealththe account's equity, as a net-worth asset
Tax Calculatorthe fills of a tax year

Ticking every module collapses back to the all modules wildcard, which also covers modules added in future versions.

Limits ​

  • A ticker is never guessed. A symbol the app cannot resolve is an error naming the fix, not a best-effort match.
  • What a broker does not publish stays empty rather than plausible: no invented cost basis, no invented fee, no invented side.
  • Deleting an account removes its credentials. Whatever it already imported stays.
  • Broker accounts are disabled in demo mode.