MetaScalp Linking API

Searching...

Local HTTP server for external applications to communicate with a running MetaScalp instance.

Host: 127.0.0.1   Ports: 1784517855   CORS enabled for all origins.   Full documentation

Getting started: 1. Launch MetaScalp — the API server starts automatically. 2. Discover the port with GET /ping. 3. Send commands to switch tickers or open combos.

GET /ping Discover running instance

Scan ports 1784517855 to find the running MetaScalp instance. Returns the app name and version.

POST /api/change-ticker Switch ticker in MetaScalp

Changes the current ticker. The active window is always notified. When a named binding is provided, that binding's linked panels are also updated.

Accepts two request formats: a ticker pattern string (e.g. BINANCE:BTCUSDT.p) or explicit fields (exchange + market + ticker).

A binding is a named group of linked panels inside MetaScalp (e.g. a chart, order book, and trade feed showing the same ticker). Bindings are numbered "001""500" and configured by the user in the MetaScalp UI.

Binding valueActive windowNamed binding
omitted / emptynotified
"001""500"notifiednotified
Format: EXCHANGE:SYMBOL.suffix — suffix: .p (futures), .m (margin), .o (options), omitted (spot)
Exchange and suffix are optional. Symbol may contain letters, digits, _, /, -, $, :.
Examples: BINANCE:BTCUSDT.p, BYBIT:ETHUSDT, OKX:BTC-USDT.m, HYPERLIQUID:BTCUSDT.p, HYPERLIQUID:cash:HOODUSDT0.p
Symbol is case-insensitive and separators (-, _, /) are auto-stripped: btc-usdt, BTC/USDT, BTCUSDT all resolve to the same ticker.
POST /api/combo Open combo layout

Opens a combo layout for the specified ticker in the MetaScalp UI. The ticker field is a symbol (e.g. BTCUSDT), not a pattern — the combo opens on the currently active exchange and market connection. The symbol is normalized: case-insensitive, separators (-, _, /) are stripped, and the SWAP suffix is removed.

Reference

Exchange values

ValueExchange
2Binance
3GateIo
4Bybit (classic)
5KuCoin
6BybitUta (Unified Trading Account)
7Bitget
8Mexc
10Okx
11BingX
12HTX
13BitMart
14LBank
15HyperLiquid
16UpBit
17AsterDex
18Moex
19Lighter

MarketType values

ValueTypeDescription
0SpotSpot trading
1FuturesGeneric futures
2UsdtFuturesUSDT-margined futures
3CoinFuturesCoin-margined futures
4InverseFuturesInverse futures
5UsdtPerpetualUSDT perpetual swaps
6UsdcPerpetualUSDC perpetual swaps
7MarginMargin (cross/isolated)
8OptionsOptions contracts
9StockStock / equity markets
Unsure which market type to use? Use the ticker pattern approach instead — the .p suffix auto-resolves to the right futures type. For explicit fields, 2 (UsdtFutures) is the most common choice for perpetual futures.
When the requested market is not Spot and no exact match is found, MetaScalp falls back to any non-Spot connection on the same exchange.

Error responses

All errors return HTTP 400 with a JSON body.

EndpointConditionError message
/api/change-tickerMissing fieldsInvalid request body. Provide 'tickerPattern' or 'exchange'+'market'+'ticker'.
/api/change-tickerInvalid patternInvalid ticker pattern: '{pattern}'
/api/change-tickerBinding not foundBinding '{name}' not found. Available: {list}
/api/change-tickerNo connectionNo connection found for exchange ... and market ...
/api/change-tickerTicker not on connectionTicker '{ticker}' not found on connection {id}
/api/comboMissing tickerInvalid request body. 'ticker' is required.
/api/comboHandler not readyCombo handler not registered
any unknown pathNot found
wrong HTTP methodMethod not allowed

📄 MetaScalp-Api.md

⬇ Download .md

MetaScalp Linking API

Local HTTP server for external applications to communicate with a running MetaScalp instance.

  • Host: 127.0.0.1 (localhost only)
  • Port range: 1784517855 (first available port is used)
  • Protocol: HTTP
  • Content-Type: application/json
  • CORS: All responses include Access-Control-Allow-Origin: *. OPTIONS preflight is supported on all routes.

Getting started

1. Launch MetaScalp — the local API server starts automatically.

2. Discover the port — scan 1784517855 with GET /ping to find the running instance.

3. Send commands — use POST /api/change-ticker to switch the active ticker, or POST /api/combo to open a combo layout.


Discovery

Scan the port range to find the running MetaScalp instance.

