View as Markdown

Build a trading journal

Sync closed trades read-only with investor passwords, incrementally and without gaps.

A journal needs complete, correct history and should never be able to trade.

Use investor passwords

Connect accounts with the investor (read-only) password. The terminal then can’t trade at all: account information shows tradeAllowed: false, and health shows read_only: true and trading_enabled: false. Your users can hand you access without handing you their account.

First sync

Page through deals by time. Start is inclusive, end exclusive, and limit is at most 1000:

curl -s "$TW/users/current/accounts/$ID/history-deals/time/2026-01-01T00:00:00Z/2026-09-23T00:00:00Z?offset=0&limit=1000" \
  -H "auth-token: $TW_KEY"

Keep increasing offset by the number of results until you get fewer than limit.

Deals include deposits, withdrawals and credit (DEAL_TYPE_BALANCE, DEAL_TYPE_CREDIT), so you can separate trading performance from money movements. On MT4, closed orders are presented as deals with the same fields.

Stay in sync

Either poll from your last deal’s time (overlap by a minute and de-duplicate on deal id), or subscribe to the account stream with sync.startingHistoryTime set to that time and consume deals and dealAdded frames.

Get the time right

Group trades into days by the broker’s trading day, using brokerTime, not by UTC date. See Time zones.

Statistics

If you’d rather not compute them, our statistics API (not available yet) returns period stats, drawdown, and equity and balance curves.