npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

binance-futures-api

v0.2.0

Published

Futures API for Binance market

Downloads

7

Readme

binance-futures-api

npm version npm npm

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