Code Monkey home page Code Monkey logo

universal-binance-api's Introduction

Logo Binance

universal-binance-api

Original project created by @Treast (https://github.com/Treast/universal-binance-api).

An API wrapper for Binance. Build your application faster !

This fork implements correctly the isomorphic-fetch to be able to use this on browser or on node!

Benefits

  • Built with Typescript (autocomplete on request/response)
  • Use native Promises
  • Updated with the latest version

Disclaimer

This library is being written. Some features may be changed as updates are made. Be careful.

I disclaim all responsibility for any loss, injury, claim, liability, or damage of any kind resulting from, arising out of, or any way related to any errors in or omissions from this library.

Installation

	npm install -D universal-binance-api

	yarn add -D universal-binance-api

Usage

Node

const { Binance } = require('universal-binance-api');

const binance = new Binance.Api(API_KEY, TEST_SECRET_KEY, true); // 3rd parameter is testMode. Set explicitly to false if you want to use Live API.

binance
  .spotAllOrders({
    symbol: 'BTCUSDT',
  })
  .then((res) => {
    console.log(res);
  });

Browser

import { Binance } from 'universal-binance-api';

const binance = new Binance.Api(API_KEY, TEST_SECRET_KEY,  true); // 3rd parameter is testMode. Set explicitly to false if you want to use Live API.

binance
.spotNewOrder({
	symbol:  'BTCUSDT',
	side: Binance.EOrderSide.BUY,
	type: Binance.EOrderType.LIMIT,
	quantity:  0.01,
	price:  1000,
	timeInForce: Binance.EOrderTimeInForce.GTC,
.then((res)  =>  {
	console.log(res);
});

Functions

All functions have the same name as described on the official documentation and are prefixed by the domain: https://binance-docs.github.io/apidocs/.

Example: Spot > New Order becomes spotNewOrder

Example: Savings > Purchase Fixed/Activity Project becomes savingsPurchaseFixedActivityProject

Streams

Stream functions return a Websocket instance from the ws package. A cache is set up to prevent opening a same stream twice.

Progress

  • API Structure
  • Wallet endpoints
  • Market endpoints
  • Spot endpoints
  • Margin endpoints
  • Saving endpoints
  • Futures endpoints
  • Streams
  • Mining endpoints
  • BLVT endpoints
  • BSwap endpoints
  • Sub-accounts endpoints
  • Streams typings
  • Better error handling

License

MIT License

universal-binance-api's People

Contributors

treast avatar matheus1lva avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.