GET http://127.0.0.1:{port}/ping

Response 200 OK:

{ "app": "MetaScalp", "version": "0.0.9" }

Change Ticker

Switches the active ticker in MetaScalp. The active window is always notified. When a named binding is provided, that binding's linked panels are notified as well.

POST http://127.0.0.1:{port}/api/change-ticker
Content-Type: application/json

Request body

The endpoint accepts two request formats. Include either tickerPattern or the exchange + market + ticker fields.

Option A — Ticker pattern

FieldTypeRequiredDescription
tickerPatternstringyesPattern string (see Ticker pattern format below).
bindingstringnoNamed binding ("001""500"). Omit or send empty string to only notify the active window.

Option B — Explicit fields

FieldTypeRequiredDescription
exchangeintegeryesExchange identifier (see Exchange values below)
marketintegeryesMarket type identifier (see MarketType values below)
tickerstringyesTrading pair symbol, e.g. "BTCUSDT"
bindingstringnoNamed binding ("001""500"). Omit or send empty string to only notify the active window.

Bindings

A binding is a named group of linked panels inside MetaScalp (e.g. a chart, order book, and trade feed that should all show the same ticker). Bindings are numbered "001" through "500" and are configured by the user inside the MetaScalp UI. When you send a binding name with a request, all panels assigned to that binding will switch to the new ticker.

binding valueActive window notifiedNamed binding notified
omitted / empty / nullyes
"001""500"yesyes

Response

200 OK — ticker changed successfully:

{ "status": "ok" }

400 Bad Request — validation error:

{ "error": "..." }

Possible error messages:

ConditionError message
Missing fieldsInvalid request body. Provide 'tickerPattern' or 'exchange'+'market'+'ticker'.
Invalid pattern formatInvalid ticker pattern: '{pattern}'
Binding name not foundBinding '{name}' not found. Available: {list}
No connection for exchange + marketNo connection found for exchange {exchange} and market {market}
Ticker not available on connectionTicker '{ticker}' not found on connection {id}

Examples

Using ticker pattern:

curl -X POST http://127.0.0.1:17845/api/change-ticker \
  -H "Content-Type: application/json" \
  -d '{"tickerPattern": "BINANCE:BTCUSDT.p", "binding": "001"}'

Using explicit fields:

curl -X POST http://127.0.0.1:17845/api/change-ticker \
  -H "Content-Type: application/json" \
  -d '{"exchange": 2, "market": 2, "ticker": "BTCUSDT", "binding": "001"}'

Open Combo

Opens a combo layout for the specified ticker. The ticker field is a symbol (e.g. BTCUSDT), not a pattern — the combo opens on the currently active exchange and market connection. The symbol is normalized: case-insensitive, separators (-, _, /) are stripped, and the SWAP suffix is removed.

POST http://127.0.0.1:{port}/api/combo
Content-Type: application/json

Request body

FieldTypeRequiredDescription
tickerstringyesTrading pair symbol, e.g. "BTCUSDT"

Response

200 OK:

{ "status": "ok" }

400 Bad Request:

ConditionError message
Missing or empty tickerInvalid request body. 'ticker' is required.
Handler not registeredCombo handler not registered

Example

curl -X POST http://127.0.0.1:17845/api/combo \
  -H "Content-Type: application/json" \
  -d '{"ticker": "BTCUSDT"}'

Ticker pattern format

The tickerPattern string follows the TradingView-style format:

EXCHANGE:SYMBOL.suffix
PartRequiredDescription
EXCHANGEnoExchange name (case-insensitive), e.g. BINANCE, BYBIT, OKX. Separated from the symbol by :. If omitted, the colon is also omitted.
SYMBOLyesTrading pair symbol, e.g. BTCUSDT, ETH-USDT. May contain letters, digits, _, /, -, $, and :.
.suffixnoSingle-letter market type suffix preceded by a dot.

Market type suffixes

SuffixMarket type
.pFutures
.mMargin
.oOptions
(none)Spot

Pattern examples

PatternExchangeSymbolMarket
BINANCE:BTCUSDT.pBinanceBTCUSDTFutures
BYBIT:ETHUSDTBybitETHUSDTSpot
OKX:BTC-USDT.mOKXBTC-USDTMargin
BINANCE:BTCUSDT.oBinanceBTCUSDTOptions
HYPERLIQUID:BTCUSDT.pHyperLiquidBTCUSDTFutures
HYPERLIQUID:cash:HOODUSDT0.pHyperLiquidcash:HOODUSDT0Futures
BTCUSDT.p(none)BTCUSDTFutures
BTCUSDT(none)BTCUSDTSpot
Note: The exchange name in the pattern is matched case-insensitively against the exchange names listed in Exchange values below.

