binance-futures-wrapper
Version:
A comprehensive TypeScript wrapper for Binance USDT-M Futures API with full REST and WebSocket support
478 lines • 11.9 kB
JavaScript
"use strict";
/**
* REST API endpoints configuration for Binance Futures
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ENDPOINTS = exports.USER_STREAM_ENDPOINTS = exports.ACCOUNT_ENDPOINTS = exports.MARKET_ENDPOINTS = void 0;
// Market Data Endpoints
exports.MARKET_ENDPOINTS = {
// Test connectivity
PING: {
method: 'GET',
path: '/fapi/v1/ping',
endpoint: 'ping',
signed: false,
weight: 1
},
// Check server time
TIME: {
method: 'GET',
path: '/fapi/v1/time',
endpoint: 'time',
signed: false,
weight: 1
},
// Exchange information
EXCHANGE_INFO: {
method: 'GET',
path: '/fapi/v1/exchangeInfo',
endpoint: 'exchangeInfo',
signed: false,
weight: 1
},
// Order book
ORDER_BOOK: {
method: 'GET',
path: '/fapi/v1/depth',
endpoint: 'depth',
signed: false,
weight: 5
},
// Recent trades list
TRADES: {
method: 'GET',
path: '/fapi/v1/trades',
endpoint: 'trades',
signed: false,
weight: 1
},
// Old trade lookup (MARKET_DATA)
HISTORICAL_TRADES: {
method: 'GET',
path: '/fapi/v1/historicalTrades',
endpoint: 'historicalTrades',
signed: false,
weight: 5
},
// Compressed/Aggregate trades list
AGG_TRADES: {
method: 'GET',
path: '/fapi/v1/aggTrades',
endpoint: 'aggTrades',
signed: false,
weight: 1
},
// Kline/Candlestick data
KLINES: {
method: 'GET',
path: '/fapi/v1/klines',
endpoint: 'klines',
signed: false,
weight: 1
},
// Continuous contract kline/candlestick data
CONTINUOUS_KLINES: {
method: 'GET',
path: '/fapi/v1/continuousKlines',
endpoint: 'continuousKlines',
signed: false,
weight: 1
},
// Index price kline/candlestick data
INDEX_PRICE_KLINES: {
method: 'GET',
path: '/fapi/v1/indexPriceKlines',
endpoint: 'indexPriceKlines',
signed: false,
weight: 1
},
// Mark price kline/candlestick data
MARK_PRICE_KLINES: {
method: 'GET',
path: '/fapi/v1/markPriceKlines',
endpoint: 'markPriceKlines',
signed: false,
weight: 1
},
// Mark price
MARK_PRICE: {
method: 'GET',
path: '/fapi/v1/premiumIndex',
endpoint: 'premiumIndex',
signed: false,
weight: 1
},
// Get funding rate history
FUNDING_RATE: {
method: 'GET',
path: '/fapi/v1/fundingRate',
endpoint: 'fundingRate',
signed: false,
weight: 1
},
// 24hr ticker price change statistics
TICKER_24HR: {
method: 'GET',
path: '/fapi/v1/ticker/24hr',
endpoint: 'ticker/24hr',
signed: false,
weight: 1
},
// Symbol price ticker
TICKER_PRICE: {
method: 'GET',
path: '/fapi/v1/ticker/price',
endpoint: 'ticker/price',
signed: false,
weight: 1
},
// Symbol order book ticker
TICKER_BOOK: {
method: 'GET',
path: '/fapi/v1/ticker/bookTicker',
endpoint: 'ticker/bookTicker',
signed: false,
weight: 1
},
// Open interest
OPEN_INTEREST: {
method: 'GET',
path: '/fapi/v1/openInterest',
endpoint: 'openInterest',
signed: false,
weight: 1
},
// Open interest statistics
OPEN_INTEREST_STATISTICS: {
method: 'GET',
path: '/futures/data/openInterestHist',
endpoint: 'openInterestHist',
signed: false,
weight: 1
},
// Top trader long/short ratio (accounts)
TOP_LONG_SHORT_ACCOUNT_RATIO: {
method: 'GET',
path: '/futures/data/topLongShortAccountRatio',
endpoint: 'topLongShortAccountRatio',
signed: false,
weight: 1
},
// Top trader long/short ratio (positions)
TOP_LONG_SHORT_POSITION_RATIO: {
method: 'GET',
path: '/futures/data/topLongShortPositionRatio',
endpoint: 'topLongShortPositionRatio',
signed: false,
weight: 1
},
// Long/short ratio
GLOBAL_LONG_SHORT_ACCOUNT_RATIO: {
method: 'GET',
path: '/futures/data/globalLongShortAccountRatio',
endpoint: 'globalLongShortAccountRatio',
signed: false,
weight: 1
},
// Taker long/short ratio
TAKER_LONG_SHORT_RATIO: {
method: 'GET',
path: '/futures/data/takerlongshortRatio',
endpoint: 'takerlongshortRatio',
signed: false,
weight: 1
},
// Historical BLVT NAV kline/candlestick
BLVT_NAV_KLINES: {
method: 'GET',
path: '/fapi/v1/lvtKlines',
endpoint: 'lvtKlines',
signed: false,
weight: 1
},
// Composite index symbol information
COMPOSITE_INDEX: {
method: 'GET',
path: '/fapi/v1/indexInfo',
endpoint: 'indexInfo',
signed: false,
weight: 1
},
// Multi-assets mode asset index
MULTI_ASSETS_MODE: {
method: 'GET',
path: '/fapi/v1/assetIndex',
endpoint: 'assetIndex',
signed: false,
weight: 1
}
};
// Account/Trade Endpoints
exports.ACCOUNT_ENDPOINTS = {
// Change position mode
POSITION_MODE: {
method: 'POST',
path: '/fapi/v1/positionSide/dual',
endpoint: 'positionSide/dual',
signed: true,
weight: 1
},
// Get current position mode
GET_POSITION_MODE: {
method: 'GET',
path: '/fapi/v1/positionSide/dual',
endpoint: 'positionSide/dual',
signed: true,
weight: 30
},
// Change multi-assets mode
MULTI_ASSETS_MODE: {
method: 'POST',
path: '/fapi/v1/multiAssetsMargin',
endpoint: 'multiAssetsMargin',
signed: true,
weight: 1
},
// Get current multi-assets mode
GET_MULTI_ASSETS_MODE: {
method: 'GET',
path: '/fapi/v1/multiAssetsMargin',
endpoint: 'multiAssetsMargin',
signed: true,
weight: 30
},
// New order
ORDER: {
method: 'POST',
path: '/fapi/v1/order',
endpoint: 'order',
signed: true,
weight: 1
},
// Modify order
MODIFY_ORDER: {
method: 'PUT',
path: '/fapi/v1/order',
endpoint: 'order',
signed: true,
weight: 1
},
// Place multiple orders
BATCH_ORDERS: {
method: 'POST',
path: '/fapi/v1/batchOrders',
endpoint: 'batchOrders',
signed: true,
weight: 5
},
// Modify multiple orders
MODIFY_BATCH_ORDERS: {
method: 'PUT',
path: '/fapi/v1/batchOrders',
endpoint: 'batchOrders',
signed: true,
weight: 5
},
// Query order
GET_ORDER: {
method: 'GET',
path: '/fapi/v1/order',
endpoint: 'order',
signed: true,
weight: 1
},
// Cancel order
CANCEL_ORDER: {
method: 'DELETE',
path: '/fapi/v1/order',
endpoint: 'order',
signed: true,
weight: 1
},
// Cancel all open orders
CANCEL_ALL_ORDERS: {
method: 'DELETE',
path: '/fapi/v1/allOpenOrders',
endpoint: 'allOpenOrders',
signed: true,
weight: 1
},
// Cancel multiple orders
CANCEL_BATCH_ORDERS: {
method: 'DELETE',
path: '/fapi/v1/batchOrders',
endpoint: 'batchOrders',
signed: true,
weight: 1
},
// Auto-cancel all open orders
AUTO_CANCEL_ALL_ORDERS: {
method: 'POST',
path: '/fapi/v1/countdownCancelAll',
endpoint: 'countdownCancelAll',
signed: true,
weight: 10
},
// Query current open order
GET_OPEN_ORDER: {
method: 'GET',
path: '/fapi/v1/openOrder',
endpoint: 'openOrder',
signed: true,
weight: 1
},
// Current all open orders
GET_OPEN_ORDERS: {
method: 'GET',
path: '/fapi/v1/openOrders',
endpoint: 'openOrders',
signed: true,
weight: 1
},
// All orders
GET_ALL_ORDERS: {
method: 'GET',
path: '/fapi/v1/allOrders',
endpoint: 'allOrders',
signed: true,
weight: 5
},
// Futures account balance
BALANCE: {
method: 'GET',
path: '/fapi/v2/balance',
endpoint: 'balance',
signed: true,
weight: 1
},
// Account information
ACCOUNT: {
method: 'GET',
path: '/fapi/v2/account',
endpoint: 'account',
signed: true,
weight: 5
},
// Change initial leverage
LEVERAGE: {
method: 'POST',
path: '/fapi/v1/leverage',
endpoint: 'leverage',
signed: true,
weight: 1
},
// Change margin type
MARGIN_TYPE: {
method: 'POST',
path: '/fapi/v1/marginType',
endpoint: 'marginType',
signed: true,
weight: 1
},
// Modify isolated position margin
POSITION_MARGIN: {
method: 'POST',
path: '/fapi/v1/positionMargin',
endpoint: 'positionMargin',
signed: true,
weight: 1
},
// Get position margin change history
POSITION_MARGIN_HISTORY: {
method: 'GET',
path: '/fapi/v1/positionMargin/history',
endpoint: 'positionMargin/history',
signed: true,
weight: 1
},
// Position information
POSITION_RISK: {
method: 'GET',
path: '/fapi/v2/positionRisk',
endpoint: 'positionRisk',
signed: true,
weight: 5
},
// Account trade list
USER_TRADES: {
method: 'GET',
path: '/fapi/v1/userTrades',
endpoint: 'userTrades',
signed: true,
weight: 5
},
// Get income history
INCOME: {
method: 'GET',
path: '/fapi/v1/income',
endpoint: 'income',
signed: true,
weight: 30
},
// Notional and leverage brackets
LEVERAGE_BRACKET: {
method: 'GET',
path: '/fapi/v1/leverageBracket',
endpoint: 'leverageBracket',
signed: true,
weight: 1
},
// Position ADL quantile estimation
ADL_QUANTILE: {
method: 'GET',
path: '/fapi/v1/adlQuantile',
endpoint: 'adlQuantile',
signed: true,
weight: 5
},
// User's force orders
FORCE_ORDERS: {
method: 'GET',
path: '/fapi/v1/forceOrders',
endpoint: 'forceOrders',
signed: true,
weight: 1
},
// User API trading quantitative rules indicators
API_TRADING_STATUS: {
method: 'GET',
path: '/fapi/v1/apiTradingStatus',
endpoint: 'apiTradingStatus',
signed: true,
weight: 1
}
};
// User Data Stream Endpoints
exports.USER_STREAM_ENDPOINTS = {
// Start user data stream
USER_STREAM_START: {
method: 'POST',
path: '/fapi/v1/listenKey',
endpoint: 'listenKey',
signed: false,
weight: 1
},
// Keepalive user data stream
USER_STREAM_KEEPALIVE: {
method: 'PUT',
path: '/fapi/v1/listenKey',
endpoint: 'listenKey',
signed: false,
weight: 1
},
// Close user data stream
USER_STREAM_CLOSE: {
method: 'DELETE',
path: '/fapi/v1/listenKey',
endpoint: 'listenKey',
signed: false,
weight: 1
}
};
// All endpoints combined
exports.ENDPOINTS = {
...exports.MARKET_ENDPOINTS,
...exports.ACCOUNT_ENDPOINTS,
...exports.USER_STREAM_ENDPOINTS
};
//# sourceMappingURL=endpoints.js.map