Skip to content

singlesly/bingx-api

This branch is up to date with main.

Folders and files

NameName
Last commit message
Last commit date
Oct 11, 2023
Feb 25, 2024
Oct 10, 2023
Oct 9, 2023
Oct 12, 2023
Oct 9, 2023
Oct 10, 2023
Jan 23, 2024
Oct 9, 2023
Feb 1, 2024
Feb 1, 2024
Oct 12, 2023
Oct 18, 2023

Repository files navigation

Bingx API NodeJS Client

This library implements Bingx API for nodejs applications

CodeQL Release ESLint

Getting started

  • Install via npm
npm i bingx-api -S
  • Initialize Client
import { ApiAccount, BingxApiClient } from 'bingx-api';
const account = new ApiAccount('xxx', 'xxx');

const client = new BingxApiClient();
  • Make any requests from api to bingx
const userBalance = await client
                  .getAccountService()
                  .getPerpetualSwapAccountAssetInformation();
  • Works with sockets
const account = new ApiAccount('xxx', 'xxx');
stream = new BingxAccountSocketStream(account);

stream.heartbeat$.subscribe((v) => {})

stream.listenKeyExpired$.subscribe((v) => {})

stream.accountBalanceAndPositionPush$.subscribe((v) => {})

stream.accountOrderUpdatePushEvent$.subscribe((v) => {})
stream = new BingxMarketSocketStream(account);

stream.subscribe('BTC-USDT@trade');

stream.latestTradeDetail$.subscribe((v) => {})

Features supports

  • Account Interface
    • Get Perpetual Swap Account Asset Information
    • Perpetual Swap Positions
    • Get Account Profit and Loss Fund Flow
    • Export fund flow
    • User fee rate
  • Trade Interface
    • Trade order test
    • Trade order
    • Bulk order
    • One-Click Close All Positions
    • Cancel an Order
    • Cancel a Batch of Orders
    • Cancel All Orders
    • Query all current pending orders
    • Query Order
    • Query Margin Mode
    • Switch Margin Mode
    • Query Leverage
    • Switch Leverage
    • User's Force Orders
    • User's History Orders
    • Adjust isolated margin
    • Query historical transaction orders
  • Listen Key
    • Generate Listen Key
    • Extend Listen Key Validity period
    • Delete Listen Key
  • Socket API
    • Market Data
      • Subscribe Market Depth Data
      • Subscribe the Latest Trade Detail
      • Subscribe K-Line Data
    • Account Data
      • Listen Key expired push
      • Account balance and position update push
      • Order update push
      • Configuration updates such as leverage and margin mode