Symbol resolution

The symbol part of the pattern is flexible — MetaScalp automatically tries several normalizations to find a match:

StepTransformationExample
1As-is (exact match)cash:HOODUSDT0cash:HOODUSDT0
2UppercasebtcusdtBTCUSDT
3Strip separators (-, _, /)ETH/USDTETHUSDT, SOL_USDTSOLUSDT
4Strip separators + uppercaseeth/usdtETHUSDT
5Remove SWAP suffixBTCUSDTSWAPBTCUSDT
6Preserve prefix before :, uppercase the restcash:hoodUSDT0cash:HOODUSDT0

This means you can pass symbols in any case and with or without common separators (-, _, /) — the API will find the correct ticker.


Exchange values

ValueExchangeNotes
2Binance
3GateIo
4BybitClassic (non-UTA) accounts
5KuCoin
6BybitUtaBybit Unified Trading Account
7Bitget
8Mexc
10Okx
11BingX
12HTX
13BitMart
14LBank
15HyperLiquid
16UpBit
17AsterDex
18Moex
19Lighter
Note: Values 1 and 9 are unused and reserved. Exchange identifiers are not sequential.

MarketType values

ValueTypeDescription
0SpotSpot trading
1FuturesGeneric futures
2UsdtFuturesUSDT-margined futures
3CoinFuturesCoin-margined futures
4InverseFuturesInverse futures
5UsdtPerpetualUSDT perpetual swaps
6UsdcPerpetualUSDC perpetual swaps
7MarginMargin (cross/isolated)
8OptionsOptions contracts
9StockStock / equity markets
Tip: Unsure which market type to use? Use the ticker pattern approach instead — the .p suffix auto-resolves to the right futures type. For explicit fields, 2 (UsdtFutures) is the most common choice for perpetual futures.
Note: When the requested market type is not Spot and no exact connection match is found, MetaScalp falls back to any non-Spot connection on the same exchange.

Integration examples

JavaScript (browser)

async function discoverMetaScalp() {
  for (let port = 17845; port <= 17855; port++) {
    try {
      const r = await fetch(`http://127.0.0.1:${port}/ping`);
      if (r.ok) {
        const data = await r.json();
        if (data.app === "MetaScalp") return port;
      }
    } catch {}
  }
  return null;
}

async function changeTickerByPattern(port, tickerPattern, binding) {
  const body = { tickerPattern };
  if (binding) body.binding = binding;
  const r = await fetch(`http://127.0.0.1:${port}/api/change-ticker`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(body)
  });
  return r.json();
}

async function changeTicker(port, exchange, market, ticker, binding) {
  const r = await fetch(`http://127.0.0.1:${port}/api/change-ticker`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ exchange, market, ticker, binding })
  });
  return r.json();
}

// Usage with ticker pattern
const port = await discoverMetaScalp();
if (port) await changeTickerByPattern(port, "BINANCE:BTCUSDT.p", "001");

// Usage with explicit fields
if (port) await changeTicker(port, 2, 2, "BTCUSDT", "001");

// Without binding — only active window is updated
if (port) await changeTickerByPattern(port, "BINANCE:ETHUSDT.p");

Python

import requests

def discover_metascalp():
    for port in range(17845, 17856):
        try:
            r = requests.get(f"http://127.0.0.1:{port}/ping", timeout=0.5)
            if r.ok and r.json().get("app") == "MetaScalp":
                return port
        except requests.ConnectionError:
            continue
    return None

def change_ticker_by_pattern(port, ticker_pattern, binding=None):
    payload = {"tickerPattern": ticker_pattern}
    if binding:
        payload["binding"] = binding
    r = requests.post(f"http://127.0.0.1:{port}/api/change-ticker", json=payload)
    return r.json()

def change_ticker(port, exchange, market, ticker, binding=None):
    payload = {"exchange": exchange, "market": market, "ticker": ticker}
    if binding:
        payload["binding"] = binding
    r = requests.post(f"http://127.0.0.1:{port}/api/change-ticker", json=payload)
    return r.json()

def open_combo(port, ticker):
    r = requests.post(f"http://127.0.0.1:{port}/api/combo", json={"ticker": ticker})
    return r.json()

# Usage
port = discover_metascalp()
if port:
    change_ticker_by_pattern(port, "BINANCE:BTCUSDT.p", binding="001")
    change_ticker(port, 2, 2, "BTCUSDT", binding="001")
    open_combo(port, "BTCUSDT")