skalinin909 avatar

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

skalinin909/tradingcalc-mcp

Connects Claude to 19 crypto futures calculators that return exact numbers instead of LLM estimates. You get PnL, liquidation prices, position sizing, funding costs, and carry trade analysis with formulas verified against 22 test vectors. Ask naturally and it routes to the right tool: "long BTC at $83k with 10x leverage, where's liquidation?" or "size my position for 1% risk with stop at $81k." Runs over streamable HTTP, so no local install needed. Free tier gives you 20 calls per day anonymous, 200 with an API key. Useful when you're building trading bots or agent pipelines where wrong math costs real money.

GitHub stars
4
tools
80
transport
HTTP
last updated
Nov 6, 2026

Install

From registry metadata
$ npx add-mcp https://tradingcalc.io/api/mcp --name tradingcalc

Run in your terminal. add-mcp asks which agents to add it to (Claude Code, Codex, Cursor and more). Add -g to install it for every project.

Review the command, arguments and environment values before installing. MCP servers run with your local permissions.

Other ways

Claude Code

$ claude mcp add --transport http tradingcalc https://tradingcalc.io/api/mcp

Run in your terminal. Add --scope user to make it available in every project.

Tools

Verified live · 80 tools

Verified live against the running server on Nov 6, 2026.

workflow.run_pnl_planningCalculate net PnL, ROE, fees and gross profit/loss for a futures trade. Edge cases: entryPrice, exitPrice and size above zero; feeOpenPct and feeClosePct optional fractions from 0 to 0.05 (0.0002 is 0.02%). For inverse contracts size is USD contracts and results are in the bas...7 params

