ReadonlynameThe name of the exchange
ReadonlytestnetWhether the exchange is connected to testnet
Format an asset to a trading symbol
The base asset (e.g., "ETH")
The quote asset (default: "USDT")
Formatted symbol (e.g., "ETHUSDT")
Parse a symbol into base and quote assets
The trading pair symbol
Object with base and quote assets
Initialize the ghost exchange (no-op since we don't need credentials)
Ignored for ghost exchange
Verify credentials always returns true for ghost exchange
Always true
Set virtual balances for simulated trading This should be called before executing trades to provide the ghost exchange with the user's current virtual portfolio balances from the database.
Array of virtual balances from VirtualPortfolio
Clear virtual balances (useful when switching users or resetting)
Get account balances from the stored virtual balances
Optionalasset: stringOptional asset to filter by
Virtual balances (must be set via setVirtualBalances first)
Get current price for a trading pair from Binance public API
Trading pair symbol (e.g., "BTCUSDT")
Current price information
Get all available trading pairs from Binance
Array of trading pair symbols
Get candlestick/OHLCV data for technical analysis from Binance public API
Trading pair symbol (e.g., "BTCUSDT")
Candle interval (e.g., "1h", "4h", "1d")
Number of candles to fetch (default: 200)
Array of kline data
Get 24-hour ticker statistics from Binance public API
Trading pair symbol (e.g., "BTCUSDT")
24-hour ticker statistics
Simulate a market buy order
Trading pair symbol
Amount to buy
If true, quantity is in quote currency (e.g., USDT)
Simulated order with real price data
Simulate a market sell order
Trading pair symbol
Amount to sell in base currency
Simulated order with real price data
Simulate a limit buy order (executes immediately at limit price for simplicity)
Trading pair symbol
Amount to buy
Limit price
Simulated order
Simulate a limit sell order
Trading pair symbol
Amount to sell
Limit price
Simulated order
Simulate a stop loss order
Trading pair symbol
Amount to sell
Stop trigger price
OptionallimitPrice: numberOptional limit price
Simulated order
Simulate a take profit order
Trading pair symbol
Amount to sell
Take profit trigger price
OptionallimitPrice: numberOptional limit price
Simulated order
Cancel order (always succeeds for ghost exchange)
Order ID to cancel
Trading pair symbol
Always true
Get order - returns a mock filled order
Order ID
Trading pair symbol
Mock order data
Get open orders - always empty for ghost exchange (orders fill instantly)
Optional_symbol: stringTrading pair symbol
Empty array
Ghost exchange implementation for simulated/paper trading
This exchange doesn't place real orders - instead it:
Used for "education" trading mode (ghost trading)
Example