{
  "openapi": "3.1.0",
  "info": {
    "title": "ForexDemo.com calculators and demo account research",
    "version": "1.0.0",
    "description": "Free Forex, gold and futures calculators: pip value, position size, profit, compounding, margin, drawdown, risk-reward, risk of ruin, Kelly criterion, win rate, swap, carry trade, slippage and futures ticks. Read-only GET requests, no key, nothing stored. For education, not financial advice. Also searches the site's research of brokers' Forex demo accounts: virtual money, how long each demo lasts, platforms and country, with the broker's own pages as sources."
  },
  "servers": [
    {
      "url": "https://forexdemo.com"
    }
  ],
  "paths": {
    "/api/calculators": {
      "get": {
        "operationId": "listCalculators",
        "summary": "List every calculator with its inputs and an example address.",
        "responses": {
          "200": {
            "description": "The calculators.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/pip": {
      "get": {
        "operationId": "calculate_pip",
        "summary": "Pip Calculator",
        "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. Same calculation as https://forexdemo.com/pip-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "mini",
                "micro",
                "nano",
                "units"
              ],
              "default": "standard"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Trade size, counted in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "pipsMoved",
            "in": "query",
            "required": false,
            "description": "Optional price move to value. Negative for a loss.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "moveUnit",
            "in": "query",
            "required": false,
            "description": "Unit of pipsMoved: pips, points (MetaTrader, 10 points = 1 pip) or, for gold only, dollars an ounce.",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points",
                "dollars"
              ],
              "default": "pips"
            }
          },
          {
            "name": "goldPip",
            "in": "query",
            "required": false,
            "description": "Gold only: the price change your broker calls one pip.",
            "schema": {
              "type": "string",
              "enum": [
                "0.01",
                "0.10"
              ],
              "default": "0.01"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/position-size": {
      "get": {
        "operationId": "calculate_position_size",
        "summary": "Position Size Calculator",
        "description": "How many lots to trade so that hitting the stop-loss loses a set percentage or amount of the account. Same calculation as https://forexdemo.com/position-size-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Account balance in the account currency. Needed when riskMode is percent.",
            "schema": {
              "type": "number",
              "default": 10000
            }
          },
          {
            "name": "riskMode",
            "in": "query",
            "required": false,
            "description": "percent: risk is a percentage of the balance. money: risk is an amount in the account currency.",
            "schema": {
              "type": "string",
              "enum": [
                "percent",
                "money"
              ],
              "default": "percent"
            }
          },
          {
            "name": "risk",
            "in": "query",
            "required": false,
            "description": "Risk per trade: a percentage (1 for 1%) or an amount, per riskMode.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "stopMode",
            "in": "query",
            "required": false,
            "description": "pips: give the stop distance in stopPips. prices: give the entry and stop prices.",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "prices"
              ],
              "default": "pips"
            }
          },
          {
            "name": "stopPips",
            "in": "query",
            "required": false,
            "description": "Stop-loss distance (stopMode pips).",
            "schema": {
              "type": "number",
              "default": 50
            }
          },
          {
            "name": "stopUnit",
            "in": "query",
            "required": false,
            "description": "Unit of stopPips: pips or points (10 points = 1 pip).",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points"
              ],
              "default": "pips"
            }
          },
          {
            "name": "entry",
            "in": "query",
            "required": false,
            "description": "Entry price (stopMode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stop",
            "in": "query",
            "required": false,
            "description": "Stop-loss price (stopMode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "price",
            "in": "query",
            "required": false,
            "description": "Optional pair price, for the position value. Leave it out to use the example price.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "spread",
            "in": "query",
            "required": false,
            "description": "Optional spread to add to the stop distance, in costUnit (buys only, as on the page).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "slippage",
            "in": "query",
            "required": false,
            "description": "Optional stop slippage allowance, in costUnit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "costUnit",
            "in": "query",
            "required": false,
            "description": "Unit of spread and slippage.",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points"
              ],
              "default": "pips"
            }
          },
          {
            "name": "commission",
            "in": "query",
            "required": false,
            "description": "Optional commission per standard lot, in the account currency.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "commissionBasis",
            "in": "query",
            "required": false,
            "description": "side: charged when opening and again when closing. round: once per round trip.",
            "schema": {
              "type": "string",
              "enum": [
                "side",
                "round"
              ],
              "default": "side"
            }
          },
          {
            "name": "lotStep",
            "in": "query",
            "required": false,
            "description": "The smallest size step your broker allows.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "0.1",
                "0.01",
                "0.001",
                "units"
              ],
              "default": "0.01"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/profit": {
      "get": {
        "operationId": "calculate_profit",
        "summary": "Forex Profit Calculator",
        "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. Same calculation as https://forexdemo.com/forex-profit-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "mini",
                "micro",
                "nano",
                "units"
              ],
              "default": "standard"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Trade size, counted in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "open",
            "in": "query",
            "required": true,
            "description": "Open price.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "close",
            "in": "query",
            "required": true,
            "description": "Close price, or the price you expect.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "spread",
            "in": "query",
            "required": false,
            "description": "Optional spread, in spreadUnit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "spreadUnit",
            "in": "query",
            "required": false,
            "description": "Unit of spread: pips, or points as MetaTrader shows it.",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points"
              ],
              "default": "pips"
            }
          },
          {
            "name": "commission",
            "in": "query",
            "required": false,
            "description": "Optional commission per standard lot, in the account currency.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "commissionBasis",
            "in": "query",
            "required": false,
            "description": "side: charged when opening and again when closing. round: once per round trip.",
            "schema": {
              "type": "string",
              "enum": [
                "side",
                "round"
              ],
              "default": "side"
            }
          },
          {
            "name": "swap",
            "in": "query",
            "required": false,
            "description": "Optional overnight swap for all nights held, in the account currency. A charge has a minus sign, such as -12.50.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Optional account balance, to show the result as a percentage.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stop",
            "in": "query",
            "required": false,
            "description": "Optional stop-loss price.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Optional take-profit price.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/compounding": {
      "get": {
        "operationId": "calculate_compounding",
        "summary": "Forex Compounding Calculator",
        "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. Same calculation as https://forexdemo.com/forex-compounding-calculator.html.",
        "parameters": [
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Starting balance.",
            "schema": {
              "type": "number",
              "default": 10000
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "gain",
            "in": "query",
            "required": false,
            "description": "Gain per period in percent. Negative for a loss. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 2
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "description": "How often the gain is made.",
            "schema": {
              "type": "string",
              "enum": [
                "trade",
                "day",
                "week",
                "month",
                "year"
              ],
              "default": "month"
            }
          },
          {
            "name": "periods",
            "in": "query",
            "required": false,
            "description": "Number of periods.",
            "schema": {
              "type": "number",
              "default": 12
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Optional target balance.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "flowType",
            "in": "query",
            "required": false,
            "description": "Optional regular money in or out: deposit, withdraw (an amount) or share (a percentage of the profit).",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "deposit",
                "withdraw",
                "share"
              ],
              "default": "none"
            }
          },
          {
            "name": "flow",
            "in": "query",
            "required": false,
            "description": "Amount (or percentage for share) of each deposit or withdrawal.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "flowEvery",
            "in": "query",
            "required": false,
            "description": "How many periods between deposits or withdrawals. Defaults to about once a month.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lossCount",
            "in": "query",
            "required": false,
            "description": "Not for period trade: how many losing periods in each group of lossEvery.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lossEvery",
            "in": "query",
            "required": false,
            "description": "Not for period trade: the size of the group, such as 1 loss every 4 months.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "winRate",
            "in": "query",
            "required": false,
            "description": "Only for period trade: the share of trades that win. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lossPercent",
            "in": "query",
            "required": false,
            "description": "The percentage lost in each losing period or losing trade. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/margin": {
      "get": {
        "operationId": "calculate_margin",
        "summary": "Margin and Leverage Calculator",
        "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. Same calculation as https://forexdemo.com/forex-margin-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair or gold (XAU/USD). EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Trade size, counted in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "How the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "mini",
                "micro",
                "nano",
                "units"
              ],
              "default": "standard"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "price",
            "in": "query",
            "required": false,
            "description": "Pair price when the trade opens. Leave it out to use the example price.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "marginMode",
            "in": "query",
            "required": false,
            "description": "leverage: give leverage. percent: give the margin requirement as a percentage.",
            "schema": {
              "type": "string",
              "enum": [
                "leverage",
                "percent"
              ],
              "default": "leverage"
            }
          },
          {
            "name": "leverage",
            "in": "query",
            "required": false,
            "description": "Leverage, such as 30 or 1:30.",
            "schema": {
              "type": "string",
              "default": "50"
            }
          },
          {
            "name": "marginPercent",
            "in": "query",
            "required": false,
            "description": "Margin requirement in percent (marginMode percent). Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Optional account balance, for free margin, margin level and margin call prices.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "marginCallLevel",
            "in": "query",
            "required": false,
            "description": "Margin call level in percent.",
            "schema": {
              "type": "number",
              "default": 100
            }
          },
          {
            "name": "stopOutLevel",
            "in": "query",
            "required": false,
            "description": "Stop out level in percent.",
            "schema": {
              "type": "number",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/drawdown": {
      "get": {
        "operationId": "calculate_drawdown",
        "summary": "Forex Drawdown Calculator",
        "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. Same calculation as https://forexdemo.com/forex-drawdown-calculator.html.",
        "parameters": [
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Account balance.",
            "schema": {
              "type": "number",
              "default": 10000
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "risk",
            "in": "query",
            "required": false,
            "description": "Risk per trade in percent. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 2
            }
          },
          {
            "name": "riskBase",
            "in": "query",
            "required": false,
            "description": "current: risk is a share of the current balance. start: of the starting balance.",
            "schema": {
              "type": "string",
              "enum": [
                "current",
                "start"
              ],
              "default": "current"
            }
          },
          {
            "name": "losses",
            "in": "query",
            "required": false,
            "description": "Losing trades in a row.",
            "schema": {
              "type": "number",
              "default": 10
            }
          },
          {
            "name": "winRate",
            "in": "query",
            "required": false,
            "description": "Win rate in percent, for the chance of a losing run. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 50
            }
          },
          {
            "name": "reward",
            "in": "query",
            "required": false,
            "description": "Average win as a multiple of the risk, such as 1.5.",
            "schema": {
              "type": "number",
              "default": 1.5
            }
          },
          {
            "name": "trades",
            "in": "query",
            "required": false,
            "description": "Number of trades to look ahead.",
            "schema": {
              "type": "number",
              "default": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Drawdown limit in percent, such as a prop firm's. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 20
            }
          },
          {
            "name": "limitType",
            "in": "query",
            "required": false,
            "description": "Where the limit is measured from: peak (highest balance), start (starting balance) or lock (trailing until it locks at the start).",
            "schema": {
              "type": "string",
              "enum": [
                "peak",
                "start",
                "lock"
              ],
              "default": "peak"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/risk-reward": {
      "get": {
        "operationId": "calculate_risk_reward",
        "summary": "Risk Reward Calculator",
        "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. Same calculation as https://forexdemo.com/risk-reward-calculator.html.",
        "parameters": [
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "prices: give entry, stop and target prices. distance: give stopDistance and targetDistance.",
            "schema": {
              "type": "string",
              "enum": [
                "prices",
                "distance"
              ],
              "default": "prices"
            }
          },
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Pair, used for pip size in prices mode. EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "entry",
            "in": "query",
            "required": false,
            "description": "Entry price (mode prices). Leave all three prices out to use the example trade.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stop",
            "in": "query",
            "required": false,
            "description": "Stop-loss price (mode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Take-profit price (mode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stopDistance",
            "in": "query",
            "required": false,
            "description": "Stop-loss distance (mode distance).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "targetDistance",
            "in": "query",
            "required": false,
            "description": "Take-profit distance (mode distance).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "distanceUnit",
            "in": "query",
            "required": false,
            "description": "Unit of the distances (mode distance).",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points",
                "ticks",
                "other"
              ],
              "default": "pips"
            }
          },
          {
            "name": "spread",
            "in": "query",
            "required": false,
            "description": "Optional spread, in pips (prices mode) or the distance unit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "riskAmount",
            "in": "query",
            "required": false,
            "description": "Optional amount risked per trade, in the account currency.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "winRate",
            "in": "query",
            "required": false,
            "description": "Win rate in percent, for the result over many trades. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 40
            }
          },
          {
            "name": "trades",
            "in": "query",
            "required": false,
            "description": "Number of trades for the result over many trades.",
            "schema": {
              "type": "number",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/account-survival": {
      "get": {
        "operationId": "calculate_account_survival",
        "summary": "Account Survival Calculator",
        "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. Same calculation as https://forexdemo.com/account-survival-calculator.html.",
        "parameters": [
          {
            "name": "winRate",
            "in": "query",
            "required": true,
            "description": "Win rate in percent. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "reward",
            "in": "query",
            "required": true,
            "description": "Average win as a multiple of the risk, such as 1.5.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "trades",
            "in": "query",
            "required": false,
            "description": "Number of trades to look ahead.",
            "schema": {
              "type": "number",
              "default": 200
            }
          },
          {
            "name": "risk",
            "in": "query",
            "required": false,
            "description": "Risk per trade in percent. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 2
            }
          },
          {
            "name": "riskBase",
            "in": "query",
            "required": false,
            "description": "current: risk is a share of the current balance. start: of the starting balance.",
            "schema": {
              "type": "string",
              "enum": [
                "current",
                "start"
              ],
              "default": "current"
            }
          },
          {
            "name": "ruin",
            "in": "query",
            "required": false,
            "description": "Ruin level: the share of the account lost that counts as ruin. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 30
            }
          },
          {
            "name": "ruinType",
            "in": "query",
            "required": false,
            "description": "Where the ruin level is measured from: start or peak.",
            "schema": {
              "type": "string",
              "enum": [
                "start",
                "peak"
              ],
              "default": "start"
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Optional profit target in percent. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/kelly": {
      "get": {
        "operationId": "calculate_kelly",
        "summary": "Kelly Criterion Calculator",
        "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. Same calculation as https://forexdemo.com/kelly-criterion-calculator.html.",
        "parameters": [
          {
            "name": "winRate",
            "in": "query",
            "required": true,
            "description": "Win rate in percent. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "reward",
            "in": "query",
            "required": true,
            "description": "Average win as a multiple of the average loss, such as 1.5.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "trades",
            "in": "query",
            "required": false,
            "description": "Number of trades to look ahead.",
            "schema": {
              "type": "number",
              "default": 200
            }
          },
          {
            "name": "risk",
            "in": "query",
            "required": false,
            "description": "Risk per trade in percent, to compare with Kelly. Give 2 for 2%.",
            "schema": {
              "type": "number",
              "default": 2
            }
          },
          {
            "name": "sample",
            "in": "query",
            "required": false,
            "description": "Optional: how many past trades the win rate comes from, to show how sure it is.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Optional account balance, to show amounts.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/win-rate": {
      "get": {
        "operationId": "calculate_win_rate",
        "summary": "Win Rate Calculator",
        "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. Same calculation as https://forexdemo.com/win-rate-calculator.html.",
        "parameters": [
          {
            "name": "wins",
            "in": "query",
            "required": true,
            "description": "Number of winning trades.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "losses",
            "in": "query",
            "required": true,
            "description": "Number of losing trades.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "flat",
            "in": "query",
            "required": false,
            "description": "Optional number of break-even trades.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "averageWin",
            "in": "query",
            "required": false,
            "description": "Optional average win, in money.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "averageLoss",
            "in": "query",
            "required": false,
            "description": "Optional average loss, in money, without a minus sign.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "cost",
            "in": "query",
            "required": false,
            "description": "Optional cost per trade (spread and commission), in money.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Optional win rate to reach, in percent. Give 2 for 2%.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/swap": {
      "get": {
        "operationId": "calculate_swap",
        "summary": "Forex Swap Calculator",
        "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. Same calculation as https://forexdemo.com/forex-swap-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "lots (100,000 units each) or units.",
            "schema": {
              "type": "string",
              "enum": [
                "lots",
                "units"
              ],
              "default": "lots"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Trade size, counted in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "long",
            "in": "query",
            "required": true,
            "description": "Swap long (for buys), exactly as the platform shows it, in swapUnit. A charge has a minus sign, such as -9.17.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "short",
            "in": "query",
            "required": true,
            "description": "Swap short (for sells), exactly as the platform shows it, in swapUnit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "swapUnit",
            "in": "query",
            "required": false,
            "description": "The unit the platform shows the swap in: points (MetaTrader), pips, percent a year, or money per standard lot per night.",
            "schema": {
              "type": "string",
              "enum": [
                "points",
                "pips",
                "percent",
                "money"
              ],
              "default": "points"
            }
          },
          {
            "name": "precision",
            "in": "query",
            "required": false,
            "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
            "schema": {
              "type": "string",
              "enum": [
                "fractional",
                "whole"
              ],
              "default": "fractional"
            }
          },
          {
            "name": "amountCurrency",
            "in": "query",
            "required": false,
            "description": "Only for money: the currency the swap amounts are in.",
            "schema": {
              "type": "string",
              "enum": [
                "quote",
                "base",
                "account"
              ],
              "default": "quote"
            }
          },
          {
            "name": "yearBasis",
            "in": "query",
            "required": false,
            "description": "Only for percent: the number of days in the broker's interest year.",
            "schema": {
              "type": "string",
              "enum": [
                "365",
                "360"
              ],
              "default": "365"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "price",
            "in": "query",
            "required": false,
            "description": "Pair price. Needed for percent swaps, base-currency money swaps, and when the account currency is the pair's first currency.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "openDay",
            "in": "query",
            "required": false,
            "description": "Day the trade is opened.",
            "schema": {
              "type": "string",
              "enum": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
                "Sunday"
              ],
              "default": "Monday"
            }
          },
          {
            "name": "nights",
            "in": "query",
            "required": false,
            "description": "Nights the trade is held.",
            "schema": {
              "type": "number",
              "default": 7
            }
          },
          {
            "name": "tripleDay",
            "in": "query",
            "required": false,
            "description": "The night that counts three days of interest. Usually Wednesday (Thursday for USD/CAD at some brokers).",
            "schema": {
              "type": "string",
              "enum": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday"
              ],
              "default": "Wednesday"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Optional account balance, for effective leverage.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/yen-carry": {
      "get": {
        "operationId": "calculate_yen_carry",
        "summary": "Yen Carry Trade Calculator",
        "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. Same calculation as https://forexdemo.com/yen-carry-trade-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair. The yen pairs are the classic carry trades; the other pairs work too.",
            "schema": {
              "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"
              ],
              "default": "USD/JPY"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "price",
            "in": "query",
            "required": true,
            "description": "Pair price now.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "lots (100,000 units each) or units.",
            "schema": {
              "type": "string",
              "enum": [
                "lots",
                "units"
              ],
              "default": "lots"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Trade size, counted in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency the trading account is held in.",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "USD"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "long",
            "in": "query",
            "required": true,
            "description": "Swap long (for buys), exactly as the platform shows it, in swapUnit. A charge has a minus sign, such as -9.17.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "short",
            "in": "query",
            "required": true,
            "description": "Swap short (for sells), exactly as the platform shows it, in swapUnit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "swapUnit",
            "in": "query",
            "required": false,
            "description": "The unit the platform shows the swap in: points (MetaTrader), pips, percent a year, or money per standard lot per night.",
            "schema": {
              "type": "string",
              "enum": [
                "points",
                "pips",
                "percent",
                "money"
              ],
              "default": "points"
            }
          },
          {
            "name": "precision",
            "in": "query",
            "required": false,
            "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
            "schema": {
              "type": "string",
              "enum": [
                "fractional",
                "whole"
              ],
              "default": "fractional"
            }
          },
          {
            "name": "amountCurrency",
            "in": "query",
            "required": false,
            "description": "Only for money: the currency the swap amounts are in.",
            "schema": {
              "type": "string",
              "enum": [
                "quote",
                "base",
                "account"
              ],
              "default": "quote"
            }
          },
          {
            "name": "yearBasis",
            "in": "query",
            "required": false,
            "description": "Only for percent: the number of days in the broker's interest year.",
            "schema": {
              "type": "string",
              "enum": [
                "365",
                "360"
              ],
              "default": "365"
            }
          },
          {
            "name": "holding",
            "in": "query",
            "required": false,
            "description": "Holding period, in holdingUnit.",
            "schema": {
              "type": "number",
              "default": 3
            }
          },
          {
            "name": "holdingUnit",
            "in": "query",
            "required": false,
            "description": "Unit of the holding period.",
            "schema": {
              "type": "string",
              "enum": [
                "days",
                "weeks",
                "months"
              ],
              "default": "months"
            }
          },
          {
            "name": "openDay",
            "in": "query",
            "required": false,
            "description": "Day the trade is opened.",
            "schema": {
              "type": "string",
              "enum": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
                "Sunday"
              ],
              "default": "Monday"
            }
          },
          {
            "name": "tripleDay",
            "in": "query",
            "required": false,
            "description": "The night that counts three days of interest.",
            "schema": {
              "type": "string",
              "enum": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday"
              ],
              "default": "Wednesday"
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": false,
            "description": "Optional account balance.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/slippage": {
      "get": {
        "operationId": "calculate_slippage",
        "summary": "Forex Slippage Calculator",
        "description": "What slippage (the difference between the price asked for and the price filled) costs per trade, per month and over a period. Same calculation as https://forexdemo.com/forex-slippage-calculator.html.",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "description": "Currency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.",
            "schema": {
              "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"
              ],
              "default": "EUR/USD"
            }
          },
          {
            "name": "sizeUnit",
            "in": "query",
            "required": false,
            "description": "lots (100,000 units each) or units.",
            "schema": {
              "type": "string",
              "enum": [
                "lots",
                "units"
              ],
              "default": "lots"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Average size per trade, in sizeUnit.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "trades",
            "in": "query",
            "required": false,
            "description": "Completed trades per month.",
            "schema": {
              "type": "number",
              "default": 40
            }
          },
          {
            "name": "entry",
            "in": "query",
            "required": true,
            "description": "Slippage on entry per trade, in slippageUnit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "exit",
            "in": "query",
            "required": true,
            "description": "Slippage on exit per trade, in slippageUnit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "slippageUnit",
            "in": "query",
            "required": false,
            "description": "pips or points.",
            "schema": {
              "type": "string",
              "enum": [
                "pips",
                "points"
              ],
              "default": "pips"
            }
          },
          {
            "name": "precision",
            "in": "query",
            "required": false,
            "description": "Only for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).",
            "schema": {
              "type": "string",
              "enum": [
                "fractional",
                "whole"
              ],
              "default": "fractional"
            }
          },
          {
            "name": "months",
            "in": "query",
            "required": false,
            "description": "Number of months.",
            "schema": {
              "type": "number",
              "default": 12
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "Currency to show costs in: quote (the pair's second currency) or another currency.",
            "schema": {
              "type": "string",
              "enum": [
                "quote",
                "EUR",
                "GBP",
                "JPY",
                "CHF",
                "CAD",
                "AUD",
                "NZD"
              ],
              "default": "quote"
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "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.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stopPips",
            "in": "query",
            "required": false,
            "description": "Optional stop distance in pips, to compare the slippage with the risk.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "averageWinPips",
            "in": "query",
            "required": false,
            "description": "Optional average win in pips, to compare the slippage with the average win.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/futures": {
      "get": {
        "operationId": "calculate_futures",
        "summary": "Futures Calculator",
        "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. Same calculation as https://forexdemo.com/futures-calculator.html.",
        "parameters": [
          {
            "name": "contract",
            "in": "query",
            "required": true,
            "description": "Contract symbol, or custom with tickSize and tickValue.",
            "schema": {
              "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"
              ]
            }
          },
          {
            "name": "tickSize",
            "in": "query",
            "required": false,
            "description": "Custom contract only: tick size.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "tickValue",
            "in": "query",
            "required": false,
            "description": "Custom contract only: tick value in US dollars.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "prices: profit or loss from entry and exit prices. move: value of a move. dollars: the move that makes a dollar amount.",
            "schema": {
              "type": "string",
              "enum": [
                "prices",
                "move",
                "dollars"
              ],
              "default": "prices"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "description": "buy (long) or sell (short).",
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ],
              "default": "buy"
            }
          },
          {
            "name": "contracts",
            "in": "query",
            "required": false,
            "description": "Number of contracts.",
            "schema": {
              "type": "number",
              "default": 1
            }
          },
          {
            "name": "entry",
            "in": "query",
            "required": false,
            "description": "Entry price (mode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "exit",
            "in": "query",
            "required": false,
            "description": "Exit price (mode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stop",
            "in": "query",
            "required": false,
            "description": "Optional stop price (mode prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "moveSize",
            "in": "query",
            "required": false,
            "description": "Size of the move (mode move).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "moveUnit",
            "in": "query",
            "required": false,
            "description": "Unit of moveSize: move (the contract's own point, pip or dollar step) or ticks.",
            "schema": {
              "type": "string",
              "enum": [
                "move",
                "ticks"
              ],
              "default": "move"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "description": "Dollar amount (mode dollars).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "fee",
            "in": "query",
            "required": false,
            "description": "Optional fee per contract, in US dollars.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "feeBasis",
            "in": "query",
            "required": false,
            "description": "side or round trip.",
            "schema": {
              "type": "string",
              "enum": [
                "side",
                "round"
              ],
              "default": "side"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculators/futures-contracts": {
      "get": {
        "operationId": "calculate_futures_contracts",
        "summary": "Futures Calculator: 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. Same calculation as https://forexdemo.com/futures-calculator.html#how-many-contracts.",
        "parameters": [
          {
            "name": "sizeContract",
            "in": "query",
            "required": true,
            "description": "Contract symbol.",
            "schema": {
              "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"
              ]
            }
          },
          {
            "name": "risk",
            "in": "query",
            "required": true,
            "description": "The most you are willing to lose on the trade, in US dollars.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "stopUnit",
            "in": "query",
            "required": false,
            "description": "How the stop is given: move (the contract's own point, pip or dollar step), ticks, or prices (sizeEntry and sizeStopPrice).",
            "schema": {
              "type": "string",
              "enum": [
                "move",
                "ticks",
                "prices"
              ],
              "default": "move"
            }
          },
          {
            "name": "stopDistance",
            "in": "query",
            "required": false,
            "description": "Distance to the stop, in stopUnit (move or ticks).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sizeEntry",
            "in": "query",
            "required": false,
            "description": "Entry price (stopUnit prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sizeStopPrice",
            "in": "query",
            "required": false,
            "description": "Stop price (stopUnit prices).",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sizeFee",
            "in": "query",
            "required": false,
            "description": "Optional fee per contract, in US dollars.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sizeFeeBasis",
            "in": "query",
            "required": false,
            "description": "side or round trip.",
            "schema": {
              "type": "string",
              "enum": [
                "side",
                "round"
              ],
              "default": "side"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, result, inputs and notes; or ok false with error.message and error.fields naming each input to fix.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos": {
      "get": {
        "operationId": "search_demo_accounts",
        "summary": "Search Forex demo accounts",
        "description": "Search our research of brokers’ demo accounts by broker, country, platform, market and how long the demo lasts. Returns answer (plain English), records with stable IDs, each demo’s plain facts and page link, and next for the following page. Up to 15 brokers a page.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Broker, platform or company name, such as OANDA or MetaTrader 5. Defaults to all.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "description": "Country or region code or name, such as US, UK, Australia. Defaults to all. It is where the research applies, not a promise the broker accepts residents there.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "description": "Platform. Defaults to all.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "web",
                "mt4",
                "mt5",
                "ctrader",
                "tradingview",
                "jforex",
                "ticktrader",
                "rstockstrader",
                "tws",
                "unknown"
              ]
            }
          },
          {
            "name": "market",
            "in": "query",
            "required": false,
            "description": "Markets offered on the demo, such as forex or gold. Defaults to all.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api",
            "in": "query",
            "required": false,
            "description": "demo for demos with a researched API (a way for software to trade the demo). Defaults to all.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "demo"
              ]
            }
          },
          {
            "name": "expiry",
            "in": "query",
            "required": false,
            "description": "How the demo ends. Defaults to all.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "none",
                "inactivity",
                "fixed",
                "conditional",
                "unknown",
                "conflict"
              ]
            }
          },
          {
            "name": "coverage",
            "in": "query",
            "required": false,
            "description": "reviewed (default), pending (not yet confirmed) or all.",
            "schema": {
              "type": "string",
              "enum": [
                "reviewed",
                "pending",
                "all"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, records and next.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "ok false with error.message saying what to change."
          }
        }
      }
    },
    "/api/demos/compare": {
      "get": {
        "operationId": "compare_demo_accounts",
        "summary": "Compare two or three demo accounts",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "description": "Two or three demo IDs from a search, separated by commas.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer and the records side by side.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "ok false with error.message saying what to change."
          }
        }
      }
    },
    "/api/demos/{id}": {
      "get": {
        "operationId": "get_demo_account",
        "summary": "Read one demo account",
        "description": "Everything we found about one demo account, with the broker’s own pages as sources and the date we checked.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Demo ID from a search, such as forex-mt5-us.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok true with answer, plain, record and sources.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "ok false with error.message saying what to change."
          },
          "404": {
            "description": "No demo has this ID."
          }
        }
      }
    }
  }
}