Calculate net PnL, ROE, fees and gross profit/loss for a futures trade. Edge cases: entryPrice, exitPrice and size above zero; feeOpenPct and feeClosePct optional fractions from 0 to 0.05 (0.0002 is 0.02%). For inverse contracts size is USD contracts and results are in the bas...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, pnl/fees are returned in the base coin, not USDT.one of linear · inverse
entryPrice*number
Entry price (positive)
exitPrice*number
Exit price (positive)
feeClosePctnumber
Closing fee as fraction
feeOpenPctnumber
Opening fee as fraction, e.g. 0.0002 = 0.02%
side*string
Trade directionone of long · short
size*number
Position size: base asset qty for linear, USD contracts for inverse
workflow.run_liquidation_safetyCalculate the liquidation price for an isolated-margin futures position with one flat maintenance margin rate (mmr, which you supply from your exchange's tier), unless you use the tiered mode described below. The default is isolated: it does not model a cross account. To get a...12 params

Calculate the liquidation price for an isolated-margin futures position with one flat maintenance margin rate (mmr, which you supply from your exchange's tier), unless you use the tiered mode described below. The default is isolated: it does not model a cross account. To get a...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined (e.g. Deribit/Bybit/MEXC BTC-settled perps). Tiers and shared collateral: both (inverse: size in USD, bands and balances in the base coin).one of linear · inverse
entryPrice*number
Entry price (positive)
leverage*number
Leverage multiplier, e.g. 10 for 10x
liqFeeRatenumber
Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr (e.g. KuCoin 0.0006). Refused in tiered mode.
mmBasestring
Value the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default; Bybit, KuCoin, Hyperliquid), "entry" = entry value (MEXC). Refused in tiered mode.one of liquidation · entry
mmrnumber
Maintenance margin rate, default 0.005 (0.5%)
otherMaintenanceMarginnumber
Shared collateral (needs size): maintenance margin of other positions, 0 or more (default 0).
otherUnrealizedPnlnumber
Shared collateral: unrealized PnL of other positions (default 0, may be negative).
side*string
Trade direction: "long" or "short"one of long · short
sizenumber
Position size: base units for linear, USD contracts for inverse. Needed for tiered mode (tiers, walletBalance and the other fields select it); ignored otherwise.
tiersarray
Tiered mode (needs size): 1 to 50 maintenance margin tiers ascending by upTo (notional cap in quote for linear, in base coin for inverse, above 0; the last band is open-ended: an upTo given on the...
walletBalancenumber
Shared collateral (needs size): wallet balance backing the position. Default: the isolated initial margin, size x entry / leverage in quote for linear, size / entry / leverage in the base coin for...
workflow.run_breakeven_planningCalculate the break-even exit price that covers all trading fees: this alone, nothing else. Edge cases: entryPrice and sizeBase above zero; feeOpenPct and feeClosePct fractions from 0 to 0.05 (defaults 0.0002 and 0.0005). Fees only. Not covered: funding (use workflow.run_fundi...6 params

Calculate the break-even exit price that covers all trading fees: this alone, nothing else. Edge cases: entryPrice and sizeBase above zero; feeOpenPct and feeClosePct fractions from 0 to 0.05 (defaults 0.0002 and 0.0005). Fees only. Not covered: funding (use workflow.run_fundi...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, totalFees is returned in the base coin.one of linear · inverse
entryPrice*number
Entry price (positive)
feeClosePctnumber
Closing fee fraction, default 0.0005
feeOpenPctnumber
Opening fee fraction, default 0.0002
side*string
Trade direction: "long" or "short"one of long · short
sizeBase*number
Position size: base asset qty for linear, USD contracts for inverse
workflow.run_position_sizingCalculate the correct position size given a maximum risk in USDT and a stop-loss price. Edge cases: entryPrice, stopLoss and riskUsdt above zero; leverage above zero (default 1); fees 0 to 0.05; a fee and price combination that makes the risk denominator zero or negative is an...8 params

Calculate the correct position size given a maximum risk in USDT and a stop-loss price. Edge cases: entryPrice, stopLoss and riskUsdt above zero; leverage above zero (default 1); fees 0 to 0.05; a fee and price combination that makes the risk denominator zero or negative is an...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeQuote is USD contracts and margin is returned in the base coin.one of linear · inverse
entryPrice*number
Entry price
feeClosePctnumber
Closing fee fraction, default 0.0005
feeOpenPctnumber
Opening fee fraction, default 0.0002
leveragenumber
Leverage, default 1
riskUsdt*number
Maximum acceptable loss in USDT
side*string
Trade direction: "long" or "short"one of long · short
stopLoss*number
Stop-loss price
workflow.run_funding_costCalculate the total funding cost (or income) for holding a perpetual futures position. Edge cases: sizeBase, entryPrice and days above zero; fundingRate a fraction per interval (0.0001 is 0.01%), either sign; intervalHours 0.25 to 24 (default 8); if funding exceeds the positio...7 params

Calculate the total funding cost (or income) for holding a perpetual futures position. Edge cases: sizeBase, entryPrice and days above zero; fundingRate a fraction per interval (0.0001 is 0.01%), either sign; intervalHours 0.25 to 24 (default 8); if funding exceeds the positio...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeBase is USD contracts and cost figures come out in the base coin.one of linear · inverse
days*number
Number of days to hold
entryPrice*number
Entry price
fundingRate*number
Funding rate per funding interval as a fraction, e.g. 0.0001 (per 8h unless intervalHours says otherwise)
intervalHoursnumber
Hours between funding payments, which is the period fundingRate covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack, 4 or 2 on some symbols of Binance, Bybit, OKX, Gat...
side*string
Trade direction: "long" or "short"one of long · short
sizeBase*number
Position size in base asset
primitive.average_entryCalculate the weighted average entry price from multiple buy/sell fills (DCA): the bare number only, no breakeven or per-fill breakdown. Edge cases: symbol non-empty; at least one fill, each price and quantity above zero (size is accepted as quantity); leverage above zero is o...4 params

Calculate the weighted average entry price from multiple buy/sell fills (DCA): the bare number only, no breakeven or per-fill breakdown. Edge cases: symbol non-empty; at least one fill, each price and quantity above zero (size is accepted as quantity); leverage above zero is o...

Parameters* required
contractTypestring
linear = USDT-margined, average is the arithmetic mean (default). inverse = coin-margined, average is the harmonic mean (fill quantity is USD notional).one of linear · inverse
exchangeCodestring
Exchange identifier (optional)
input*object
Object with a "fills" array, e.g. { "fills": [{ "price": 60000, "quantity": 0.5 }, { "price": 58000, "quantity": 1 }] }
symbol*string
Trading pair symbol, e.g. BTCUSDT
workflow.run_exit_targetCalculate the exact exit price needed to hit a target PnL or ROE percentage. Edge cases: entryPrice, leverage and sizeBase above zero; targetMode pnl or roe, targetValue any number; fees 0 to 0.05 (defaults 0.0002 and 0.0005); a target that cannot be reached from this position...9 params

Calculate the exact exit price needed to hit a target PnL or ROE percentage. Edge cases: entryPrice, leverage and sizeBase above zero; targetMode pnl or roe, targetValue any number; fees 0 to 0.05 (defaults 0.0002 and 0.0005); a target that cannot be reached from this position...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, pnl-mode targetValue and outputs are in the base coin.one of linear · inverse
entryPrice*number
Entry price
feeClosePctnumber
Closing fee fraction, default 0.0005
feeOpenPctnumber
Opening fee fraction, default 0.0002
leverage*number
Leverage multiplier
side*string
Trade direction: "long" or "short"one of long · short
sizeBase*number
Position size in base asset
targetMode*string
"pnl" = target in USDT, "roe" = target in %one of pnl · roe
targetValue*number
Target value (USDT/coin for pnl mode, or %)
workflow.run_scenario_planningRun a scenario analysis: compute PnL for multiple price-change percentages at once. Edge cases: entryPrice and size above zero; at least one price change in percent; a change of -100 or less is refused for inverse contracts and exactly -100 is allowed for linear only; fees opt...7 params

Run a scenario analysis: compute PnL for multiple price-change percentages at once. Edge cases: entryPrice and size above zero; at least one price change in percent; a change of -100 or less is refused for inverse contracts and exactly -100 is allowed for linear only; fees opt...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. For inverse, size is USD contracts and pnl/fees come out in the base coin.one of linear · inverse
deltasPct*array
List of price change percentages, e.g. [-10, -5, 0, 5, 10]. Must be at least -100 (exactly -100 only for linear contracts; inverse contracts need more than -100)
entryPrice*number
Entry price
feeClosePctnumber
Closing fee fraction
feeOpenPctnumber
Opening fee fraction
side*string
Trade direction: "long" or "short"one of long · short
size*number
Position size in base asset
workflow.run_max_leverageCalculate the maximum leverage that keeps a position within a drawdown limit, from account size, max acceptable drawdown, and asset daily volatility. Edge cases: accountSize and volatilityPct above zero; maxDrawdownPct above 0 and at most 100; mmr 0 to 0.1 (default 0.005). A p...4 params

Calculate the maximum leverage that keeps a position within a drawdown limit, from account size, max acceptable drawdown, and asset daily volatility. Edge cases: accountSize and volatilityPct above zero; maxDrawdownPct above 0 and at most 100; mmr 0 to 0.1 (default 0.005). A p...

Parameters* required
accountSize*number
Total account size in USDT
maxDrawdownPct*number
Maximum acceptable drawdown as percentage, e.g. 10 for 10%
mmrnumber
Maintenance margin rate, default 0.005 (0.5%)
volatilityPct*number
Expected daily price volatility as percentage, e.g. 3 for 3%
primitive.hedge_ratioCalculate the short perpetual futures position size needed to hedge a spot holding. Default USDT-linear: sizes and costs in USD. With contractType "inverse" (coin-margined, needs entryPrice) the short is the same USD contracts and margin and funding come back in the base coin....7 params

Calculate the short perpetual futures position size needed to hedge a spot holding. Default USDT-linear: sizes and costs in USD. With contractType "inverse" (coin-margined, needs entryPrice) the short is the same USD contracts and margin and funding come back in the base coin....

Parameters* required
contractTypestring
linear = USDT-margined (default). inverse = coin-margined: spotSize stays the USD value of the holding, requiredMargin and the funding costs are returned in the base coin.one of linear · inverse
entryPricenumber
Coin price in USD. Required for contractType inverse (converts the USD margin and funding to coin); ignored for linear.
fundingRatePctnumber
Current funding rate per funding interval as a percentage, e.g. 0.01 (per 8h unless intervalHours says otherwise). Used for cost estimate.
hedgeRationumber
Percentage of spot to hedge, e.g. 100 for full hedge, 50 for half. Default 100.
intervalHoursnumber
Hours between funding payments, the period fundingRatePct covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack (per-hour rates); 4 or 2 on some symbols of Binance, Bybi...
leveragenumber
Leverage on the perp short. Default 1.
spotSize*number
Spot position value in USDT
workflow.run_funding_arbitrageCalculate funding rate arbitrage profit: annualized yield, net profit, and breakeven days for a long/short basis trade across two exchanges: the bare numbers only, no plain-English verdict. For the same math plus a profitable/marginal/loss verdict, use workflow.run_carry_trade...6 params

Calculate funding rate arbitrage profit: annualized yield, net profit, and breakeven days for a long/short basis trade across two exchanges: the bare numbers only, no plain-English verdict. For the same math plus a profitable/marginal/loss verdict, use workflow.run_carry_trade...

Parameters* required
durationDays*number
Holding period in days
intervalHoursnumber
Hours between funding payments, one interval for both legs. Default 8; 1 on Hyperliquid, dYdX, Kraken and Backpack (per-hour rates); 4 or 2 on some symbols. A leg paid on another interval is entere...
longFundingRate*number
Funding rate on long side (% per interval, positive = you pay)
positionSize*number
Position size in USDT
shortFundingRate*number
Funding rate on short side (% per interval, positive = you receive)
transferFeePctnumber
One-time transfer/setup fee as percentage, e.g. 0.1 for 0.1%
workflow.run_compound_fundingProject capital growth from reinvesting perpetual futures funding income (compounding carry). Edge cases: initialCapital above zero; fundingRatePct in percent per interval (0.01 is 0.01%), either sign; intervalHours a whole number that divides 24 (1, 2, 3, 4, 6, 8, 12 or 24, d...5 params

Project capital growth from reinvesting perpetual futures funding income (compounding carry). Edge cases: initialCapital above zero; fundingRatePct in percent per interval (0.01 is 0.01%), either sign; intervalHours a whole number that divides 24 (1, 2, 3, 4, 6, 8, 12 or 24, d...

Parameters* required
durationDays*number
Number of days to project, up to 3650
fundingRatePct*number
Funding rate per interval as percentage, e.g. 0.01 for 0.01%
initialCapital*number
Starting capital in USDT
intervalHoursnumber
Hours between funding payments, the period fundingRatePct covers, a whole number of hours that divides 24. Default 8; 1 on Hyperliquid, dYdX, Kraken and Backpack (per-hour rates); 4 or 2 on some sy...one of 1 · 2 · 3 · 4 · 6 · 8
reinvestPctnumber
Percentage of funding received that is reinvested each interval, 0-100 (the rest is withdrawn and counts as earned; funding paid always comes out of capital). 100 = full compounding. Default 100.
workflow.run_pre_trade_checkFull pre-trade decision card: orchestrates position sizing, breakeven, liquidation, and funding cost in one call. Edge cases: entry_price, leverage above zero; account_balance 0 or more; give desired_size, or stop_loss together with risk_pct, otherwise an error; funding_rate i...17 params

Full pre-trade decision card: orchestrates position sizing, breakeven, liquidation, and funding cost in one call. Edge cases: entry_price, leverage above zero; account_balance 0 or more; give desired_size, or stop_loss together with risk_pct, otherwise an error; funding_rate i...

Parameters* required
account_balance*number
Total account balance in USDT
contractTypestring
linear = USDT-margined (default), inverse = coin-margined (e.g. Bybit BTCUSD). All returned figures (notional, margin, risk_amount, funding_cost_*) stay USD-denominated either way; recommended_size...one of linear · inverse
entry_price*number
Entry price (positive)
exchangestring
Exchange code, e.g. "binance" or "bybit". Used to fetch the live funding rate if funding_rate is omitted, and to set funding_interval_hours when that is omitted (1 for Hyperliquid, dYdX, Kraken and...
fee_close_pctnumber
Closing fee fraction, default 0.0005
fee_open_pctnumber
Opening fee fraction, default 0.0002
funding_interval_hoursnumber
Hours per funding payment, the period funding_rate covers: 8 on most venues, 1 on Hyperliquid, dYdX, Kraken and Backpack, 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, MEXC, Aster an...
funding_ratenumber
Funding rate per funding interval as decimal, e.g. 0.0001. If omitted, fetched live from exchange.
hold_hoursnumber
Expected hold time in hours for overnight shift calc. Default 8.
leverage*number
Leverage multiplier
liqFeeRatenumber
Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr.
mmBasestring
Value the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default), "entry" = entry value.one of liquidation · entry
mmrnumber
Maintenance margin rate, default 0.005
risk_pct*number
Risk as % of balance, e.g. 1.0 = 1%
side*string
Trade direction: "long" or "short"one of long · short
stop_loss*number
Stop-loss price (positive)
symbolstring
Perpetual symbol, e.g. "BTCUSDT".
workflow.run_risk_rewardFull risk:reward analysis: takes a trade with entry, stop, AND target (all three). Calculates R:R ratio, position size, liquidation price, breakeven, and P&L at both stop and target. Returns a verdict label, strong (3:1+) / good (2:1+) / marginal / poor, which grades the R:R r...13 params

Full risk:reward analysis: takes a trade with entry, stop, AND target (all three). Calculates R:R ratio, position size, liquidation price, breakeven, and P&L at both stop and target. Returns a verdict label, strong (3:1+) / good (2:1+) / marginal / poor, which grades the R:R r...

Parameters* required
account_balance*number
Account balance in USDT
contractTypestring
linear = USDT-margined (default), inverse = coin-margined (e.g. Bybit BTCUSD). position_size/notional are USD notional (contracts) for inverse; pnl_at_stop/pnl_at_target come back denominated in th...one of linear · inverse
entry_price*number
Entry price
fee_close_pctnumber
Close fee rate (default 0.0005)
fee_open_pctnumber
Open fee rate (default 0.0002)
leverage*number
Leverage multiplier
liqFeeRatenumber
Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr.
mmBasestring
Value the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default), "entry" = entry value.one of liquidation · entry
mmrnumber
Maintenance margin rate as a fraction, 0 to 0.2 (default 0.005 = 0.5%); not a percent: 0.5% is 0.005, not 0.5
risk_pct*number
Max risk as % of account
side*string
Trade direction: "long" or "short"one of long · short
stop_loss*number
Stop-loss price
take_profit*number
Take-profit price
workflow.run_portfolio_riskAggregates risk across multiple open positions in one call: total notional, total P&L, total margin in use, margin usage as a % of account balance (if given), and which single position sits closest to liquidation. Each position is computed through the same canonical PnL/liquid...2 params

Aggregates risk across multiple open positions in one call: total notional, total P&L, total margin in use, margin usage as a % of account balance (if given), and which single position sits closest to liquidation. Each position is computed through the same canonical PnL/liquid...

Parameters* required
account_balancenumber
Optional account balance in USD, used to compute margin_usage_pct: linear margin plus every inverse position's own margin marked to market at its mark_price, all as one USD total
positions*array
Open positions to aggregate (1 to 50). Each: { side, entry_price, mark_price, size, leverage }, plus optional fees, mmr, mmBase, liqFeeRate, contractType, coin, label.
workflow.run_dca_entryDCA entry planner: weighted average entry price, breakeven, and per-level contribution from multiple fill prices and sizes. Each fill is { price, size } here (primitive.average_entry calls the same field quantity). Compared with primitive.average_entry, this one adds output fo...5 params

DCA entry planner: weighted average entry price, breakeven, and per-level contribution from multiple fill prices and sizes. Each fill is { price, size } here (primitive.average_entry calls the same field quantity). Compared with primitive.average_entry, this one adds output fo...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. Each fill's size is USD notional (contracts) for inverse; averageEntry is then the harmonic mean of fill prices, not the arithmetic mean.one of linear · inverse
entries*array
Fills to average (2 to 20). Each: { price, size }, e.g. [{ "price": 60000, "size": 0.5 }, { "price": 58000, "size": 1 }]. Size is base-asset quantity for linear, USD notional (contracts) for inverse.
fee_close_pctnumber
Close fee rate (default 0.0005)
fee_open_pctnumber
Open fee rate (default 0.0002)
side*string
Trade direction: "long" or "short"one of long · short
workflow.run_average_downShould-I-average-down check: for an already-open position, compares adding more at a worse price against the always-available alternative of buying the same final total size fresh at today's price. Returns the new blended average entry, liquidation price and breakeven (before...13 params

Should-I-average-down check: for an already-open position, compares adding more at a worse price against the always-available alternative of buying the same final total size fresh at today's price. Returns the new blended average entry, liquidation price and breakeven (before...

Parameters* required
add_price*number
Proposed price to add at - also treated as today's current price for the fresh-entry comparison
add_size*number
Additional size being considered, same unit convention as existing_size
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. Risk figures come back denominated in the base coin for inverse.one of linear · inverse
existing_entry_price*number
Entry price of the position already held
existing_size*number
Size already held: base-asset quantity for linear, USD notional (contracts) for inverse
fee_close_pctnumber
Close fee rate (default 0.0005)
fee_open_pctnumber
Open fee rate (default 0.0002)
leverage*number
Leverage multiplier
liqFeeRatenumber
Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr.
mmBasestring
Value the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default), "entry" = entry value.one of liquidation · entry
mmrnumber
Maintenance margin rate as a fraction, 0 to 0.2 (default 0.005 = 0.5%); not a percent: 0.5% is 0.005, not 0.5
side*string
Trade direction: "long" or "short"one of long · short
stop_loss*number
Stop-loss price (must be below add_price for a long, above it for a short - the position should already be closed otherwise)
workflow.run_scale_outScale-out planner: P&L, ROI, and cumulative P&L for each partial exit level. Edge cases: entry_price and total_size above zero; 2 to 10 exits, each price above zero and pct above 0 and at most 100, the pct values summing to at most 100 (less than 100 leaves the rest open); fee...7 params

Scale-out planner: P&L, ROI, and cumulative P&L for each partial exit level. Edge cases: entry_price and total_size above zero; 2 to 10 exits, each price above zero and pct above 0 and at most 100, the pct values summing to at most 100 (less than 100 leaves the rest open); fee...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. total_size is USD notional (contracts) for inverse, and per-level pnl comes back denominated in the base coin.one of linear · inverse
entry_price*number
Entry price
exits*array
Partial exit levels (2 to 10). Each: { price, pct }, e.g. [{ "price": 90000, "pct": 30 }, { "price": 95000, "pct": 70 }]; the pct values must not sum to more than 100.
fee_close_pctnumber
Close fee rate (default 0.0005)
fee_open_pctnumber
Open fee rate (default 0.0002)
side*string
Trade direction: "long" or "short"one of long · short
total_size*number
Total position size in base currency
workflow.run_carry_tradeDelta-neutral carry trade (funding arbitrage) analysis, with a profitable/marginal/loss verdict on top of the same math primitive.funding_arb uses. Compared with primitive.funding_arb, this one adds output for the case where a plain-English verdict is wanted, not just the raw...6 params

Delta-neutral carry trade (funding arbitrage) analysis, with a profitable/marginal/loss verdict on top of the same math primitive.funding_arb uses. Compared with primitive.funding_arb, this one adds output for the case where a plain-English verdict is wanted, not just the raw...

Parameters* required
funding_rate_long*number
Funding rate on the long exchange per interval, in percent (0.01 means 0.01%, not 0.0001)
funding_rate_short*number
Funding rate on the short exchange per interval, in percent (0.01 means 0.01%, not 0.0001)
hold_days*number
Hold duration in days
interval_hoursnumber
Hours between funding payments, one interval for both legs (default 8; 1 for hourly venues; 4 or 2 on some symbols). A leg paid on another interval is entered as its rate times (this interval / its...
notional*number
Position notional in USDT
transfer_fee_pctnumber
One-way transfer fee % (default 0.1)
workflow.run_funding_breakevenPrice move needed to cover funding cost + fees over a holding period. Edge cases: entry_price, size and hold_hours above zero; funding_rate is a decimal per funding interval (0.0001 is 0.01%), either sign; funding_interval_hours 0.25 to 24 (default 8); fees are fractions from...9 params

Price move needed to cover funding cost + fees over a holding period. Edge cases: entry_price, size and hold_hours above zero; funding_rate is a decimal per funding interval (0.0001 is 0.01%), either sign; funding_interval_hours 0.25 to 24 (default 8); fees are fractions from...

Parameters* required
contractTypestring
linear = USDT-margined (default), inverse = coin-margined. size is USD notional (contracts) for inverse; notional/funding_cost/fee_total/total_carry_cost come back denominated in the base coin.one of linear · inverse
entry_price*number
Entry price
fee_close_pctnumber
Close fee rate (default 0.0005)
fee_open_pctnumber
Open fee rate (default 0.0002)
funding_interval_hoursnumber
Hours per funding payment, the period funding_rate covers: 8 (default), 1 on Hyperliquid, dYdX, Kraken and Backpack (per-hour rates), 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, ME...
funding_rate*number
Funding rate per funding interval (decimal, e.g. 0.0001)
hold_hours*number
Hold duration in hours
side*string
Trade direction: "long" or "short"one of long · short
size*number
Position size in base currency
workflow.run_crypto_profitProfit or loss on a spot crypto trade (coins bought and sold outright, no leverage, no funding) after both fees. Give exactly one of investment (total cash spent, buy fee included) or quantity (coins bought). Each fee is a fraction of that fill's trade value (0.001 = 0.1%): th...7 params

Profit or loss on a spot crypto trade (coins bought and sold outright, no leverage, no funding) after both fees. Give exactly one of investment (total cash spent, buy fee included) or quantity (coins bought). Each fee is a fraction of that fill's trade value (0.001 = 0.1%): th...

Parameters* required
buyFeePctnumber
Buy fee as a fraction of the trade value, 0 to 0.05 (0.001 = 0.1%). Default 0
buyPrice*number
Price paid per coin, in the quote currency (e.g. 60000 for BTC in USD)
holdingDaysnumber
Optional: days the coins were held; 30 or more also returns the annualized return
investmentnumber
Total cash spent on the buy, buy fee included (e.g. 1000). Give this or quantity, not both
quantitynumber
Number of coins bought (e.g. 0.5). Give this or investment, not both
sellFeePctnumber
Sell fee as a fraction of the trade value, 0 to 0.05 (0.001 = 0.1%). Default 0
sellPrice*number
Price per coin at the sale, or the price to test, same currency
workflow.run_spot_dcaDollar-cost averaging on a spot coin: the same cash amount bought at each of a list of prices (no leverage, no funding). Returns the coins held, total invested, the average price paid (below the plain average of the prices, because equal cash buys more coins when the price is...5 params

Dollar-cost averaging on a spot coin: the same cash amount bought at each of a list of prices (no leverage, no funding). Returns the coins held, total invested, the average price paid (below the plain average of the prices, because equal cash buys more coins when the price is...

Parameters* required
amountPerBuy*number
Cash spent on each buy, buy fee included (e.g. 100)
buyFeePctnumber
Buy fee as a fraction of the trade value, 0 to 0.05 (0.001 = 0.1%). Default 0
currentPricenumber
Optional: the price to value the whole position at, same currency as prices
prices*array
Price paid per coin at each buy, in order (1 to 1000 positive numbers, e.g. [60000, 52000, 48000])
sellFeePctnumber
Sell fee for the exit, as a fraction of the trade value, 0 to 0.05. Default 0
workflow.run_average_buy_priceReal entry price of a spot coin bought and sold in several trades: moving average cost, trades in the order they happened, each with its own fee (no leverage, no funding). The buy fee is part of the cost basis; a sale removes coins at the current average and never changes the...2 params

Real entry price of a spot coin bought and sold in several trades: moving average cost, trades in the order they happened, each with its own fee (no leverage, no funding). The buy fee is part of the cost basis; a sale removes coins at the current average and never changes the...

Parameters* required
sellFeePctnumber
Fee expected when the remaining coins are sold, 0 to 0.05, for the break-even sell price. Default 0
trades*array
Trades in the order they happened (1 to 1000)
workflow.run_target_sell_priceThe sell price that makes a target ROI or a target profit on a spot trade after both fees: the inverse of workflow.run_crypto_profit. Give exactly one of targetRoiPct (a fraction, 0.25 = 25%, negative for a stop price, above -1) or targetProfit (money; needs investment or quan...7 params

The sell price that makes a target ROI or a target profit on a spot trade after both fees: the inverse of workflow.run_crypto_profit. Give exactly one of targetRoiPct (a fraction, 0.25 = 25%, negative for a stop price, above -1) or targetProfit (money; needs investment or quan...

Parameters* required
buyFeePctnumber
Buy fee as a fraction of the trade value, 0 to 0.05 (0.001 = 0.1%). Default 0
buyPrice*number
Price paid per coin
investmentnumber
Total cash spent on the buy, buy fee included. Give this or quantity, not both
quantitynumber
Number of coins bought. Give this or investment, not both
sellFeePctnumber
Sell fee as a fraction of the trade value, 0 to 0.05. Default 0
targetProfitnumber
Target profit in money after both fees (negative for a loss limit). Needs investment or quantity. Give this or targetRoiPct, not both
targetRoiPctnumber
Target return as a fraction of the cost (0.25 = 25%), above -1. Give this or targetProfit, not both
workflow.run_present_valuePresent value of a future lump sum, a level payment stream, or both: what money received later is worth today at a discount rate. annualRate is a fraction (0.05 = 5%) split into periodsPerYear equal periods the nominal way (rate per period = annualRate / periodsPerYear); years...6 params

Present value of a future lump sum, a level payment stream, or both: what money received later is worth today at a discount rate. annualRate is a fraction (0.05 = 5%) split into periodsPerYear equal periods the nominal way (rate per period = annualRate / periodsPerYear); years...

Parameters* required
annualRate*number
Annual discount rate as a fraction (0.06 = 6%); may be zero or negative, but the rate per period must stay above -100%
futureValuenumber
Lump sum received at the end, in any currency. Default 0
paymentnumber
Level payment per period. Default 0
paymentTimingstring
"end" (ordinary annuity, default) or "begin" (annuity due, each payment one period earlier)one of end · begin
periodsPerYearinteger
Compounding and payment periods per year, 1 to 365. Default 1 (12 = monthly)
years*number
Length in years, 0 to 1000 (fractions allowed for a lump sum; with payments years x periodsPerYear must be a whole number)
workflow.run_future_valueFuture value of a starting sum, regular contributions, or both, grown at a fixed rate: what savings or an investment reach after a number of years. annualRate is a fraction (0.07 = 7%) split into periodsPerYear equal periods the nominal way (rate per period = annualRate / peri...6 params

Future value of a starting sum, regular contributions, or both, grown at a fixed rate: what savings or an investment reach after a number of years. annualRate is a fraction (0.07 = 7%) split into periodsPerYear equal periods the nominal way (rate per period = annualRate / peri...

Parameters* required
annualRate*number
Annual growth rate as a fraction (0.07 = 7%); may be zero or negative, but the rate per period must stay above -100%
paymentnumber
Level contribution per period. Default 0
paymentTimingstring
"end" (default) or "begin" (each contribution one period earlier)one of end · begin
periodsPerYearinteger
Compounding and contribution periods per year, 1 to 365. Default 1 (12 = monthly)
presentValuenumber
Starting amount, in any currency. Default 0
years*number
Length in years, 0 to 1000 (fractions allowed for a lump sum; with payments years x periodsPerYear must be a whole number)
workflow.run_npvNet present value of a list of cash flows at a discount rate per period. The first flow is at time 0 and is NOT discounted (the usual textbook NPV; a spreadsheet NPV() function discounts the first value one period, so its result is this one divided by 1 + rate). Money received...2 params

Net present value of a list of cash flows at a discount rate per period. The first flow is at time 0 and is NOT discounted (the usual textbook NPV; a spreadsheet NPV() function discounts the first value one period, so its result is this one divided by 1 + rate). Money received...

Parameters* required
cashFlows*array
Cash flow at time 0, 1, 2, ... (e.g. [-1000, 500, 500, 500]); use 0 for an empty period
ratePerPeriod*number
Discount rate per period as a fraction (0.1 = 10% per period), above -100%, at most 1e6
workflow.run_irrInternal rate of return: the rate per period at which the NPV of a list of cash flows is zero (first flow at time 0). The flows need at least one outflow and one inflow. One sign change in the flows (all outflows first, then all inflows) gives exactly one answer, returned as i...2 params

Internal rate of return: the rate per period at which the NPV of a list of cash flows is zero (first flow at time 0). The flows need at least one outflow and one inflow. One sign change in the flows (all outflows first, then all inflows) gives exactly one answer, returned as i...

Parameters* required
cashFlows*array
Cash flow at time 0, 1, 2, ... with at least one negative and one positive value (e.g. [-1000, 300, 400, 500])
periodsPerYearinteger
Optional: periods per year (12 for monthly flows), 1 to 365, to also return the annual effective rate
workflow.run_cagrCompound annual growth rate between a beginning and an ending value over a number of years: the constant yearly rate that turns one into the other, (ending / beginning)^(1 / years) - 1. A smoothed average: it hides the path and the volatility in between, and it says nothing ab...3 params

Compound annual growth rate between a beginning and an ending value over a number of years: the constant yearly rate that turns one into the other, (ending / beginning)^(1 / years) - 1. A smoothed average: it hides the path and the volatility in between, and it says nothing ab...

Parameters* required
beginningValue*number
Value at the start (positive)
endingValue*number
Value at the end (positive), same currency
years*number
Years between them, above 0 and at most 1000 (fractions allowed, e.g. 2.5)
workflow.run_apy_apr_converterConvert an APR (nominal yearly rate) to an APY (effective yearly rate) or back, for a compounding you choose. APY = (1 + APR / m)^m - 1 for m periods a year, e^APR - 1 when continuous. The same APY is a different APR at every compounding frequency, so the frequency is required...4 params

Convert an APR (nominal yearly rate) to an APY (effective yearly rate) or back, for a compounding you choose. APY = (1 + APR / m)^m - 1 for m periods a year, e^APR - 1 when continuous. The same APY is a different APR at every compounding frequency, so the frequency is required...

Parameters* required
continuousboolean
True for continuous compounding; then omit periodsPerYear
direction*string
apr_to_apy converts the given APR into an APY; apy_to_apr the reverseone of apr_to_apy · apy_to_apr
periodsPerYearinteger
Compounding periods a year, 1 to 365 (12 monthly, 365 daily). Omit when continuous is true
rate*number
The rate you have, as a fraction per year (0.12 = 12%), up to 1000. An APY must be above -1; an APR must satisfy APR / periodsPerYear above -1
workflow.run_bond_pricePrice of a plain fixed-rate bond on a coupon date, with Macaulay duration, modified duration, convexity and DV01. Price = sum of the coupons and the face value discounted at the yield per period (yield / frequency), clean price, no accrued interest, so years x frequency must b...5 params

Price of a plain fixed-rate bond on a coupon date, with Macaulay duration, modified duration, convexity and DV01. Price = sum of the coupons and the face value discounted at the yield per period (yield / frequency), clean price, no accrued interest, so years x frequency must b...

Parameters* required
couponRate*number
Annual coupon rate as a fraction of face value (0.05 = 5%), 0 to 1; 0 is a zero-coupon bond
faceValuenumber
Face (par) value repaid at maturity, above 0 (default 1000)
frequencyinteger
Coupon payments a year, 1 to 12 (default 2: semiannual; 1 annual, 4 quarterly, 12 monthly)
years*number
Years to maturity, above 0 and at most 100; years x frequency must be a whole number (5 years semiannual is 10 coupons)
yieldRate*number
Nominal yearly yield to maturity as a fraction (0.06 = 6%), compounded frequency times a year; yield / frequency must be above -1
workflow.run_bonding_curvePump.fun-style bonding curve calculator: exact tokens received for a buy, price impact, and graduation progress. Pure constant-product math (Uniswap V2 style) using pump.fun's official virtual-reserve constants: no live lookup needed, works for any token still on the curve (no...2 params

Pump.fun-style bonding curve calculator: exact tokens received for a buy, price impact, and graduation progress. Pure constant-product math (Uniswap V2 style) using pump.fun's official virtual-reserve constants: no live lookup needed, works for any token still on the curve (no...

Parameters* required
solRaisedSoFar*number
SOL already raised on the curve so far (0 for a brand-new token)
solToSpend*number
SOL amount for this buy
workflow.run_impermanent_lossImpermanent loss for a liquidity-pool position: compares providing liquidity against simply holding the same tokens, at a manually-supplied entry and current price. Two modes: full_range (standard 50/50 constant-product pool, the textbook 2*sqrt(k)/(1+k)-1 closed form) or conc...7 params

Impermanent loss for a liquidity-pool position: compares providing liquidity against simply holding the same tokens, at a manually-supplied entry and current price. Two modes: full_range (standard 50/50 constant-product pool, the textbook 2*sqrt(k)/(1+k)-1 closed form) or conc...

Parameters* required
currentPrice*number
Base token's current price in quote-token terms
depositValueUsdnumber
Optional: USD value deposited at entry, to also report dollar-denominated lpValueUsd/hodlValueUsd/lossUsd
entryPrice*number
Base token's price in quote-token terms when liquidity was deposited
feesEarnedUsdnumber
Optional trading fees earned so far in USD (default 0), folded into netResultUsd alongside lossUsd
lowerPricenumber
Range lower bound - required for concentrated mode, must be below entryPrice
modestring
Default full_range.one of full_range · concentrated
upperPricenumber
Range upper bound - required for concentrated mode, must be above entryPrice
workflow.run_options_payoffPayoff, P&L, and breakeven price for a single-leg Deribit BTC/ETH option (long or short call/put) at a given scenario price at expiry. Deribit BTC/ETH options are coin-settled: premium, P&L, and the max profit/loss caps come back denominated in the base coin (BTC/ETH), not USD...9 params

Payoff, P&L, and breakeven price for a single-leg Deribit BTC/ETH option (long or short call/put) at a given scenario price at expiry. Deribit BTC/ETH options are coin-settled: premium, P&L, and the max profit/loss caps come back denominated in the base coin (BTC/ETH), not USD...

Parameters* required
currencystring
Underlying. Default BTC. XAU and XAG (gold, silver) only with exchange binance.one of BTC · ETH · XAU · XAG
exchangestring
Venue whose settlement rules apply. "deribit" (default): BTC/ETH, coin-settled, premium in the base coin. "binance": BTC/ETH/XAU/XAG, USDT-settled, flat payoff max(0, S-K) per unit, premium in USDT...one of deribit · binance
optionType*string
Option type: "call" or "put"one of call · put
position*string
Option position: "long" (bought) or "short" (sold)one of long · short
premiumCoinnumber
Deribit only. Premium paid/received per contract, in the base coin (matches Deribit's own quoted price, e.g. 0.02 BTC); must be < 1 for a call
premiumUsdtnumber
Binance only. Premium paid/received per unit, in USDT (e.g. 1500); must be < strike for a put
quantity*number
Number of contracts (Deribit BTC/ETH options have contract_size 1.0, so this is coin-denominated size)
scenarioPrice*number
Underlying price in USD to evaluate the payoff at
strike*number
Strike price in USD
workflow.run_black_scholesTheoretical European option price and Greeks (delta, gamma, theta, vega, rho) from Black-Scholes, given manual spot/strike/days-to-expiry/volatility/risk-free-rate inputs plus an optional continuous dividend yield for stocks and ETFs (the implied-volatility and option-chain to...6 params

Theoretical European option price and Greeks (delta, gamma, theta, vega, rho) from Black-Scholes, given manual spot/strike/days-to-expiry/volatility/risk-free-rate inputs plus an optional continuous dividend yield for stocks and ETFs (the implied-volatility and option-chain to...

Parameters* required
daysToExpiry*number
Calendar days until expiry (can be fractional)
dividendYieldPctnumber
Continuous dividend yield in percent per year (1.2 means 1.2%), for stock and ETF options. Default 0: crypto has none. Range 0 to 100.
riskFreeRatePctnumber
Risk-free rate in percentage points. Default 0: standard crypto-options convention.
spot*number
Underlying spot price, USD
strike*number
Strike price, USD
volatilityPct*number
Annualized implied volatility in percentage points, e.g. 60 for 60%
workflow.run_option_greeksFirst and second order Greeks of a European option from Black-Scholes-Merton, manual inputs only (no live data): everything workflow.run_black_scholes returns (price, delta, gamma, vega, theta, rho) plus the higher-order Greeks vanna, vomma (volga), charm, veta, speed, zomma a...6 params

First and second order Greeks of a European option from Black-Scholes-Merton, manual inputs only (no live data): everything workflow.run_black_scholes returns (price, delta, gamma, vega, theta, rho) plus the higher-order Greeks vanna, vomma (volga), charm, veta, speed, zomma a...

Parameters* required
daysToExpiry*number
Calendar days until expiry (can be fractional), 0.001 to 36500
dividendYieldPctnumber
Continuous dividend yield in percent per year, 0 to 100. Default 0.
riskFreeRatePctnumber
Risk-free rate in percentage points, 0 to 100. Default 0.
spot*number
Underlying spot price
strike*number
Strike price, same units as spot
volatilityPct*number
Annualized implied volatility in percentage points, e.g. 60 for 60%, 0.01 to 1000
workflow.run_straddle_stranglePayoff, P&L, and both breakeven prices for a long or short straddle/strangle (a call + a put on the same Deribit BTC/ETH underlying, both legs the same direction) at a scenario price. A straddle is callStrike === putStrike; any callStrike > putStrike makes it a strangle, same...11 params

Payoff, P&L, and both breakeven prices for a long or short straddle/strangle (a call + a put on the same Deribit BTC/ETH underlying, both legs the same direction) at a scenario price. A straddle is callStrike === putStrike; any callStrike > putStrike makes it a strangle, same...

Parameters* required
callPremiumCoinnumber
Deribit only. Call leg premium per contract, in the base coin (e.g. 0.02 BTC)
callPremiumUsdtnumber
Binance only. Call leg premium per unit, in USDT
callStrike*number
Call leg strike, USD. Equal to putStrike for a straddle, higher for a strangle.
currencystring
Underlying. Default BTC. XAU and XAG (gold, silver) only with exchange binance.one of BTC · ETH · XAU · XAG
exchangestring
Venue whose settlement rules apply. "deribit" (default): BTC/ETH, coin-settled, premium in the base coin. "binance": BTC/ETH/XAU/XAG, USDT-settled, flat payoff max(0, S-K) per unit, premium in USDT...one of deribit · binance
position*string
Option position: "long" (bought) or "short" (sold)one of long · short
putPremiumCoinnumber
Deribit only. Put leg premium per contract, in the base coin
putPremiumUsdtnumber
Binance only. Put leg premium per unit, in USDT
putStrike*number
Put leg strike, USD. Must be <= callStrike.
quantity*number
Number of straddle/strangle units (both legs sized equally)
scenarioPrice*number
Underlying price in USD to evaluate the payoff at
workflow.run_covered_call_protective_putCovered call (long the coin + short a call against it, for yield) or protective put (long the coin + long a put, for downside insurance) on a Deribit BTC/ETH position. Returns the standard annualized-yield metric (premium ÷ 1 coin, annualized by 365/daysToExpiry) up front: tha...10 params

Covered call (long the coin + short a call against it, for yield) or protective put (long the coin + long a put, for downside insurance) on a Deribit BTC/ETH position. Returns the standard annualized-yield metric (premium ÷ 1 coin, annualized by 365/daysToExpiry) up front: tha...

Parameters* required
currencystring
Underlying. Default BTC. XAU and XAG (gold, silver) only with exchange binance.one of BTC · ETH · XAU · XAG
daysToExpiry*number
Calendar days until expiry; used to annualize the yield/cost
exchangestring
Venue whose settlement rules apply. "deribit" (default): BTC/ETH, coin-settled, premium in the base coin. "binance": BTC/ETH/XAU/XAG, USDT-settled, flat payoff max(0, S-K) per unit, premium in USDT...one of deribit · binance
premiumCoinnumber
Deribit only. Premium received (covered_call) or paid (protective_put) per contract, in the base coin
premiumUsdtnumber
Binance only. Premium received (covered_call) or paid (protective_put) per unit, in USDT; must be < spotEntry for a covered call and < strike for a protective put
quantity*number
Coin units held / contracts (1:1 covered)
scenarioPrice*number
Underlying price in USD to evaluate the combined position's value at
spotEntry*number
Price you acquired/value the underlying coin at, USD; used for the covered-call breakeven vs. cost basis
strategy*string
"covered_call" (hold the coin, sell a call against it) or "protective_put" (hold the coin, buy a put as insurance)one of covered_call · protective_put
strike*number
Option strike, USD
workflow.run_spread_payoffPayoff, breakeven(s), and max profit/loss for a Deribit BTC/ETH vertical spread (2 legs, same option type, opposite direction, e.g. a bull call spread) or an iron condor/butterfly (4 legs: 2 calls + 2 puts) at a scenario price. Coin-settled, and the max profit/loss are genuine...5 params

Payoff, breakeven(s), and max profit/loss for a Deribit BTC/ETH vertical spread (2 legs, same option type, opposite direction, e.g. a bull call spread) or an iron condor/butterfly (4 legs: 2 calls + 2 puts) at a scenario price. Coin-settled, and the max profit/loss are genuine...

Parameters* required
currencystring
Underlying. Default BTC. XAU and XAG (gold, silver) only with exchange binance.one of BTC · ETH · XAU · XAG
exchangestring
Venue whose settlement rules apply. "deribit" (default): BTC/ETH, coin-settled, premium in the base coin. "binance": BTC/ETH/XAU/XAG, USDT-settled, flat payoff max(0, S-K) per unit, premium in USDT...one of deribit · binance
legs*array
Exactly 2 legs (same option type, opposite position - a vertical spread) or 4 legs (2 calls + 2 puts - an iron condor/butterfly). Each leg: { optionType: call|put, position: long|short, strike: num...
quantity*number
Number of spread/condor units
scenarioPrice*number
Underlying price in USD to evaluate the payoff at
workflow.run_implied_volatilitySolves for the volatility that makes Black-Scholes reproduce an observed option price (Newton-Raphson with a bisection fallback for cases where vega is too flat to converge, e.g. deep ITM/OTM or very short-dated). Checks the price against its no-arbitrage bounds first and refu...6 params

Solves for the volatility that makes Black-Scholes reproduce an observed option price (Newton-Raphson with a bisection fallback for cases where vega is too flat to converge, e.g. deep ITM/OTM or very short-dated). Checks the price against its no-arbitrage bounds first and refu...

Parameters* required
daysToExpiry*number
Calendar days until expiry (can be fractional)
optionType*string
Option type: "call" or "put"one of call · put
riskFreeRatePctnumber
Risk-free rate in percentage points. Default 0: standard crypto-options convention.
spot*number
Underlying spot price, USD
strike*number
Strike price, USD
targetPriceUsd*number
The observed option price, USD, to solve the implied volatility from
workflow.run_barrier_touchProbability that the price touches a barrier (a target or a stop level) at ANY time within N days, under geometric Brownian motion (reflection principle with drift). This is not the probability of finishing beyond the level at expiry: at zero log-drift a touch is exactly twice...5 params

Probability that the price touches a barrier (a target or a stop level) at ANY time within N days, under geometric Brownian motion (reflection principle with drift). This is not the probability of finishing beyond the level at expiry: at zero log-drift a touch is exactly twice...

Parameters* required
barrier*number
The level to touch, same units as spot. Above spot: up-touch; below spot: down-touch
daysToExpiry*number
Calendar days in the window (can be fractional, up to 3650)
driftPctnumber
Annualized expected price drift in percentage points. Default 0.
spot*number
Current price, USD (any quote currency)
volatilityPct*number
Annualized volatility in percentage points (e.g. 60 for 60%), at least 0.01
workflow.run_american_optionPrice of an AMERICAN put or call (exercisable on any day up to expiry) on a Cox-Ross-Rubinstein binomial tree with early exercise checked at every node, with a continuous dividend yield. Use it for stock and ETF style options; crypto options on Deribit and Binance are European...8 params

Price of an AMERICAN put or call (exercisable on any day up to expiry) on a Cox-Ross-Rubinstein binomial tree with early exercise checked at every node, with a continuous dividend yield. Use it for stock and ETF style options; crypto options on Deribit and Binance are European...

Parameters* required
daysToExpiry*number
Calendar days to expiry (up to 3650)
dividendYieldPctnumber
Continuous dividend yield in percent per year, 0 to 100. Default 0.
optionType*string
American call or putone of call · put
riskFreeRatePctnumber
Annual risk-free rate in percent, 0 to 100. Default 0.
spot*number
Current price of the underlying
stepsinteger
Binomial tree steps, whole number from 50 to 2000. Default 500.
strike*number
Strike price, same units as spot
volatilityPct*number
Annualized volatility in percentage points (e.g. 30 for 30%), at most 300
workflow.run_cash_secured_putCash-secured put on a US stock or ETF, in US dollars with the standard 100-share contract (NOT Deribit and not coin-settled): you sell puts and hold the cash to buy the shares if they are assigned. Returns the premium income, the cash held as collateral (strike x 100 x contrac...6 params

Cash-secured put on a US stock or ETF, in US dollars with the standard 100-share contract (NOT Deribit and not coin-settled): you sell puts and hold the cash to buy the shares if they are assigned. Returns the premium income, the cash held as collateral (strike x 100 x contrac...

Parameters* required
contracts*integer
Number of contracts sold, a whole number from 1 to 1,000,000
daysToExpiry*number
Calendar days to expiry, 1 to 3650
premium*number
Premium received per share as quoted, USD, 0 or more and below the strike. A contract covers 100 shares, so 2.50 pays 250 dollars per contract.
scenarioPricenumber
Optional: a share price at expiry, USD, 0 or more, to report the P&L at
spotPricenumber
Optional: the share price today, USD, above 0, for the comparison with buying now
strike*number
Strike price of the put, USD per share, above 0
workflow.run_options_positionProfit and loss at expiry for a US-style equity, ETF or index option position built from 1 to 4 option legs, in US dollars with the standard contract multiplier of 100 shares (NOT Deribit and not coin-settled: for BTC/ETH options on Deribit use workflow.run_spread_payoff or wo...3 params

Profit and loss at expiry for a US-style equity, ETF or index option position built from 1 to 4 option legs, in US dollars with the standard contract multiplier of 100 shares (NOT Deribit and not coin-settled: for BTC/ETH options on Deribit use workflow.run_spread_payoff or wo...

Parameters* required
legs*array
One to four option legs. Each leg: { optionType: call|put, position: long|short, strike: number, premium: number (USD per share), contracts: integer >= 1 (default 1) }.
scenarioPricesarray
Expiry prices (USD per share, 0 or more) to report the position P&L at. Optional.
stockobject
Optional long shares held together with the options: { quantity: whole shares, costPerShare: USD }. 100 shares cover one short call.
workflow.run_strategy_pickerRanks option strategies for a price forecast and a volatility view. You give the spot price, the price you expect at expiry, days to expiry and the market implied volatility; optionally your own volatility forecast (default: the market's, so the view is on price only). Every s...9 params

Ranks option strategies for a price forecast and a volatility view. You give the spot price, the price you expect at expiry, days to expiry and the market implied volatility; optionally your own volatility forecast (default: the market's, so the view is on price only). Every s...

Parameters* required
allowUnlimitedLossboolean
Include naked short call, short straddle and short strangle. Default false.
daysToExpiry*number
Days to expiry, above 0 and at most 3650
forecastVolPctnumber
Your own volatility forecast in percent per year. Default: impliedVolPct (no volatility view).
impliedVolPct*number
Market implied volatility in percent per year (e.g. 30), used to price every option, at most 1000
rankBystring
Ranking key. Default expectedPnl.one of returnOnRisk · expectedPnl · probabilityOfProfit
riskFreeRatePctnumber
Annual risk-free rate in percent, 0 to 100. Default 0.
spot*number
Current price of the underlying, from 0.000000001 to 1000000000
strikeStepnumber
Strike spacing. Default: a round step that gives about 16 strikes across the range, plus one past each end. The grid must hold 3 to 60 strikes.
targetPrice*number
Price you expect at expiry (the mean of your view), from 0.000000001 to 1000000000
workflow.run_window_fair_valueTheoretical fair value for a time-windowed crypto up/down contract (the shape ADI Predictstreet and Kalshi-style daily crypto markets use: pays out based on whether the settlement price finishes at/above or below a reference price pinned at window open, by a fixed close time):...5 params

Theoretical fair value for a time-windowed crypto up/down contract (the shape ADI Predictstreet and Kalshi-style daily crypto markets use: pays out based on whether the settlement price finishes at/above or below a reference price pinned at window open, by a fixed close time):...

Parameters* required
currentPrice*number
Current spot price of the coin, in USD.
minutesToClose*number
Minutes remaining until the window closes/settles.
referencePrice*number
The reference/pinned price the contract resolves against (the window's open price, or a stated strike).
riskFreeRatePctnumber
Risk-free rate in percentage points. Default 0: negligible for these short windows.
volatilityPct*number
Annualized volatility, in percentage points (e.g. 50 for 50%). Required; no live source for this on these contracts.
workflow.run_forex_pip_valueValue of 1 pip for a given forex pair and position size, in that pair's own quote currency (e.g. EUR/USD's pip value comes back in USD, USD/JPY's in JPY): no live FX rate needed, since a pair's pip value is naturally denominated in its own quote currency. Pip size is 0.0001 fo...2 params

Value of 1 pip for a given forex pair and position size, in that pair's own quote currency (e.g. EUR/USD's pip value comes back in USD, USD/JPY's in JPY): no live FX rate needed, since a pair's pip value is naturally denominated in its own quote currency. Pip size is 0.0001 fo...

Parameters* required
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
units*number
Position size in base-currency units (1 standard lot = 100,000, mini = 10,000, micro = 1,000, nano = 100)
workflow.run_forex_margin_levelFree margin and margin level % from account equity and used margin: equity/usedMargin*100, the same stop-out proximity metric every forex platform shows. Returns null (not Infinity) when usedMargin is 0, meaning no open position. Edge cases: equity above zero, usedMargin zero...2 params

Free margin and margin level % from account equity and used margin: equity/usedMargin*100, the same stop-out proximity metric every forex platform shows. Returns null (not Infinity) when usedMargin is 0, meaning no open position. Edge cases: equity above zero, usedMargin zero...

Parameters* required
equity*number
Account equity (balance + floating P&L)
usedMargin*number
Margin currently locked by open positions. 0 if none.
workflow.run_forex_breakevenBreakeven price for a forex position accounting for spread and round-trip commission, in pips and in price. Commission is quoted per standard lot (100,000 units) and expressed in the pair's own quote currency; because both commission and pip value scale with lot size, the comm...5 params

Breakeven price for a forex position accounting for spread and round-trip commission, in pips and in price. Commission is quoted per standard lot (100,000 units) and expressed in the pair's own quote currency; because both commission and pip value scale with lot size, the comm...

Parameters* required
commissionPerLotRoundTripnumber
Round-trip commission per standard lot, in the pair's own quote currency. Default 0 (pure-spread broker model).
entryPrice*number
Entry price in the pair's own quote terms, e.g. 1.0850 for EUR/USD
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
side*string
Trade direction: "long" or "short"one of long · short
spreadPips*number
Spread at entry, in pips
workflow.run_forex_pnlProfit or loss for a closed or hypothetical forex trade, in pips and in the pair's own quote currency, long or short. Precious-metal pairs (XAU, XAG, XPT, XPD) are refused with an error, because their pip and lot size differ by broker. Edge cases: entryPrice, exitPrice and uni...5 params

Profit or loss for a closed or hypothetical forex trade, in pips and in the pair's own quote currency, long or short. Precious-metal pairs (XAU, XAG, XPT, XPD) are refused with an error, because their pip and lot size differ by broker. Edge cases: entryPrice, exitPrice and uni...

Parameters* required
entryPrice*number
Entry price in the pair's own quote terms, e.g. 1.0850 for EUR/USD
exitPrice*number
Exit price, same quote convention as the entry price
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
side*string
Trade direction: "long" or "short"one of long · short
units*number
Position size in base-currency units
workflow.run_forex_risk_rewardRisk and reward distance in pips from entry/stop/target, and the resulting ratio (reward/risk): a raw number, not a verdict. ratio is null when the stop sits exactly at entry (no risk distance), and also when validSetup is false (stop/target on the wrong side of entry for the...5 params

Risk and reward distance in pips from entry/stop/target, and the resulting ratio (reward/risk): a raw number, not a verdict. ratio is null when the stop sits exactly at entry (no risk distance), and also when validSetup is false (stop/target on the wrong side of entry for the...

Parameters* required
entryPrice*number
Entry price in the pair's own quote terms, e.g. 1.0850 for EUR/USD
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
side*string
Trade direction: "long" or "short"one of long · short
stopPrice*number
Stop-loss price, same quote convention as the entry price
targetPrice*number
Take-profit price, same quote convention as the entry price
workflow.run_forex_scenarioPnL across a range of hypothetical price moves (in pips, signed by actual price direction, not pre-adjusted for side), for a single forex position size, long or short. Precious-metal pairs (XAU, XAG, XPT, XPD) are refused with an error, because their pip and lot size differ by...5 params

PnL across a range of hypothetical price moves (in pips, signed by actual price direction, not pre-adjusted for side), for a single forex position size, long or short. Precious-metal pairs (XAU, XAG, XPT, XPD) are refused with an error, because their pip and lot size differ by...

Parameters* required
deltasPips*array
Hypothetical price moves in pips, e.g. [-50, 0, 50]
entryPrice*number
Entry price in the pair's own quote terms, e.g. 1.0850 for EUR/USD
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
side*string
Trade direction: "long" or "short"one of long · short
units*number
Position size in base-currency units
workflow.run_fibonacci_levelsFibonacci retracement and extension price levels from a swing high and low, for any asset (forex, stocks, crypto): retracement 0, 23.6, 38.2, 50, 61.8, 78.6 and 100 percent and extension 127.2, 161.8, 200 and 261.8 percent, as prices. direction "up" measures a rise from the lo...3 params

Fibonacci retracement and extension price levels from a swing high and low, for any asset (forex, stocks, crypto): retracement 0, 23.6, 38.2, 50, 61.8, 78.6 and 100 percent and extension 127.2, 161.8, 200 and 261.8 percent, as prices. direction "up" measures a rise from the lo...

Parameters* required
direction*string
"up": the swing rose from the low to the high; "down": it fell from the high to the lowone of up · down
high*number
Swing high price (positive, above the low, at most 1e300)
low*number
Swing low price (positive, below the high)
workflow.run_forex_average_entrySize-weighted (arithmetic) average entry price across multiple forex fills. Edge cases: at least 1 fill; every price and units above zero; pair is BASE/QUOTE with two different ISO 4217 codes (a metal such as XAU/USD is accepted here because no pip is needed). The average is w...2 params

Size-weighted (arithmetic) average entry price across multiple forex fills. Edge cases: at least 1 fill; every price and units above zero; pair is BASE/QUOTE with two different ISO 4217 codes (a metal such as XAU/USD is accepted here because no pip is needed). The average is w...

Parameters* required
fills*array
Fills to average, each with a price and a size in base-currency units
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
workflow.run_forex_margin_requiredNotional and margin required for a forex position, in the pair's own quote currency: no live FX rate needed. The live variant is workflow.run_forex_margin_required_live, which applies when the account currency differs from the pair's quote currency. Edge cases: units, price an...4 params

Notional and margin required for a forex position, in the pair's own quote currency: no live FX rate needed. The live variant is workflow.run_forex_margin_required_live, which applies when the account currency differs from the pair's quote currency. Edge cases: units, price an...

Parameters* required
leverage*number
Leverage multiplier, e.g. 50 for 50:1
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
price*number
Entry or current price
units*number
Position size in base-currency units
workflow.run_forex_currency_converterConverts an amount between currencies using a manually supplied rate: no live data fetch. The live variant is workflow.run_forex_currency_converter_live, which has the rate fetched automatically. Edge cases: rate above zero; amount may be zero or negative (it is converted as g...2 params

Converts an amount between currencies using a manually supplied rate: no live data fetch. The live variant is workflow.run_forex_currency_converter_live, which has the rate fetched automatically. Edge cases: rate above zero; amount may be zero or negative (it is converted as g...

Parameters* required
amount*number
Amount in the source currency
rate*number
Exchange rate to apply (1 unit of source currency = rate units of target currency)
workflow.run_forex_swap_costTotal swap/rollover cost (or credit) for holding a forex position overnight, in the pair's own quote currency: no live FX rate needed. Swap rates are broker-set with no free live feed available, so swapPerLotPerNight is always a manual input (quoted per standard lot, matching...4 params

Total swap/rollover cost (or credit) for holding a forex position overnight, in the pair's own quote currency: no live FX rate needed. Swap rates are broker-set with no free live feed available, so swapPerLotPerNight is always a manual input (quoted per standard lot, matching...

Parameters* required
nights*integer
Number of nights the position is held
pair*string
Currency pair in BASE/QUOTE format, e.g. "EUR/USD"
swapPerLotPerNight*number
Swap rate per standard lot (100,000 units) per night, in the pair's quote currency. Negative = cost, positive = credit. Broker-set: get this from the user's broker platform, there is no live source...
units*number
Position size in base-currency units
workflow.run_forex_correlationCorrelation coefficient and minimum-variance hedge ratio between two price series of matching length, computed on daily % returns (not raw price levels, which would give spuriously high correlation between two unrelated but both-trending series). hedgeRatio follows Hull's stan...2 params

Correlation coefficient and minimum-variance hedge ratio between two price series of matching length, computed on daily % returns (not raw price levels, which would give spuriously high correlation between two unrelated but both-trending series). hedgeRatio follows Hull's stan...

Parameters* required
rates1*array
First price series, chronological order, one price per date
rates2*array
Second price series, chronological order, same length and same dates as rates1
workflow.run_var_cvarParametric Value at Risk (VaR) and Conditional VaR / Expected Shortfall (CVaR), the variance-covariance method (assumes normally distributed returns), plus Modified VaR (Cornish-Fisher skew/kurtosis correction, Boudt/Peterson/Croux) when a return series is supplied. Supply eit...4 params

Parametric Value at Risk (VaR) and Conditional VaR / Expected Shortfall (CVaR), the variance-covariance method (assumes normally distributed returns), plus Modified VaR (Cornish-Fisher skew/kurtosis correction, Boudt/Peterson/Croux) when a return series is supplied. Supply eit...

Parameters* required
confidencenumber
Confidence level, 0-1 exclusive (default 0.95)
meannumber
Mean return, if not supplying returns[] directly
returnsarray
Return series (e.g. daily % returns as decimals). Provide this OR mean+stdev, not both.
stdevnumber
Standard deviation of returns, if not supplying returns[] directly
workflow.run_sharpe_statsSharpe ratio with the Lo (2002) serial-correlation-aware annualization correction, computed in its lag-1 form rather than the full multi-lag sum (the naive sqrt(periods_per_year) scaling overstates or understates the true annualized Sharpe when returns are autocorrelated), plu...3 params

Sharpe ratio with the Lo (2002) serial-correlation-aware annualization correction, computed in its lag-1 form rather than the full multi-lag sum (the naive sqrt(periods_per_year) scaling overstates or understates the true annualized Sharpe when returns are autocorrelated), plu...

Parameters* required
benchmark_sharpenumber
Benchmark Sharpe ratio for the PSR test, same periodicity as returns (default 0)
periods_per_yearnumber
Periods per year for annualization (default 365, crypto convention - trades every day). Any number from 1 to 100 million, e.g. 365.25.
returns*array
Return series, one value per period
workflow.run_hurst_exponentHurst exponent via rescaled-range (R/S) analysis: is this return/price series trending/persistent (H>0.5, a move tends to be followed by a move in the same direction), mean-reverting/anti-persistent (H<0.5), or consistent with a random walk (H~0.5)? Edge cases: at least 32 val...2 params

Hurst exponent via rescaled-range (R/S) analysis: is this return/price series trending/persistent (H>0.5, a move tends to be followed by a move in the same direction), mean-reverting/anti-persistent (H<0.5), or consistent with a random walk (H~0.5)? Edge cases: at least 32 val...

Parameters* required
min_windownumber
Smallest R/S analysis window size (default 8)
values*array
Return series (not raw price levels)
workflow.run_cointegrationEngle-Granger two-step cointegration test for a pair of price series: do they share a long-run equilibrium relationship (their spread is stationary/mean-reverting)? The standard pairs-trading signal test. Returns the cointegrating regression's hedge ratio (beta) and an ADF t-s...2 params

Engle-Granger two-step cointegration test for a pair of price series: do they share a long-run equilibrium relationship (their spread is stationary/mean-reverting)? The standard pairs-trading signal test. Returns the cointegrating regression's hedge ratio (beta) and an ADF t-s...

Parameters* required
x*array
Second price series, same length and dates as y
y*array
First price series (the dependent variable in the cointegrating regression)
workflow.run_portfolio_tearsheetCore risk/return tearsheet from a single return series: annualized return (compounded, not linear) and volatility, Sharpe (plain + Lo 2002-corrected + Pezier-White skew/kurtosis-adjusted), Sortino, max drawdown, Calmar ratio, the drawdown-ratio cluster (Ulcer Index/Martin rati...4 params

Core risk/return tearsheet from a single return series: annualized return (compounded, not linear) and volatility, Sharpe (plain + Lo 2002-corrected + Pezier-White skew/kurtosis-adjusted), Sortino, max drawdown, Calmar ratio, the drawdown-ratio cluster (Ulcer Index/Martin rati...

Parameters* required
benchmark_sharpenumber
Benchmark Sharpe ratio for the PSR figure, same periodicity as returns (default 0)
marnumber
Minimum acceptable return for the Sortino ratio, same periodicity as returns (default 0)
periods_per_yearnumber
Periods per year for annualization (default 365). Any number from 1 to 100 million, e.g. 365.25.
returns*array
Return series, one value per period
workflow.run_garchGARCH(1,1) volatility model, fit by maximum likelihood on a return series: estimates omega/alpha/beta (the variance-persistence parameters) and forecasts next-period volatility. Edge cases: at least 50 returns; a flat series is an error; non-finite values are refused. Output i...1 params

GARCH(1,1) volatility model, fit by maximum likelihood on a return series: estimates omega/alpha/beta (the variance-persistence parameters) and forecasts next-period volatility. Edge cases: at least 50 returns; a flat series is an error; non-finite values are refused. Output i...

Parameters* required
returns*array
Return series, one value per period, at least 50 values (GARCH needs real sample depth to identify persistence)
workflow.run_risk_parityRisk-parity (equal or custom risk contribution) portfolio weights for N assets: given a covariance matrix (or N return series to compute one from), finds long-only weights where each asset contributes its target share of total portfolio risk. Edge cases: give either returns (a...3 params

Risk-parity (equal or custom risk contribution) portfolio weights for N assets: given a covariance matrix (or N return series to compute one from), finds long-only weights where each asset contributes its target share of total portfolio risk. Edge cases: give either returns (a...

Parameters* required
covariancearray
Direct NxN covariance matrix, if not supplying returns[][] directly.
returnsarray
One return series per asset (2+ assets, all series the same length). Provide this OR covariance, not both.
risk_budgetsarray
Target risk share per asset, one per asset (need not sum to 1, normalized internally). Default: equal (1/N each).
workflow.run_dsrDeflated Sharpe Ratio (Bailey & Lopez de Prado): given how many strategy variants you tried (and how correlated they are), what Sharpe ratio would the *best of N* clear by luck alone, and does your actual strategy still clear that higher bar? Edge cases: returns at least 3; gi...5 params

Deflated Sharpe Ratio (Bailey & Lopez de Prado): given how many strategy variants you tried (and how correlated they are), what Sharpe ratio would the *best of N* clear by luck alone, and does your actual strategy still clear that higher bar? Edge cases: returns at least 3; gi...

Parameters* required
avg_correlationnumber
Average pairwise correlation between trials, 0-1 (default 0 = independent). Only used with n_trials; lowers the effective trial count via Kish's design effect.
n_trialsnumber
Number of strategy variants tried, if trial_sharpes were not tracked individually. Assumes trial Sharpes with mean 0 and variance 1 (per-period units): too strict for daily series, prefer trial_sha...
null_meanboolean
Only used with trial_sharpes. true = centre the luck threshold on 0 (zero-skill null) instead of on the trials' own mean Sharpe; the spread still comes from the trials. Default false.
returns*array
The candidate strategy's own return series
trial_sharpesarray
Observed Sharpe ratios of all N trials tried, if tracked. Takes priority over n_trials if both are given.
workflow.run_kelly_frontierKelly growth-security frontier (MacLean, Ziemba & Blazenko 1992): for a strategy compounding at a fraction lambda of full Kelly, the probability wealth ever falls to a fraction alpha of its starting value is P = alpha^(2/lambda-1). Provide either lambda_fraction (to compute th...3 params

Kelly growth-security frontier (MacLean, Ziemba & Blazenko 1992): for a strategy compounding at a fraction lambda of full Kelly, the probability wealth ever falls to a fraction alpha of its starting value is P = alpha^(2/lambda-1). Provide either lambda_fraction (to compute th...

Parameters* required
alpha*number
Fraction of starting capital, 0-1 exclusive (e.g. 0.5 = "ever falls to half my starting bankroll")
lambda_fractionnumber
Fraction of full Kelly being bet (1 = full Kelly, 0.5 = half Kelly). Provide this OR max_probability, not both.
max_probabilitynumber
Target ceiling on the ruin probability, 0-1 exclusive. Provide this to solve for the safe lambda_fraction instead of supplying it directly.
workflow.run_unsmoothingReturn "unsmoothing" for infrequently-marked/illiquid or appraisal-based series: Getmansky-Lo-Makarov (2004) MA(2) smoothing index plus Blundell-Ward (1987) AR(1) volatility inflation, two complementary models answering "this return series looks smoother than it really is; wha...1 params

Return "unsmoothing" for infrequently-marked/illiquid or appraisal-based series: Getmansky-Lo-Makarov (2004) MA(2) smoothing index plus Blundell-Ward (1987) AR(1) volatility inflation, two complementary models answering "this return series looks smoother than it really is; wha...

Parameters* required
returns*array
The observed (possibly smoothed) return series, at least 20 values
workflow.run_evt_tail_riskExtreme Value Theory tail risk (Peaks-Over-Threshold): fits a Generalized Pareto Distribution to the losses beyond a high threshold via Grimshaw's (1993) profile-likelihood MLE, then extrapolates VaR/Expected Shortfall at the requested confidence, without assuming a normal dis...3 params

Extreme Value Theory tail risk (Peaks-Over-Threshold): fits a Generalized Pareto Distribution to the losses beyond a high threshold via Grimshaw's (1993) profile-likelihood MLE, then extrapolates VaR/Expected Shortfall at the requested confidence, without assuming a normal dis...

Parameters* required
confidencenumber
VaR/ES confidence level, 0-1 exclusive. Default 0.99. Must satisfy 1-confidence < the threshold's own exceedance rate.
returns*array
Return series, one value per period, at least 100 values (POT needs real sample depth in the tail)
threshold_percentilenumber
Percentile (0-100 exclusive) of the loss distribution used as the POT threshold u. Default 90.
workflow.run_monte_carloMonte Carlo simulation of a portfolio: geometric Brownian motion with a contribution (or withdrawal) at the end of every step, up to 10,000 paths (paths x steps at most 5 million), deterministic for a given seed. Returns the spread of final values (percentiles 5 to 95, mean wi...9 params

Monte Carlo simulation of a portfolio: geometric Brownian motion with a contribution (or withdrawal) at the end of every step, up to 10,000 paths (paths x steps at most 5 million), deterministic for a given seed. Returns the spread of final values (percentiles 5 to 95, mean wi...

Parameters* required
annualReturnPct*number
Expected growth mu in percentage points per year, -100 to 500.
contributionPerStepnumber
Added at the END of every step; negative is a withdrawal. Default 0.
initialValue*number
Starting value, 0 to 1e12. 0 is allowed only with a positive contribution.
pathsinteger
Simulated paths, 100 to 10000 (paths x steps at most 5 million). Default 2000.
ruinBelownumber
A path counts as ruined once it ends a step at or below this value. Default 0.
seedinteger
Random seed, 0 to 4294967295; the same input and seed give the same result. Default 1.
stepsPerYearinteger
Steps (and contributions) per year, 1 to 365. Default 12.
volatilityPct*number
Annual volatility sigma in percentage points, 0 to 500.
years*number
Horizon in years, above 0 and at most 50. years x stepsPerYear must be a whole number.
workflow.run_event_studyEvent study with a placebo: is the average return after your events (a listing, an unlock, a signal firing) different from the average return of the same window started on random non-event dates? Give event_returns and placebo_returns in the same units; optional event_tickers...7 params

Event study with a placebo: is the average return after your events (a listing, an unlock, a signal firing) different from the average return of the same window started on random non-event dates? Give event_returns and placebo_returns in the same units; optional event_tickers...

Parameters* required
alphanumber
Significance level for the verdict, above 0 and below 0.5. Default 0.05.
event_returns*array
One return per event over the event window, any consistent unit (percent or fraction). 2 to 5000 values.
event_tickersarray
Optional, one ticker per event return, used to cluster. Omitted: every event is its own cluster.
n_permutationsinteger
Random shuffles when the exact test is too large, 1000 to 100000. Default 10000.
placebo_returns*array
Returns over a window of the same length started on random dates without an event. 2 to 5000 values; event and placebo together at most 5000.
placebo_tickersarray
Optional, one ticker per placebo return. Omitted: every placebo is its own cluster.
seedinteger
Seed for the shuffles, 0 to 4294967295; same input and seed give the same result. Default 1.
workflow.run_orderbook_impactOrder-book "walk the book" impact/capacity: given order-book levels (price, size in base-asset units) and EITHER a target notional or an impact budget in bps, computes VWAP and price impact for that size, or (via bisection) the largest notional that stays inside the impact bud...5 params

Order-book "walk the book" impact/capacity: given order-book levels (price, size in base-asset units) and EITHER a target notional or an impact budget in bps, computes VWAP and price impact for that size, or (via bisection) the largest notional that stays inside the impact bud...

Parameters* required
asks*array
Ask levels as [price, size_base] pairs, any order
bids*array
Bid levels as [price, size_base] pairs, any order
impact_budget_bpsnumber
Max acceptable impact in bps; solves for the largest notional within it. Provide this OR notional_usd, not both.
notional_usdnumber
Target notional to walk the book for. Provide this OR impact_budget_bps, not both.
side*string
"buy" walks the asks, "sell" walks the bidsone of buy · sell
workflow.run_open_analysisMarket Profile open analysis: where and how price opened vs the prior session value area. Use for "how did BTC open today?" / "what does the open imply for the session?". Returns: open_location, open_type (OD/OTD/ORR/OAIR) with description/implication, confidence, key_levels (...7 params

Market Profile open analysis: where and how price opened vs the prior session value area. Use for "how did BTC open today?" / "what does the open imply for the session?". Returns: open_location, open_type (OD/OTD/ORR/OAIR) with description/implication, confidence, key_levels (...

Parameters* required
candlesarray
Optional OHLCV for the session; omit to fetch from venue (reproducible + 0 COGS when supplied)
instrument*string
Symbol, e.g. BTCUSDT
prev_candlesarray
Optional OHLCV for the previous session
session_date*string
Session date YYYY-MM-DD (UTC); must be before today (a completed session)
timeframestring
Candle timeframe (default 15m)one of 1m · 5m · 15m · 30m
value_area_rulenumber
Value-area fraction 0.5–0.9 (default 0.70)
venue*string
Exchange to fetch candles from when candles[] not suppliedone of binance · bybit
workflow.run_session_structureMarket Profile day-type classifier: trend / balance / neutral_trend / normal / normal_var, from TPO, initial balance, range extension and value migration. Use for "is this a trend day or a balance day?". Returns: structure (the day-type label), description, bias, key_signals,...7 params

Market Profile day-type classifier: trend / balance / neutral_trend / normal / normal_var, from TPO, initial balance, range extension and value migration. Use for "is this a trend day or a balance day?". Returns: structure (the day-type label), description, bias, key_signals,...

Parameters* required
candlesarray
Optional OHLCV for the session; omit to fetch from venue (reproducible + 0 COGS when supplied)
instrument*string
Symbol, e.g. BTCUSDT
prev_candlesarray
Optional OHLCV for the previous session
session_date*string
Session date YYYY-MM-DD (UTC); must be before today (a completed session)
timeframestring
Candle timeframe (default 15m)one of 1m · 5m · 15m · 30m
value_area_rulenumber
Value-area fraction 0.5–0.9 (default 0.70)
venue*string
Exchange to fetch candles from when candles[] not suppliedone of binance · bybit
workflow.run_value_migrationMarket Profile value-area migration across sessions: is value migrating up, down, or overlapping (directional conviction vs balance)? Use for "is value moving higher day over day?". Returns: state, direction, migration_pct, key_levels (current vs. prior session VAH/VAL/VPOC),...8 params

Market Profile value-area migration across sessions: is value migrating up, down, or overlapping (directional conviction vs balance)? Use for "is value moving higher day over day?". Returns: state, direction, migration_pct, key_levels (current vs. prior session VAH/VAL/VPOC),...

Parameters* required
candlesarray
Optional OHLCV for the session; omit to fetch from venue (reproducible + 0 COGS when supplied)
instrument*string
Symbol, e.g. BTCUSDT
lookback_sessionsnumber
Sessions to compare, 1–5 (default 1)
prev_candlesarray
Optional OHLCV for the previous session
session_date*string
Session date YYYY-MM-DD (UTC); must be before today (a completed session)
timeframestring
Candle timeframe (default 15m)one of 1m · 5m · 15m · 30m
value_area_rulenumber
Value-area fraction 0.5–0.9 (default 0.70)
venue*string
Exchange to fetch candles from when candles[] not suppliedone of binance · bybit
workflow.run_breakout_acceptanceMarket Profile breakout acceptance: did price accept (hold) beyond the value area / range, or reject back inside (fakeout)? Optional buy/sell delta. Use for "did the break above VAH get accepted?". Returns: state, accepted (boolean), direction, confidence, key_levels (VAH/VAL/...8 params

Market Profile breakout acceptance: did price accept (hold) beyond the value area / range, or reject back inside (fakeout)? Optional buy/sell delta. Use for "did the break above VAH get accepted?". Returns: state, accepted (boolean), direction, confidence, key_levels (VAH/VAL/...

Parameters* required
candlesarray
Optional OHLCV for the session; omit to fetch from venue (reproducible + 0 COGS when supplied)
include_deltaboolean
Include buy/sell delta analysis (default true)
instrument*string
Symbol, e.g. BTCUSDT
prev_candlesarray
Optional OHLCV for the previous session
session_date*string
Session date YYYY-MM-DD (UTC); must be before today (a completed session)
timeframestring
Candle timeframe (default 15m)one of 1m · 5m · 15m · 30m
value_area_rulenumber
Value-area fraction 0.5–0.9 (default 0.70)
venue*string
Exchange to fetch candles from when candles[] not suppliedone of binance · bybit
workflow.run_token_risk_checkToken rug-pull MECHANISM check for a Solana token (mint address): can the deployer still mint supply, freeze wallets, pull liquidity, swap metadata, or has RugCheck flagged a known scam pattern (e.g. copycat token)? Fetches live facts from RugCheck (GoPlus as fallback) and ret...1 params

Token rug-pull MECHANISM check for a Solana token (mint address): can the deployer still mint supply, freeze wallets, pull liquidity, swap metadata, or has RugCheck flagged a known scam pattern (e.g. copycat token)? Fetches live facts from RugCheck (GoPlus as fallback) and ret...

Parameters* required
mint*string
Solana token mint address (base58)
workflow.run_swap_price_impactLive price-impact quote for a Solana token swap: routed through Jupiter (the same aggregator real swaps use) across every pool it knows about, not a single-pool estimate. Works in both directions: side "sell" (default) sells a token into USDC or SOL, side "buy" spends USDC or...4 params

Live price-impact quote for a Solana token swap: routed through Jupiter (the same aggregator real swaps use) across every pool it knows about, not a single-pool estimate. Works in both directions: side "sell" (default) sells a token into USDC or SOL, side "buy" spends USDC or...

Parameters* required
amount*number
Amount to swap, in human units (not raw base units): tokens when side is sell, units of outputAsset to spend when side is buy
mint*string
Solana mint address of the token being sold or bought (base58)
outputAssetstring
The quote asset: received when selling, paid with when buying. Default USDC.one of USDC · SOL
sidestring
sell: sell the token for outputAsset (default). buy: spend outputAsset to buy the token.one of sell · buy
workflow.run_market_cap_comparisonCompares two tokens' live market caps (Solana or any of 5 EVM chains; the two tokens can be on different chains) and projects what an investment would be worth if the first token's market cap matched the second's. Narrative-agnostic ("if X reaches Y's market cap"): works for a...5 params

Compares two tokens' live market caps (Solana or any of 5 EVM chains; the two tokens can be on different chains) and projects what an investment would be worth if the first token's market cap matched the second's. Narrative-agnostic ("if X reaches Y's market cap"): works for a...

Parameters* required
compareToChainstring
Chain of the comparison token. Default solana. Can differ from tokenChain.one of solana · ethereum · base · bsc · arbitrum · polygon
compareToMint*string
Address of the token whose market cap to compare against
investmentUsd*number
Investment amount in USD
tokenChainstring
Chain of the token you hold. Default solana.one of solana · ethereum · base · bsc · arbitrum · polygon
tokenMint*string
Address of the token you hold or are evaluating (base58 for Solana, 0x... for EVM chains)
workflow.run_impermanent_loss_liveLive variant of workflow.run_impermanent_loss: fetches each token's current live USD price (Solana or any of 5 EVM chains) and derives currentPrice as their ratio, instead of it being supplied manually. entryPrice stays a manual, historical input (a fact the caller must supply...10 params

Live variant of workflow.run_impermanent_loss: fetches each token's current live USD price (Solana or any of 5 EVM chains) and derives currentPrice as their ratio, instead of it being supplied manually. entryPrice stays a manual, historical input (a fact the caller must supply...

Parameters* required
baseChainstring
Chain of the base (volatile) token. Default solana.one of solana · ethereum · base · bsc · arbitrum · polygon
baseMint*string
Address of the base token
depositValueUsdnumber
Optional: USD value deposited at entry
entryPrice*number
Base token's price in quote-token terms when liquidity was deposited (manual - a historical fact)
feesEarnedUsdnumber
Optional trading fees earned so far in USD (default 0)
lowerPricenumber
Range lower bound - required for concentrated mode
modestring
Default full_range.one of full_range · concentrated
quoteChainstring
Chain of the quote token. Default solana.one of solana · ethereum · base · bsc · arbitrum · polygon
quoteMint*string
Address of the quote token
upperPricenumber
Range upper bound - required for concentrated mode

Sponsors

Readme

TradingCalc MCP Server

npm License: MIT Verified vectors Remote MCP MCP Badge mcptry

An LLM guesses trading maths. This server computes it: the same inputs always return the same numbers, every result carries a signature you can check, and the core formulas are tested against public vectors (live count in the badge above).


View the full README on GitHub

Details

Repository
github.com/skalinin909/tradingcalc-mcp
Website
tradingcalc.io
Transport
HTTP
Registry
MCP registry, active
Tools verified
Nov 6, 2026