Web API Reference

Complete API documentation for integrating with EDISON's web interface. All endpoints are available through the BotWebAPI class.

getMarketData()

Get current market data including price, indicators, and trend analysis.

const data = api.getMarketData();

Returns:

currentPrice: number - Current symbol price
priceChangePercent: number - 24h price change %
rsi: number - RSI indicator value (0-100)
ema20: number - 20-period EMA
ema50: number - 50-period EMA
atr: number - Average True Range volatility
trend: string - 'UPTREND' | 'DOWNTREND' | 'NEUTRAL'
btcCorrelation: number - BTC correlation strength (optional)
nearestLevel: number - Nearest support/resistance (optional)
distanceToLevel: number - Distance to nearest level (optional)

getCandles(timeframe, limit)

Get candlestick data for charting. Data is updated in real-time as new candles form.

const candles = await api.getCandles('5m', 100);

Parameters:

timeframe: string - '1m' | '5m' | '15m' | '30m' | '60m' | '1h'
limit: number - Max candles to return (default: 100)

Returns: Candle[]

open: number
high: number
low: number
close: number
volume: number
timestamp: number

getPositionHistory(limit)

Get closed positions/trades from the trading journal. Shows entry/exit prices, P&L, and timestamps.

const positions = await api.getPositionHistory(50);

Parameters:

limit: number - Max positions to return (default: 50)

Returns: Position[]

id: string - Position ID
side: 'LONG' | 'SHORT'
entryPrice: number
entryTime: number - Timestamp
exitPrice: number
exitTime: number - Timestamp
pnl: number - Profit/Loss in quote asset
quantity: number
status: 'OPEN' | 'CLOSED'

getOrderBook(symbol)

Get current orderbook snapshot with bid/ask levels and cumulative volumes.

const book = await api.getOrderBook('BTCUSDT');

Parameters:

symbol: string - Trading pair (e.g., 'BTCUSDT')

Returns:

symbol: string
bids: Level[] - Buy orders
asks: Level[] - Sell orders
Level: { price: number, quantity: number, cumulative: number }
timestamp: number

getWalls(symbol)

Get detected whale walls (large orders) on the orderbook. Identifies significant buy/sell pressure.

const walls = await api.getWalls('BTCUSDT');

Parameters:

symbol: string - Trading pair

Returns:

symbol: string
walls: Wall[]
Wall: { side: 'BUY'|'SELL', price: number, quantity: number, strength: number, detected: boolean }

getFundingRate(symbol)

Get current funding rate and next funding time. Critical for predicting price movements on futures.

const funding = await api.getFundingRate('BTCUSDT');

Returns:

symbol: string
current: number - Current funding rate (8h)
predicted: number - Predicted next rate
nextFundingTime: number - Next payment timestamp
lastFundingTime: number - Last payment timestamp

getVolumeProfile(symbol, levels)

Get volume profile showing price distribution of trading volume. Identifies support/resistance and liquidity zones.

const profile = await api.getVolumeProfile('BTCUSDT', 20);

Parameters:

symbol: string - Trading pair
levels: number - Price buckets (default: 20)

Returns:

symbol: string
levels: string[] - Price levels ($X.XX format)
volumes: number[] - Volume at each level
maxVolume: number - Peak volume for scaling

Complete Usage Example

import { BotWebAPI } from './api/bot-web-api';
import { BotServices } from './services/bot-services';
// Initialize with bot services
const services = new BotServices(...);
const api = new BotWebAPI(services);
// Get market data
const data = api.getMarketData();
console.log(`Trend: ${data.trend}, Price: $${data.currentPrice}`);
// Get candles and analyze
const candles = await api.getCandles('5m', 50);
const chart = candles.map(c => ({ time: c.timestamp, price: c.close }));
// Check wall activity
const walls = await api.getWalls('BTCUSDT');
if (walls.walls.length > 0) {
console.log('Whale walls detected:', walls.walls);
}

📌 Important Notes

  • ✓ All async methods return data from cached providers (non-blocking)
  • ✓ Market data is updated in real-time as new candles form
  • ✓ Position history includes both open and closed trades from the journal
  • ✓ Orderbook data represents the current snapshot at call time
  • ✓ Wall strength is calculated based on order size relative to average volume
  • ✓ Volume profile aggregates data from recent candles (PRIMARY timeframe, ~100 candles)
  • ✓ All timestamps are Unix milliseconds