{
  "about": "ForexDemo.com trading calculators. Every calculator on the site can be used by address: open /api/calculators/<id> with the inputs added as name=value pairs. The answer comes back as JSON with a one-paragraph plain-English answer, every figure, the inputs used and any assumption made. The calculations are the same ones the calculator pages run. Nothing is stored and no live prices are fetched: give your own prices for exact answers.",
  "usage": "https://forexdemo.com/api/calculators/<id>?<input>=<value>&<input>=<value>",
  "guide": "https://forexdemo.com/agent-guide.html#calculators",
  "openapi": "https://forexdemo.com/openapi.json",
  "calculators": [
    {
      "id": "pip",
      "title": "Pip Calculator",
      "page": "https://forexdemo.com/pip-calculator.html",
      "description": "What one pip is worth in the account currency for a Forex pair or gold at a given trade size, and optionally the profit or loss of a move in pips.",
      "example": "https://forexdemo.com/api/calculators/pip?pair=USDJPY&size=1&sizeUnit=standard&currency=USD",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF",
            "XAU/USD"
          ],
          "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "standard",
            "mini",
            "micro",
            "nano",
            "units"
          ],
          "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
          "default": "standard"
        },
        "size": {
          "type": "number",
          "description": "Trade size, counted in sizeUnit.",
          "default": 1
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Leave it out to use the example price shown on the page."
        },
        "pipsMoved": {
          "type": "number",
          "description": "Optional price move to value. Negative for a loss."
        },
        "moveUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points",
            "dollars"
          ],
          "description": "Unit of pipsMoved: pips, points (MetaTrader, 10 points = 1 pip) or, for gold only, dollars an ounce.",
          "default": "pips"
        },
        "goldPip": {
          "type": "string",
          "enum": [
            "0.01",
            "0.10"
          ],
          "description": "Gold only: the price change your broker calls one pip.",
          "default": "0.01"
        }
      }
    },
    {
      "id": "position-size",
      "title": "Position Size Calculator",
      "page": "https://forexdemo.com/position-size-calculator.html",
      "description": "How many lots to trade so that hitting the stop-loss loses a set percentage or amount of the account.",
      "example": "https://forexdemo.com/api/calculators/position-size?pair=EURUSD&currency=USD&balance=10000&risk=1&stopPips=30",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF"
          ],
          "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "balance": {
          "type": "number",
          "description": "Account balance in the account currency. Needed when riskMode is percent.",
          "default": 10000
        },
        "riskMode": {
          "type": "string",
          "enum": [
            "percent",
            "money"
          ],
          "description": "percent: risk is a percentage of the balance. money: risk is an amount in the account currency.",
          "default": "percent"
        },
        "risk": {
          "type": "number",
          "description": "Risk per trade: a percentage (1 for 1%) or an amount, per riskMode.",
          "default": 1
        },
        "stopMode": {
          "type": "string",
          "enum": [
            "pips",
            "prices"
          ],
          "description": "pips: give the stop distance in stopPips. prices: give the entry and stop prices.",
          "default": "pips"
        },
        "stopPips": {
          "type": "number",
          "description": "Stop-loss distance (stopMode pips).",
          "default": 50
        },
        "stopUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points"
          ],
          "description": "Unit of stopPips: pips or points (10 points = 1 pip).",
          "default": "pips"
        },
        "entry": {
          "type": "number",
          "description": "Entry price (stopMode prices)."
        },
        "stop": {
          "type": "number",
          "description": "Stop-loss price (stopMode prices)."
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "price": {
          "type": "number",
          "description": "Optional pair price, for the position value. Leave it out to use the example price."
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when the account currency is not in the pair."
        },
        "spread": {
          "type": "number",
          "description": "Optional spread to add to the stop distance, in costUnit (buys only, as on the page)."
        },
        "slippage": {
          "type": "number",
          "description": "Optional stop slippage allowance, in costUnit."
        },
        "costUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points"
          ],
          "description": "Unit of spread and slippage.",
          "default": "pips"
        },
        "commission": {
          "type": "number",
          "description": "Optional commission per standard lot, in the account currency."
        },
        "commissionBasis": {
          "type": "string",
          "enum": [
            "side",
            "round"
          ],
          "description": "side: charged when opening and again when closing. round: once per round trip.",
          "default": "side"
        },
        "lotStep": {
          "type": "string",
          "enum": [
            "1",
            "0.1",
            "0.01",
            "0.001",
            "units"
          ],
          "description": "The smallest size step your broker allows.",
          "default": "0.01"
        }
      }
    },
    {
      "id": "profit",
      "title": "Forex Profit Calculator",
      "page": "https://forexdemo.com/forex-profit-calculator.html",
      "description": "Profit or loss of one Forex or gold trade from its open and close prices, in pips and in the account currency, before and after spread, commission and swap.",
      "example": "https://forexdemo.com/api/calculators/profit?pair=EURUSD&side=buy&size=1&open=1.1150&close=1.1200&currency=USD",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF",
            "XAU/USD"
          ],
          "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "standard",
            "mini",
            "micro",
            "nano",
            "units"
          ],
          "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
          "default": "standard"
        },
        "size": {
          "type": "number",
          "description": "Trade size, counted in sizeUnit.",
          "default": 1
        },
        "open": {
          "type": "number",
          "description": "Open price.",
          "required": true
        },
        "close": {
          "type": "number",
          "description": "Close price, or the price you expect.",
          "required": true
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when neither currency of the pair is the account currency."
        },
        "spread": {
          "type": "number",
          "description": "Optional spread, in spreadUnit."
        },
        "spreadUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points"
          ],
          "description": "Unit of spread: pips, or points as MetaTrader shows it.",
          "default": "pips"
        },
        "commission": {
          "type": "number",
          "description": "Optional commission per standard lot, in the account currency."
        },
        "commissionBasis": {
          "type": "string",
          "enum": [
            "side",
            "round"
          ],
          "description": "side: charged when opening and again when closing. round: once per round trip.",
          "default": "side"
        },
        "swap": {
          "type": "string",
          "description": "Optional overnight swap for all nights held, in the account currency. A charge has a minus sign, such as -12.50."
        },
        "balance": {
          "type": "number",
          "description": "Optional account balance, to show the result as a percentage."
        },
        "stop": {
          "type": "number",
          "description": "Optional stop-loss price."
        },
        "target": {
          "type": "number",
          "description": "Optional take-profit price."
        }
      }
    },
    {
      "id": "compounding",
      "title": "Forex Compounding Calculator",
      "page": "https://forexdemo.com/forex-compounding-calculator.html",
      "description": "How an account grows when the same percentage gain is made every trade, day, week, month or year, with optional deposits, withdrawals and losing periods.",
      "example": "https://forexdemo.com/api/calculators/compounding?balance=10000&gain=3&period=month&periods=24",
      "inputs": {
        "balance": {
          "type": "number",
          "description": "Starting balance.",
          "default": 10000
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "gain": {
          "type": "number",
          "description": "Gain per period in percent. Negative for a loss. Give 2 for 2%.",
          "default": 2
        },
        "period": {
          "type": "string",
          "enum": [
            "trade",
            "day",
            "week",
            "month",
            "year"
          ],
          "description": "How often the gain is made.",
          "default": "month"
        },
        "periods": {
          "type": "number",
          "description": "Number of periods.",
          "default": 12
        },
        "target": {
          "type": "number",
          "description": "Optional target balance."
        },
        "flowType": {
          "type": "string",
          "enum": [
            "none",
            "deposit",
            "withdraw",
            "share"
          ],
          "description": "Optional regular money in or out: deposit, withdraw (an amount) or share (a percentage of the profit).",
          "default": "none"
        },
        "flow": {
          "type": "number",
          "description": "Amount (or percentage for share) of each deposit or withdrawal."
        },
        "flowEvery": {
          "type": "string",
          "description": "How many periods between deposits or withdrawals. Defaults to about once a month."
        },
        "lossCount": {
          "type": "number",
          "description": "Not for period trade: how many losing periods in each group of lossEvery."
        },
        "lossEvery": {
          "type": "number",
          "description": "Not for period trade: the size of the group, such as 1 loss every 4 months."
        },
        "winRate": {
          "type": "number",
          "description": "Only for period trade: the share of trades that win. Give 2 for 2%."
        },
        "lossPercent": {
          "type": "number",
          "description": "The percentage lost in each losing period or losing trade. Give 2 for 2%."
        }
      }
    },
    {
      "id": "margin",
      "title": "Margin and Leverage Calculator",
      "page": "https://forexdemo.com/forex-margin-calculator.html",
      "description": "Margin needed to open a Forex or gold trade at a given leverage or margin percentage, and, with a balance, the free margin, margin level and the prices of the margin call and stop out.",
      "example": "https://forexdemo.com/api/calculators/margin?pair=EURUSD&size=1&leverage=30&currency=USD",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF",
            "XAU/USD"
          ],
          "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "size": {
          "type": "number",
          "description": "Trade size, counted in sizeUnit.",
          "default": 1
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "standard",
            "mini",
            "micro",
            "nano",
            "units"
          ],
          "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
          "default": "standard"
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "price": {
          "type": "number",
          "description": "Pair price when the trade opens. Leave it out to use the example price."
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Leave it out to use the example price."
        },
        "marginMode": {
          "type": "string",
          "enum": [
            "leverage",
            "percent"
          ],
          "description": "leverage: give leverage. percent: give the margin requirement as a percentage.",
          "default": "leverage"
        },
        "leverage": {
          "type": "string",
          "description": "Leverage, such as 30 or 1:30.",
          "default": "50"
        },
        "marginPercent": {
          "type": "number",
          "description": "Margin requirement in percent (marginMode percent). Give 2 for 2%."
        },
        "balance": {
          "type": "number",
          "description": "Optional account balance, for free margin, margin level and margin call prices."
        },
        "marginCallLevel": {
          "type": "number",
          "description": "Margin call level in percent.",
          "default": 100
        },
        "stopOutLevel": {
          "type": "number",
          "description": "Stop out level in percent.",
          "default": 50
        }
      }
    },
    {
      "id": "drawdown",
      "title": "Forex Drawdown Calculator",
      "page": "https://forexdemo.com/forex-drawdown-calculator.html",
      "description": "What a run of losing trades does to an account, the gain needed to win it back, how likely such a run is, and the chance of reaching a drawdown limit.",
      "example": "https://forexdemo.com/api/calculators/drawdown?balance=10000&risk=1&losses=8",
      "inputs": {
        "balance": {
          "type": "number",
          "description": "Account balance.",
          "default": 10000
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "risk": {
          "type": "number",
          "description": "Risk per trade in percent. Give 2 for 2%.",
          "default": 2
        },
        "riskBase": {
          "type": "string",
          "enum": [
            "current",
            "start"
          ],
          "description": "current: risk is a share of the current balance. start: of the starting balance.",
          "default": "current"
        },
        "losses": {
          "type": "number",
          "description": "Losing trades in a row.",
          "default": 10
        },
        "winRate": {
          "type": "number",
          "description": "Win rate in percent, for the chance of a losing run. Give 2 for 2%.",
          "default": 50
        },
        "reward": {
          "type": "number",
          "description": "Average win as a multiple of the risk, such as 1.5.",
          "default": 1.5
        },
        "trades": {
          "type": "number",
          "description": "Number of trades to look ahead.",
          "default": 100
        },
        "limit": {
          "type": "number",
          "description": "Drawdown limit in percent, such as a prop firm's. Give 2 for 2%.",
          "default": 20
        },
        "limitType": {
          "type": "string",
          "enum": [
            "peak",
            "start",
            "lock"
          ],
          "description": "Where the limit is measured from: peak (highest balance), start (starting balance) or lock (trailing until it locks at the start).",
          "default": "peak"
        }
      }
    },
    {
      "id": "risk-reward",
      "title": "Risk Reward Calculator",
      "page": "https://forexdemo.com/risk-reward-calculator.html",
      "description": "Risk-reward ratio of a trade from its entry, stop-loss and take-profit, the win rate at which trades of that shape break even, and the likely result over many trades.",
      "example": "https://forexdemo.com/api/calculators/risk-reward?pair=EURUSD&entry=1.1150&stop=1.1100&target=1.1250",
      "inputs": {
        "mode": {
          "type": "string",
          "enum": [
            "prices",
            "distance"
          ],
          "description": "prices: give entry, stop and target prices. distance: give stopDistance and targetDistance.",
          "default": "prices"
        },
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF",
            "XAU/USD"
          ],
          "description": "Pair, used for pip size in prices mode. EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "entry": {
          "type": "number",
          "description": "Entry price (mode prices). Leave all three prices out to use the example trade."
        },
        "stop": {
          "type": "number",
          "description": "Stop-loss price (mode prices)."
        },
        "target": {
          "type": "number",
          "description": "Take-profit price (mode prices)."
        },
        "stopDistance": {
          "type": "number",
          "description": "Stop-loss distance (mode distance)."
        },
        "targetDistance": {
          "type": "number",
          "description": "Take-profit distance (mode distance)."
        },
        "distanceUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points",
            "ticks",
            "other"
          ],
          "description": "Unit of the distances (mode distance).",
          "default": "pips"
        },
        "spread": {
          "type": "number",
          "description": "Optional spread, in pips (prices mode) or the distance unit."
        },
        "riskAmount": {
          "type": "number",
          "description": "Optional amount risked per trade, in the account currency."
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "winRate": {
          "type": "number",
          "description": "Win rate in percent, for the result over many trades. Give 2 for 2%.",
          "default": 40
        },
        "trades": {
          "type": "number",
          "description": "Number of trades for the result over many trades.",
          "default": 100
        }
      }
    },
    {
      "id": "account-survival",
      "title": "Account Survival Calculator",
      "page": "https://forexdemo.com/account-survival-calculator.html",
      "description": "The chance that a trading account loses a set share of its money (risk of ruin) within a number of trades, from the win rate, the average win and the risk per trade.",
      "example": "https://forexdemo.com/api/calculators/account-survival?winRate=45&reward=1.5&risk=2&ruin=30&trades=200",
      "inputs": {
        "winRate": {
          "type": "number",
          "description": "Win rate in percent. Give 2 for 2%.",
          "required": true
        },
        "reward": {
          "type": "number",
          "description": "Average win as a multiple of the risk, such as 1.5.",
          "required": true
        },
        "trades": {
          "type": "number",
          "description": "Number of trades to look ahead.",
          "default": 200
        },
        "risk": {
          "type": "number",
          "description": "Risk per trade in percent. Give 2 for 2%.",
          "default": 2
        },
        "riskBase": {
          "type": "string",
          "enum": [
            "current",
            "start"
          ],
          "description": "current: risk is a share of the current balance. start: of the starting balance.",
          "default": "current"
        },
        "ruin": {
          "type": "number",
          "description": "Ruin level: the share of the account lost that counts as ruin. Give 2 for 2%.",
          "default": 30
        },
        "ruinType": {
          "type": "string",
          "enum": [
            "start",
            "peak"
          ],
          "description": "Where the ruin level is measured from: start or peak.",
          "default": "start"
        },
        "target": {
          "type": "number",
          "description": "Optional profit target in percent. Give 2 for 2%."
        }
      }
    },
    {
      "id": "kelly",
      "title": "Kelly Criterion Calculator",
      "page": "https://forexdemo.com/kelly-criterion-calculator.html",
      "description": "The share of an account to risk on each trade that grows it fastest over many trades (the Kelly criterion), half and quarter Kelly, and what a chosen risk gives.",
      "example": "https://forexdemo.com/api/calculators/kelly?winRate=55&reward=1.2",
      "inputs": {
        "winRate": {
          "type": "number",
          "description": "Win rate in percent. Give 2 for 2%.",
          "required": true
        },
        "reward": {
          "type": "number",
          "description": "Average win as a multiple of the average loss, such as 1.5.",
          "required": true
        },
        "trades": {
          "type": "number",
          "description": "Number of trades to look ahead.",
          "default": 200
        },
        "risk": {
          "type": "number",
          "description": "Risk per trade in percent, to compare with Kelly. Give 2 for 2%.",
          "default": 2
        },
        "sample": {
          "type": "number",
          "description": "Optional: how many past trades the win rate comes from, to show how sure it is."
        },
        "balance": {
          "type": "number",
          "description": "Optional account balance, to show amounts."
        }
      }
    },
    {
      "id": "win-rate",
      "title": "Win Rate Calculator",
      "page": "https://forexdemo.com/win-rate-calculator.html",
      "description": "Win rate from the number of winning and losing trades, how sure that win rate is, and, with the average win and loss, the break-even win rate, profit factor and expectancy.",
      "example": "https://forexdemo.com/api/calculators/win-rate?wins=45&losses=55&averageWin=150&averageLoss=100",
      "inputs": {
        "wins": {
          "type": "number",
          "description": "Number of winning trades.",
          "required": true
        },
        "losses": {
          "type": "number",
          "description": "Number of losing trades.",
          "required": true
        },
        "flat": {
          "type": "number",
          "description": "Optional number of break-even trades."
        },
        "averageWin": {
          "type": "number",
          "description": "Optional average win, in money."
        },
        "averageLoss": {
          "type": "number",
          "description": "Optional average loss, in money, without a minus sign."
        },
        "cost": {
          "type": "number",
          "description": "Optional cost per trade (spread and commission), in money."
        },
        "target": {
          "type": "number",
          "description": "Optional win rate to reach, in percent. Give 2 for 2%."
        }
      }
    },
    {
      "id": "swap",
      "title": "Forex Swap Calculator",
      "page": "https://forexdemo.com/forex-swap-calculator.html",
      "description": "Overnight swap (rollover) cost or credit of holding a Forex position, night by night including the triple day, from the swap rates a platform shows.",
      "example": "https://forexdemo.com/api/calculators/swap?pair=EURUSD&side=buy&size=1&long=-9.17&short=3.06&nights=7",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF"
          ],
          "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "lots",
            "units"
          ],
          "description": "lots (100,000 units each) or units.",
          "default": "lots"
        },
        "size": {
          "type": "number",
          "description": "Trade size, counted in sizeUnit.",
          "default": 1
        },
        "long": {
          "type": "string",
          "description": "Swap long (for buys), exactly as the platform shows it, in swapUnit. A charge has a minus sign, such as -9.17.",
          "required": true
        },
        "short": {
          "type": "string",
          "description": "Swap short (for sells), exactly as the platform shows it, in swapUnit.",
          "required": true
        },
        "swapUnit": {
          "type": "string",
          "enum": [
            "points",
            "pips",
            "percent",
            "money"
          ],
          "description": "The unit the platform shows the swap in: points (MetaTrader), pips, percent a year, or money per standard lot per night.",
          "default": "points"
        },
        "precision": {
          "type": "string",
          "enum": [
            "fractional",
            "whole"
          ],
          "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
          "default": "fractional"
        },
        "amountCurrency": {
          "type": "string",
          "enum": [
            "quote",
            "base",
            "account"
          ],
          "description": "Only for money: the currency the swap amounts are in.",
          "default": "quote"
        },
        "yearBasis": {
          "type": "string",
          "enum": [
            "365",
            "360"
          ],
          "description": "Only for percent: the number of days in the broker's interest year.",
          "default": "365"
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "price": {
          "type": "number",
          "description": "Pair price. Needed for percent swaps, base-currency money swaps, and when the account currency is the pair's first currency."
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when neither currency of the pair is the account currency."
        },
        "openDay": {
          "type": "string",
          "enum": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday",
            "Saturday",
            "Sunday"
          ],
          "description": "Day the trade is opened.",
          "default": "Monday"
        },
        "nights": {
          "type": "number",
          "description": "Nights the trade is held.",
          "default": 7
        },
        "tripleDay": {
          "type": "string",
          "enum": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ],
          "description": "The night that counts three days of interest. Usually Wednesday (Thursday for USD/CAD at some brokers).",
          "default": "Wednesday"
        },
        "balance": {
          "type": "number",
          "description": "Optional account balance, for effective leverage."
        }
      }
    },
    {
      "id": "yen-carry",
      "title": "Yen Carry Trade Calculator",
      "page": "https://forexdemo.com/yen-carry-trade-calculator.html",
      "description": "What a carry trade earns or pays in swap over a holding period, its yearly carry yield, how far the price can move against it before the swap is used up, and what a sharp unwind like 2024 would cost.",
      "example": "https://forexdemo.com/api/calculators/yen-carry?pair=USDJPY&side=buy&price=158&long=7.5&short=-13.5&holding=3",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF"
          ],
          "description": "Currency pair. The yen pairs are the classic carry trades; the other pairs work too.",
          "default": "USD/JPY"
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "price": {
          "type": "number",
          "description": "Pair price now.",
          "required": true
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "lots",
            "units"
          ],
          "description": "lots (100,000 units each) or units.",
          "default": "lots"
        },
        "size": {
          "type": "number",
          "description": "Trade size, counted in sizeUnit.",
          "default": 1
        },
        "currency": {
          "type": "string",
          "enum": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "The currency the trading account is held in.",
          "default": "USD"
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when the account currency is not in the pair."
        },
        "long": {
          "type": "string",
          "description": "Swap long (for buys), exactly as the platform shows it, in swapUnit. A charge has a minus sign, such as -9.17.",
          "required": true
        },
        "short": {
          "type": "string",
          "description": "Swap short (for sells), exactly as the platform shows it, in swapUnit.",
          "required": true
        },
        "swapUnit": {
          "type": "string",
          "enum": [
            "points",
            "pips",
            "percent",
            "money"
          ],
          "description": "The unit the platform shows the swap in: points (MetaTrader), pips, percent a year, or money per standard lot per night.",
          "default": "points"
        },
        "precision": {
          "type": "string",
          "enum": [
            "fractional",
            "whole"
          ],
          "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
          "default": "fractional"
        },
        "amountCurrency": {
          "type": "string",
          "enum": [
            "quote",
            "base",
            "account"
          ],
          "description": "Only for money: the currency the swap amounts are in.",
          "default": "quote"
        },
        "yearBasis": {
          "type": "string",
          "enum": [
            "365",
            "360"
          ],
          "description": "Only for percent: the number of days in the broker's interest year.",
          "default": "365"
        },
        "holding": {
          "type": "number",
          "description": "Holding period, in holdingUnit.",
          "default": 3
        },
        "holdingUnit": {
          "type": "string",
          "enum": [
            "days",
            "weeks",
            "months"
          ],
          "description": "Unit of the holding period.",
          "default": "months"
        },
        "openDay": {
          "type": "string",
          "enum": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday",
            "Saturday",
            "Sunday"
          ],
          "description": "Day the trade is opened.",
          "default": "Monday"
        },
        "tripleDay": {
          "type": "string",
          "enum": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ],
          "description": "The night that counts three days of interest.",
          "default": "Wednesday"
        },
        "balance": {
          "type": "number",
          "description": "Optional account balance."
        }
      }
    },
    {
      "id": "slippage",
      "title": "Forex Slippage Calculator",
      "page": "https://forexdemo.com/forex-slippage-calculator.html",
      "description": "What slippage (the difference between the price asked for and the price filled) costs per trade, per month and over a period.",
      "example": "https://forexdemo.com/api/calculators/slippage?pair=EURUSD&size=1&entry=0.2&exit=0.3&trades=40",
      "inputs": {
        "pair": {
          "type": "string",
          "enum": [
            "EUR/USD",
            "GBP/USD",
            "USD/JPY",
            "USD/CHF",
            "USD/CAD",
            "AUD/USD",
            "NZD/USD",
            "EUR/GBP",
            "EUR/JPY",
            "GBP/JPY",
            "AUD/JPY",
            "CAD/JPY",
            "CHF/JPY",
            "NZD/JPY",
            "EUR/CHF",
            "EUR/CAD",
            "EUR/AUD",
            "EUR/NZD",
            "GBP/CHF",
            "GBP/CAD",
            "GBP/AUD",
            "GBP/NZD",
            "AUD/CAD",
            "AUD/CHF",
            "AUD/NZD",
            "NZD/CAD",
            "NZD/CHF",
            "CAD/CHF"
          ],
          "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
          "default": "EUR/USD"
        },
        "sizeUnit": {
          "type": "string",
          "enum": [
            "lots",
            "units"
          ],
          "description": "lots (100,000 units each) or units.",
          "default": "lots"
        },
        "size": {
          "type": "number",
          "description": "Average size per trade, in sizeUnit.",
          "default": 1
        },
        "trades": {
          "type": "number",
          "description": "Completed trades per month.",
          "default": 40
        },
        "entry": {
          "type": "number",
          "description": "Slippage on entry per trade, in slippageUnit.",
          "required": true
        },
        "exit": {
          "type": "number",
          "description": "Slippage on exit per trade, in slippageUnit.",
          "required": true
        },
        "slippageUnit": {
          "type": "string",
          "enum": [
            "pips",
            "points"
          ],
          "description": "pips or points.",
          "default": "pips"
        },
        "precision": {
          "type": "string",
          "enum": [
            "fractional",
            "whole"
          ],
          "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
          "default": "fractional"
        },
        "months": {
          "type": "number",
          "description": "Number of months.",
          "default": 12
        },
        "currency": {
          "type": "string",
          "enum": [
            "quote",
            "EUR",
            "GBP",
            "JPY",
            "CHF",
            "CAD",
            "AUD",
            "NZD"
          ],
          "description": "Currency to show costs in: quote (the pair's second currency) or another currency.",
          "default": "quote"
        },
        "rate": {
          "type": "number",
          "description": "Only needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when currency is not quote."
        },
        "stopPips": {
          "type": "number",
          "description": "Optional stop distance in pips, to compare the slippage with the risk."
        },
        "averageWinPips": {
          "type": "number",
          "description": "Optional average win in pips, to compare the slippage with the average win."
        }
      }
    },
    {
      "id": "futures",
      "title": "Futures Calculator",
      "page": "https://forexdemo.com/futures-calculator.html",
      "description": "Tick value, the value of a one-point move and the profit or loss of a trade for CME Group futures such as ES, MES, NQ, MNQ, CL, GC and 6E.",
      "example": "https://forexdemo.com/api/calculators/futures?contract=MES&contracts=2&entry=6800&exit=6812.5",
      "inputs": {
        "contract": {
          "type": "string",
          "enum": [
            "ES",
            "MES",
            "NQ",
            "MNQ",
            "YM",
            "MYM",
            "RTY",
            "M2K",
            "6E",
            "M6E",
            "6J",
            "MJY",
            "6B",
            "M6B",
            "6A",
            "M6A",
            "6C",
            "MCD",
            "6S",
            "MSF",
            "6N",
            "GC",
            "MGC",
            "SI",
            "SIL",
            "HG",
            "MHG",
            "CL",
            "MCL",
            "NG",
            "MNG",
            "MBT",
            "custom"
          ],
          "description": "Contract symbol, or custom with tickSize and tickValue.",
          "required": true
        },
        "tickSize": {
          "type": "number",
          "description": "Custom contract only: tick size."
        },
        "tickValue": {
          "type": "number",
          "description": "Custom contract only: tick value in US dollars."
        },
        "mode": {
          "type": "string",
          "enum": [
            "prices",
            "move",
            "dollars"
          ],
          "description": "prices: profit or loss from entry and exit prices. move: value of a move. dollars: the move that makes a dollar amount.",
          "default": "prices"
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ],
          "description": "buy (long) or sell (short).",
          "default": "buy"
        },
        "contracts": {
          "type": "number",
          "description": "Number of contracts.",
          "default": 1
        },
        "entry": {
          "type": "number",
          "description": "Entry price (mode prices)."
        },
        "exit": {
          "type": "number",
          "description": "Exit price (mode prices)."
        },
        "stop": {
          "type": "number",
          "description": "Optional stop price (mode prices)."
        },
        "moveSize": {
          "type": "number",
          "description": "Size of the move (mode move)."
        },
        "moveUnit": {
          "type": "string",
          "enum": [
            "move",
            "ticks"
          ],
          "description": "Unit of moveSize: move (the contract's own point, pip or dollar step) or ticks.",
          "default": "move"
        },
        "amount": {
          "type": "number",
          "description": "Dollar amount (mode dollars)."
        },
        "fee": {
          "type": "number",
          "description": "Optional fee per contract, in US dollars."
        },
        "feeBasis": {
          "type": "string",
          "enum": [
            "side",
            "round"
          ],
          "description": "side or round trip.",
          "default": "side"
        }
      }
    },
    {
      "id": "futures-contracts",
      "title": "Futures Calculator: how many contracts",
      "page": "https://forexdemo.com/futures-calculator.html#how-many-contracts",
      "description": "How many futures contracts fit the amount a trader is willing to lose at the stop, with the micro contract as a finer alternative.",
      "example": "https://forexdemo.com/api/calculators/futures-contracts?sizeContract=ES&risk=500&stopDistance=8",
      "inputs": {
        "sizeContract": {
          "type": "string",
          "enum": [
            "ES",
            "MES",
            "NQ",
            "MNQ",
            "YM",
            "MYM",
            "RTY",
            "M2K",
            "6E",
            "M6E",
            "6J",
            "MJY",
            "6B",
            "M6B",
            "6A",
            "M6A",
            "6C",
            "MCD",
            "6S",
            "MSF",
            "6N",
            "GC",
            "MGC",
            "SI",
            "SIL",
            "HG",
            "MHG",
            "CL",
            "MCL",
            "NG",
            "MNG",
            "MBT"
          ],
          "description": "Contract symbol.",
          "required": true
        },
        "risk": {
          "type": "number",
          "description": "The most you are willing to lose on the trade, in US dollars.",
          "required": true
        },
        "stopUnit": {
          "type": "string",
          "enum": [
            "move",
            "ticks",
            "prices"
          ],
          "description": "How the stop is given: move (the contract's own point, pip or dollar step), ticks, or prices (sizeEntry and sizeStopPrice).",
          "default": "move"
        },
        "stopDistance": {
          "type": "number",
          "description": "Distance to the stop, in stopUnit (move or ticks)."
        },
        "sizeEntry": {
          "type": "number",
          "description": "Entry price (stopUnit prices)."
        },
        "sizeStopPrice": {
          "type": "number",
          "description": "Stop price (stopUnit prices)."
        },
        "sizeFee": {
          "type": "number",
          "description": "Optional fee per contract, in US dollars."
        },
        "sizeFeeBasis": {
          "type": "string",
          "enum": [
            "side",
            "round"
          ],
          "description": "side or round trip.",
          "default": "side"
        }
      }
    }
  ],
  "notice": "For education. Not financial advice. Check figures with your broker before trading."
}