binance-futures-api
v0.2.0
Published
Futures API for Binance market
Downloads
4
Readme
binance-futures-api
Futures API for Binance market
Installation
npm install --save binance-futures-api
Getting started
import { BinanceFAPI } from 'binance-futures-api';
const binanceFAPI = new BinanceFAPI(API_KEY, API_SECRET);
Tip: For "Market" methods you don't need API_KEY and API_SECRET
API
Market
Test Connectivity
await binanceFAPI.testConnectivity();
Check Server Time
await binanceFAPI.checkServerTime();
Exchange Information
await binanceFAPI.exchangeInfo({ symbols: JSON.stringify(['BTCUSDT', 'ETHUSDT']) });
Order Book
await binanceFAPI.orderBook({ symbol: 'BTCUSDT' });
Recent Trades List
await binanceFAPI.recentTrades({
symbol: 'BTCUSDT',
limit: 10,
});
Compressed/Aggregate Trades List
await binanceFAPI.compressedTrades({
symbol: 'BTCUSDT',
startTime: new Date().getTime(),
endTime: new Date().getTime(),
limit: 10,
});
Kline/Candlestick Data
await binanceFAPI.klines({
symbol: 'BTCUSDT',
interval: '15m',
startTime: new Date().getTime() - 24 * 60 * 60 * 1000,
endTime: new Date().getTime(),
limit: 10,
});
Continuous Contract Kline/Candlestick Data
await binanceFAPI.continuousKlines({
pair: 'BTCUSDT',
contractType: 'PERPETUAL',
interval: '15m',
startTime: new Date().getTime() - 24 * 60 * 60 * 1000,
endTime: new Date().getTime(),
limit: 10,
});
Mark Price Kline/Candlestick Data
await binanceFAPI.markPriceKlines({
symbol: 'BTCUSDT',
interval: '15m',
startTime: new Date().getTime() - 24 * 60 * 60 * 1000,
endTime: new Date().getTime(),
limit: 10,
});
Mark Price
await binanceFAPI.markPrice({ symbol: 'BTCUSDT' });
Get Funding Rate History
await binanceFAPI.fundingRateHistory({
symbol: 'BTCUSDT',
startTime: new Date().getTime() - 24 * 60 * 60 * 1000,
endTime: new Date().getTime(),
limit: 10,
});
24hr Ticker Price Change Statistics
await binanceFAPI.get24hTickerPrice({ symbol: 'BTCUSDT' });
Symbol Price Ticker
await binanceFAPI.symbolPriceTicker({ symbol: 'BTCUSDT' });
Symbol Order Book Ticker
await binanceFAPI.symbolOrderBookTicker({ symbol: 'BTCUSDT' });
Open Interest
await binanceFAPI.openInterest({ symbol: 'BTCUSDT' });
Open Interest Statistics
await binanceFAPI.openInterestStatistics({
symbol: 'BTCUSDT',
period: '1h',
limit: 10,
});
Top Trader Long/Short Ratio (Accounts)
await binanceFAPI.topLongShortAccountRatio({
symbol: 'BTCUSDT',
period: '1h',
limit: 10,
});
Top Trader Long/Short Ratio (Positions)
await binanceFAPI.topLongShortPositionRatio({
symbol: 'BTCUSDT',
period: '1h',
limit: 10,
});
Long/Short Ratio
await binanceFAPI.globalLongShortAccountRatio({
symbol: 'BTCUSDT',
period: '1h',
limit: 10,
});
Taker Buy/Sell Volume
await binanceFAPI.topTraderLongShortRatio({
symbol: 'BTCUSDT',
period: '1h',
limit: 10,
});
Composite Index Symbol Information
await binanceFAPI.compositeIndexSymbolInfo({ symbol: 'DEFIUSDT' });
Multi-Assets Mode Asset Index
await binanceFAPI.multiAssetsModeAssetIndex({ symbol: 'BTCUSD' });
Account
Account Information
await binanceFAPI.accountInfo();
Get Income History
await binanceFAPI.getIncomeHistory();
Position Information
await binanceFAPI.positionInfo();
Account Trade List
await binanceFAPI.accountTradeList();
Future Account Balance
await binanceFAPI.accountBalance();
Notional and Leverage Brackets (USER_DATA)
await binanceFAPI.leverageBrackets();
Position ADL Quantile Estimation (USER_DATA)
await binanceFAPI.positionADLQuantile();
User Commission Rate (USER_DATA)
await binanceFAPI.userCommissionRate({ symbol: 'BTCUSDT' });
Get Current Multi-Assets Mode
await binanceFAPI.getCurrentMultiAssetsMode();
Change Multi-Assets Mode
await binanceFAPI.changeMultiAssetsMode({ multiAssetsMargin: false });
Order
New Order (TRADE)
await binanceFAPI.newOrder({
symbol: 'BTCUSDT',
side: 'BUY',
type: 'MARKET',
quantity: 1,
});
Place Multiple Orders (TRADE)
await binanceFAPI.placeMultipleOrders({ batchOrders: [] });
Query Order
await binanceFAPI.queryOrder({ symbol: 'BTCUSDT' });
Cancel Order
await binanceFAPI.cancelOrder({ symbol: 'BTCUSDT' });
Cancel All Open Orders
await binanceFAPI.cancelAllOpenOrders({ symbol: 'BTCUSDT' });
Auto-Cancel All Open Orders (TRADE)
await binanceFAPI.autoCancelAllOpenOrders({ symbol: 'BTCUSDT' });
Cancel Multiple Orders (TRADE)
await binanceFAPI.cancelMultipleOrders({ symbol: 'BTCUSDT' });
Current All Open Orders (USER_DATA)
await binanceFAPI.getCurrentAllOpenOrders({ symbol: 'BTCUSDT' });
Query Current Open Order (USER_DATA)
await binanceFAPI.queryCurrentOpenOrder({ symbol: 'BTCUSDT' });
All Orders
await binanceFAPI.allOrders({
symbol: 'BTCUSDT',
limit: 10,
});
User's Force Orders (USER_DATA)
await binanceFAPI.getForceOrders({
symbol: 'BTCUSDT',
limit: 10,
});
Trade
Change Margin Type
await binanceFAPI.changeMarginType({
symbol: 'BTCUSDT',
marginType: 'ISOLATED',
});
Change Initial Leverage
await binanceFAPI.changeInitialLeverage({
symbol: 'BTCUSDT',
leverage: 20,
});
Modify Isolated Position Margin
await binanceFAPI.modifyIsolatedPositionMargin({
symbol: 'BTCUSDT',
positionSide: 'BOTH',
amount: 100,
});
Get Position Margin Change History
await binanceFAPI.getPositionMarginChangeHistory({
symbol: 'BTCUSDT',
limit: 10,
});
Change Position Mode (TRADE)
await binanceFAPI.changePositionMode({ dualSidePosition: false });
Get Current Position Mode (USER_DATA)
await binanceFAPI.getCurrentPositionMode();
User API Trading Quantitative Rules Indicators (USER_DATA)
await binanceFAPI.getTradingStatus({ symbol: 'BTCUSDT' });
Data Stream
Create Listen Key
await binanceFAPI.createListenKey();
Renew Listen Key
await binanceFAPI.renewListenKey();
Delete Listen Key
await binanceFAPI.deleteListenKey();
Full data for methods according to Binance API