Server URL: https://app.trade-analyzer.com/mcp. Add it as a custom connector in Claude or another MCP client; on the first
connection you sign in with GitHub and allow access. The tools read and annotate your own trading data; amounts are in the
account's base currency. Not affiliated with Interactive Brokers.
accounts · Accounts read
The user's broker accounts with their broker, account ID, whether a token is stored for loading data, whether it is a file account, and the loaded date ranges. Pass the account ID as account to the other tools; without it they use the account of the most recent report.
Creates a file account, filled from statements and files of any bank with add_rows, and returns it with its account ID. Keep one account per bank, named after it (e.g. "flatex", "Trade Republic"), unless the user wants otherwise; check accounts first so you do not create one twice. IB accounts are created in the web app.
Input
Parameter
Type
Required
Description
name
string
yes
Name the user sees, e.g. the bank
currency
string
Account currency (default EUR); statements settle in it
Output
Field
Type
Description
name
string
broker
string
account
value
canLoad
boolean
A token is stored, sync_reports can load missing days
fileAccount
boolean
Filled from files and statements of any bank; add rows with add_rows
baseCurrency
value
Account currency; null for IB until the first report
ranges
object[] {from, to}
rename_account · Rename an account write
Gives an account (file or IB account) a new name; its account ID, files and data stay.
Input
Parameter
Type
Required
Description
account
string
yes
Account ID from accounts
name
string
yes
Output
Field
Type
Description
name
string
broker
string
account
value
canLoad
boolean
A token is stored, sync_reports can load missing days
fileAccount
boolean
Filled from files and statements of any bank; add rows with add_rows
baseCurrency
value
Account currency; null for IB until the first report
ranges
object[] {from, to}
data_coverage · Loaded data read
Which IB accounts and date ranges are loaded, and what is missing in a period. Call this first to know which periods can be analysed; load missing ones with sync_reports.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
Output
Field
Type
Description
account
string
accounts
string[]
ranges
object[] {from, to}
period
object {from, to}
missing
object[] {from, to}
Not loaded and not being loaded; always empty for a file account (CSV), which has nothing to load
busy
object[] {from, to}
Being loaded right now by another request
sync_reports · Load missing days from IB write
Loads missing days of a period from IB with the stored Flex token (at most 365 days per IB request, up to the last day IB has closed; each request takes 10 to 60 seconds, at most three per call). Data is available from the account opening on. Ranges another job is loading are skipped and listed in busy.
Input
Parameter
Type
Required
Description
from
string
yes
Calendar date YYYY-MM-DD
to
string
yes
Calendar date YYYY-MM-DD
account
string
IB account ID if the user has several (default: account of the most recent report)
Output
Field
Type
Description
error
value
remaining
object[] {from, to}
busy
object[] {from, to}
Ranges another job is loading right now; call again when it is done
log
string[]
trading_summary · Trading summary read
Statistics of the trades closed in a period: batting average, average gain and loss in %, win/loss ratio, adjusted win/loss ratio, expectancy, holding days; net P/L of all sales in the period, partial exits included; per asset class and total, plus time- and money-weighted return and max drawdown. Amounts in the account base currency (field currency).
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
lossLimit
number
Threshold in percent for counting losses that are too large (default 8); does not change results
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
Per month: average gain and loss, win %, number of trades and average days of gains and losses of the trades closed in it; net P/L of all sales in the month, partial exits of positions still open included, and in % of the account value at the start of the month.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
lossLimit
number
Threshold in percent for counting losses that are too large (default 8); does not change results
assetClass
Stocks · CFDs
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
Monthly and period returns: time-weighted (like IB), money-weighted (Modified Dietz), max drawdown. Includes unrealized gains and losses. Amounts in the account base currency.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
Dividends, interest, advance lump sums (German Vorabpauschale) and taxes of a file account in a period, as booked from its statements: totals per kind and every row, amounts in the account base currency (a tax refund is negative). net is dividends and interest minus all taxes, without advance lump sums. Not part of the P/L of a trade. IB accounts have no such rows yet.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
Closed trades (round trips) of a period with the facts needed to judge them: entry and exit, holding days, cost basis, P/L and return, position size in % of the account value before entry, entries and exits, whether the position was added to while losing or winning, partial exits, commissions, and the user's tags and notes. Filter and sort to find e.g. the largest losses, losses beyond a limit, long-held losers or oversized positions. Use trade_detail for the price path of one trade.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
symbol
string
assetClass
Stocks · CFDs
outcome
win · loss
maxReturnPct
number
Only trades with a return at most this, e.g. -8 for losses of 8 % or more
minReturnPct
number
minHoldingDays
number
maxHoldingDays
number
minPositionSizePct
number
Only positions at least this large in % of the account value
addedWhileLosing
boolean
tag
string
includeExcluded
boolean
Also trades the user excluded from the statistics (default false)
sort
exit · return · pnl · holdingDays · positionSize
Default exit date
descending
boolean
limit
number
Default 50
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
One trade in detail: all executions (with the distance to the first entry), the facts from find_trades and the daily price path from Yahoo: maximum adverse and favorable excursion while the trade was open and the price change 5, 20 and 60 trading days after the exit, plus the daily bars.
Input
Parameter
Type
Required
Description
key
string
yes
Trade key from find_trades (trip:...)
account
string
IB account ID if the user has several (default: account of the most recent report)
includeBars
boolean
Include the daily bars (default true)
Output
Field
Type
Description
key
string
Trade key from find_trades (trip:...)
symbolKey
string
Key of all trades of this security (symbol:...), for exclusions
symbol
string
description
string
assetClass
string
Stocks or CFDs
direction
long · short
currency
string
Trading currency of the prices; amounts are in the base currency
entry
string | null
null: opened before the loaded data
exit
string
ISO 8601 date and time (UTC)
holdingDays
value
firstEntryPrice
value
averageEntryPrice
value
averageExitPrice
value
quantity
number
costBasis
number
Amount in the account base currency
pnl
number
Amount in the account base currency
returnPct
number
Percent, e.g. -3.5 for -3.5 %
positionSizePct
value
Cost basis in percent of the account value the day before entry
entries
number
exits
number
addedWhileLosing
boolean
Added below (long) or above (short) the first entry
Positions still open at the end of the loaded data: entry, holding days, open quantity, average entry, cost basis and its size in % of the latest account value, realized P/L from partial exits, adds while losing or winning. Average entry and cost basis count only the shares still held, first in first out, as IB and the tax office do. With prices (default) also the latest price (at most 15 minutes old) from Yahoo, or from Lang & Schwarz Exchange for securities known only by their ISIN (daily closes only there), the market value, the unrealized change against the average entry, the unrealized P/L in the base currency with and without the currency effect since the purchase, the worst and best level since the entry and the distance to the best price since the entry, and the cash per currency from the last cash report. Use it to check open positions against the user's rules; asOf is the last loaded day (call sync_reports first if it is old).
Input
Parameter
Type
Required
Description
account
string
IB account ID if the user has several (default: account of the most recent report)
symbol
string
includePrices
boolean
Load daily prices (default true)
Output
Field
Type
Description
account
string
asOf
string
Last loaded day YYYY-MM-DD
baseCurrency
value
accountValue
value
Last known account value, base currency
accountValueDay
value
Day of accountValue YYYY-MM-DD; in a file account it can be older than asOf
cash
object | null
Cash per currency at the end of the last day with a cash report (IB) or Cash rows (file account); null without either
Stores tags and a note for a trade, e.g. the setup, a rule violation or a lesson ("breakout", "stop too late"). They appear in find_trades and can be filtered by tag. Replaces the previous tags and note; empty tags and note remove them.
Input
Parameter
Type
Required
Description
key
string
yes
Trade key from find_trades (trip:...)
tags
string[]
note
string
Output
Field
Type
Description
key
string
Trade key from find_trades (trip:...)
tags
string[]
note
string
loss_limit_simulation · Stop-loss simulation read
Simulates stops at X % below the entry with daily prices from Yahoo: a stop also hits later winners that dipped below it on the way, and small losses that dipped below it become larger (unlike the usual estimate without price data, which only caps losses). Returns per stop the statistics, winners and losers stopped out and the P/L difference.
Input
Parameter
Type
Required
Description
from
string
Start date YYYY-MM-DD (default: first loaded day)
to
string
End date YYYY-MM-DD (default: last loaded day)
account
string
IB account ID if the user has several (default: account of the most recent report)
stops
number[]
Stops in percent, default 5,6,7,8,10,12,15
Output
Field
Type
Description
account
string
period
object {from, to}
missing
value
Days of the period not loaded yet (call sync_reports), or null
Lists, adds or removes trades excluded from all statistics of an account, e.g. long-term buy-and-hold positions that are not trades. Use the key of one trade from find_trades, or the symbolKey from find_trades or open_positions for all trades of a security.
Input
Parameter
Type
Required
Description
action
list · add · remove
yes
account
string
IB account ID if the user has several (default: account of the most recent report)
key
string
trip:... or symbol:...
label
string
Note shown in the list, e.g. "QQQ buy and hold"
Output
Field
Type
Description
exclusions
object[] {key, label, createdAt}
add_rows · Add rows to a file account write
Adds buys and sells (also deposits, withdrawals, account values and cash balances) to a file account (fileAccount in accounts), as one file named fileName. This is how broker statements get into the app: read the statement (PDF, screenshot, export) yourself and send one row per execution. Always give the ISIN of a security, and its name; look the name up if the statement lacks it. Put anything worth keeping about a row into comment. Rows are checked like a CSV upload; an error names the line (line 2 is the first row) and nothing is stored. The same execution sent again counts once (same tradeId, else same time, security, quantity and price). Returns the file and, per security in the rows, the quantity now held in the whole account: compare it with the statement; a negative quantity is a short position, usually a missing buy.
Possibly the same execution twice, labelled differently (with and without tradeId, different tradeIds, with and without time): same security, day, side, quantity and price in different files. Check them against the statements and correct or remove the wrong file.
file_rows · Rows of a file read
The rows of one file of a file account, in the form add_rows takes, to correct them with replace_file_rows. Which file holds an execution: files in the executions of trade_detail.
replace_file_rows · Correct the rows of a file write
Replaces all rows of one file of a file account with corrected rows, e.g. a name, price, quantity or comment: read them with file_rows, change what is wrong and send all rows back, also the unchanged ones. The file keeps its id, name, statement date and PDF. Checked like add_rows; on an error nothing changes. New executions go into a new file with add_rows instead. Returns what add_rows returns.
Possibly the same execution twice, labelled differently (with and without tradeId, different tradeIds, with and without time): same security, day, side, quantity and price in different files. Check them against the statements and correct or remove the wrong file.
account_files · Files of an account read
The files of an account, newest statement first: id, name, the statement date or period, and when it was added. Use it to find a file that was added twice or to the wrong account, then remove it with remove_account_file.
Input
Parameter
Type
Required
Description
account
string
yes
Account ID from accounts
Output
Field
Type
Description
files
object[] {id, name, statementDate, from, to, addedAt, hasPdf}
Possibly the same execution twice, labelled differently (with and without tradeId, different tradeIds, with and without time): same security, day, side, quantity and price in different files. Check them against the statements and correct or remove the wrong file.
receipt_upload_link · Upload link for a statement PDF write
A one-time link to attach the PDF of a statement to the file its rows went into (id from add_rows or account_files); the user then opens the PDF from each of its rows in the app. Only for clients that can read the PDF as a file and make HTTP requests: upload it once with the method and headers given, e.g. curl -sf -X PUT -H "Content-Type: application/pdf" --data-binary @statement.pdf "<url>". The link is valid for one hour and for one upload; a later upload to the same file replaces its PDF. Answers 413 above maxBytes and 400 if the file is no PDF.
Input
Parameter
Type
Required
Description
account
string
yes
Account ID of a file account from accounts
id
string
yes
File id from add_rows or account_files
Output
Field
Type
Description
file
object {id, name}
url
string
method
string
headers
record of string
maxBytes
number
expiresAt
string
ISO 8601 date and time (UTC)
remove_account_file · Remove a file write
Removes one file of a file account (fileAccount in accounts) with all its rows; the other files stay. Ask the user first. Returns the remaining files.
Input
Parameter
Type
Required
Description
account
string
yes
Account ID from accounts
id
string
yes
id from account_files
Output
Field
Type
Description
files
object[] {id, name, statementDate, from, to, addedAt, hasPdf}
Possibly the same execution twice, labelled differently (with and without tradeId, different tradeIds, with and without time): same security, day, side, quantity and price in different files. Check them against the statements and correct or remove the wrong file.