This repo is some SDK of Binance

Related tags

Bot Building Binance
Overview

Binance API Go Language SDK

Go Report Card Build Status codecov license Go Version GoDoc Release Release Date Commit

This is a Binance Go language sdk that uses a method similar to HuobiRDCenter/huobi_Golang

Official Documents

Please make sure you have read the Binance API document before continuing.

Precautions

You are very welcome to submit issues or pull requests to share with this project to make the project more perfect

  • spot/client/wallet.go:Line602 WAPIAssetDetail()

    The result types returned by minWithdrawAmount and withdrawFee are sometimes inconsistent, leading to running bugs. Currently, it has been parsed as interface{}. It is recommended to use this method of SAPI instead of this method.

  • spot/client/market.go:Line185 GetCandlestick()

    It is not recommended using this method, this method may have type errors, please use websocket subscription to obtain data.

List of implemented APIs

The following table shows the functions included in this SDK

Spot/Margin/Savings/Mining

Category Client Access Type
Common System Status RESTful API
System Status (SAPI) RESTful API
Test Connectivity RESTful API
Check ServerTime RESTful API
Wallet All Coin's Information RESTful API
Daily Account Snapshot RESTful API
Disabled/Enabled Fast Withdraw RESTful API
Withdraw (SAPI) RESTful API
Withdraw RESTful API
Deposit History(supporting network) RESTful API
Deposit History RESTful API
Withdraw History(supporting network) RESTful API
Withdraw History RESTful API
Deposit Address(supporting network) RESTful API
Deposit Address RESTful API
Account Status RESTful API
Account Status (SAPI) RESTful API
Account API Trading Status RESTful API
Account API Trading Status (SAPI) RESTful API
DustLog RESTful API
DustLog (SAPI) RESTful API
Dust Transfer RESTful API
Asset Dividend Record RESTful API
Asset Detail RESTful API
Asset Detail (SAPI) RESTful API
Trade Fee RESTful API
Trade Fee (SAPI) RESTful API
User Universal Transfer RESTful API
Query User Universal Transfer History RESTful API

USDⓈ-M Futures

Category Client Access Type
Market Aggregate Trade WebSocket
Market Price WebSocket
All Market Price WebSocket
Kline/Candlestick WebSocket
Continuous Candlestick WebSocket
Individual Symbol Mini Ticker WebSocket
All Market Mini Tickers WebSocket
Individual Symbol Ticker WebSocket
All Book Tickers WebSocket
Liquidation Order WebSocket
All Market Liquidation Orders WebSocket
Partial Book Depth WebSocket
Diff. Book Depth WebSocket
BLVT Info WebSocket
BLVT NAV Kline/Candlestick WebSocket
Composite Index Symbol WebSocket

Usage

Below are some examples of usage

RESTful wallet transfer

Examples of user transfers in the universal

package spotclient

import (
	binance "github.com/dirname/Binance"
	"github.com/dirname/Binance/config"
	"github.com/shopspring/decimal"
	"reflect"
	"testing"
	"time"
)

func init() {
	logger.Enable(false)
	walletClient = spotclient.NewWalletClient(config.SpotRestHost, config.AppKey, config.AppSecret)
}

func universalTransfer() {
	response, err := walletClient.UniversalTransfer("UMFUTURE_MAIN", "USDT", "10", 0)
	if err != nil {
		logger.Error("universalTransfer err: %s", err.Error())
	}
	switch response.(type) {
	case model.APIErrorResponse:
		logger.Info("universalTransfer API error: %v", response.(model.APIErrorResponse))
	case spotclient.UniversalTransferResponse:
		logger.Info("universalTransfer: %v", response.(spotclient.UniversalTransferResponse))
	default:
		logger.Info("universalTransfer Unknown response: %v", response)
	}
}

WebSocket market quotes

Take the Kline of the USDⓈ-M Futures as an example

package main

import (
	"fmt"
	"github.com/dirname/Binance/futures/usdt/websocket/market"
	logger "github.com/dirname/Binance/logging"
	"github.com/dirname/Binance/model"
)

func main() {
	client := futuresusdt.NewUSDTFuturesCandlestickWebsocketClient("[email protected]_1m")
	client.SetHandler(func() {
		client.Subscribe(123, "[email protected]_1m", "[email protected]_5m")
		client.SetCombined(true, 123)
	}, func(response interface{}) {
		switch response.(type) {
		case futuresusdt.CandlestickResponse:
			logger.Info("Candlestick Response: %v", response.(futuresusdt.CandlestickResponse))
		case futuresusdt.CandlestickCombinedResponse:
			logger.Info("CandlestickCombinedResponse: %v", response.(futuresusdt.CandlestickCombinedResponse))
		case model.WebsocketCommonResponse:
			logger.Info("Websocket Response: %v", response.(model.WebsocketCommonResponse))
		case model.WebsocketErrorResponse:
			logger.Info("Websocket Error Response: %v", response.(model.WebsocketErrorResponse))
		default:
			logger.Info("Unknown Response: %v", response)
		}
	})
	client.Connect(true)
	fmt.Scanln()

	client.Unsubscribe(123, "[email protected]_1m", "[email protected]_5m")
	client.Close()
	logger.Info("Client closed")
}

Disclaimer

This SDK is for personal use and has not been officially produced. They are only used to help users become familiar with API endpoint. Please use it with caution, and expand the R&D according to your own situation.

In addition, the performance and stability of this sdk need to be tested by yourself, and the loss due to performance or stability shall be borne by you

You might also like...
The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain

Binance Smart Chain The goal of Binance Smart Chain is to bring programmability

A Golang SDK for binance API

go-binance A Golang SDK for binance API. All the REST APIs listed in binance API document are implemented, as well as the websocket APIs. For best com

A test repo to demonstrate the current (go1.17.2) issue when trying to use retractA test repo to demonstrate the current (go1.17.2) issue when trying to use retract

test-go-mod-retract This is a test repo to demonstrate the current (go1.17.2) issue when trying to use retract in go.mod to retract a version in a non

I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.
I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.

Go-language I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute. This repo is for pr

This repo houses some Golang introductory files, sample codes and implementations

This repo houses some Golang introductory files, sample codes and implementations. I will be updating it as I keep getting a hang of the language.

This repo introduces a simple server, which provided some APIs for search DAS account's records or reverse records

Prerequisites Install Usage Others Das-Account-Indexer This repo introduces a simple server, which provided some APIs for search DAS account's records

This repo is where I'll be attempting to capture some generic algorithms written in Go

Go Generic Algorithms Welcome friends! 👋 This repo is where I'll be attempting

Yet another Binance Smart Chain client based on TrustFi Network

TrustFi Smart Chain The goal of TrustFi Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Buy crypto low/Sell high on Binance. Simple, powerful configuration, trade multiple assets simultaneously, single binary deployment with no external dependencies!

bnc-trading-bot Download the latest release for your OS This bot automatically trades crypto / fiat assets on Binance.com according to simple, configu

A Binance Chain vanity address generator written in golang.
A Binance Chain vanity address generator written in golang.

VaniBNB A Binance Chain vanity address generator written in golang. For example address ending with 0xkat Raw https://github.com/makevoid/vanieth http

A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.
A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.

CREX 中文 | English CREX 是一个用Golang语言开发的量化交易库。支持tick级别数字币期货平台的回测和实盘。实盘与回测无缝切换,无需更改代码。 回测 示例 @backtest 交易结果 开源策略 https://github.com/coinrust/trading-stra

A go library for consuming Binance Websocket Market Streams

binancestream A go library for consuming Binance Websocket Market Streams This library handles network failures by automatically reconnecting to the w

A Binance Smart Chain client based on the go-ethereum fork

A Binance Smart Chain client based on the go-ethereum fork

A Binance Smart Chain client based on the erigon fork

Erigon Erigon is an implementation of Ethereum (aka "Ethereum client"), on the efficiency frontier, written in Go. System Requirements Usage Getting S

A Binance Chain vanity address generator written in golang

BNC Chain Go SDK The Binance Chain GO SDK provides a thin wrapper around the BNC Chain API for readonly endpoints, in addition to creating and submitt

A Binance Chain vanity address generator written in golang
A Binance Chain vanity address generator written in golang

VaniBNB A Binance Chain vanity address generator written in golang. For example address ending with 0xkat Raw https://github.com/makevoid/vanieth http

Tradingview-2-exchange - Place buy/sell orders in exchange(binance) when trading view strategy raise alert message

TradingView-2-Exchange This application is used to place a buy/sell order in Bin

A Binance Smart Chain client based on the go-ethereum fork

Binance Smart Chain The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Marshmallow provides a flexible and performant JSON unmarshalling in Go. It specializes in dealing with unstructured struct - when some fields are known and some aren't, with zero performance overhead nor extra coding needed.
Marshmallow provides a flexible and performant JSON unmarshalling in Go. It specializes in dealing with unstructured struct - when some fields are known and some aren't, with zero performance overhead nor extra coding needed.

Marshmallow Marshmallow package provides a simple API to perform flexible and performant JSON unmarshalling in Go. Marshmallow specializes in dealing

Releases(v0.1.3)
Owner
Mickey (Ah !)
Mickey (Ah !)
A Telegram Repo For Bots Under Maintenance Which Gives Faster Response To Users

Maintenance Bot A Telegram Repo For Bots Under Maintenance Which Gives Faster Response To Users Requests » Report a Bug | Request Feature Table of Con

HEIMAN PICTURES 9 Mar 21, 2022
Zuri Chat Repo

zurichat Zuri Chat Repo To setup To get the Go server running go to the terminal and enter the zc_core type "go run ." Open the url http://127.0.0.1:8

null 18 Nov 8, 2021
Music recognition bot for Reddit powered by audd.io. Note that the code currently needs some cleaning up and doesn't follow the best practices.

Music recognition bot for Reddit u/auddbot identifies music on Reddit. When someone mentions it or writes a question like "what's the song", it sends

AudD 287 Dec 30, 2022
A Discord Bot written in Go. Provides some fun commands and utility.

asuka About Asuka is a project to finally learn Golang and get comfortable with the language while exploring many different concepts in programming. A

Michael Schwieger 0 Jan 7, 2022
Some utils for echotron's library

echokit A set of utils for Echotron library. A Telegram's Bot libary in pure Go. Usage In order to use echokit in your echotron's project simply impor

DazFather 0 Aug 13, 2022
Telegram bot check your TrainingPeaks profile workouts and send notification if some workouts added or changed

TrainingPeaks Bot Telegram bot check your TrainingPeaks profile workouts and sen

Kotov Alexander 0 Dec 29, 2021
Feishu/Lark Open API Go Sdk, Support ALL Open API and Event Callback.

lark 中文版 README Feishu/Lark Open API Go Sdk, Support ALL Open API and Event Callback. Created By Code Generation. Install go get github.com/chyroc/lar

chyroc 273 Jan 5, 2023
A golang sdk for guild bot

botgo a golang sdk for guild bot 设计模式 分为三个主要模块 openapi 用于请求 http 的 openapi websocket 用于监听事件网关,接收事件消息 oauth 用于处理 oauth 的 token 获取 openapi 接口定义:openapi/

null 191 Dec 28, 2022
Official Go Keybase chat bot SDK

go-keybase-chat-bot Write rich bots for Keybase chat in Go. Installation Make sure to install Keybase. go get -u github.com/keybase/go-keybase-chat-bo

Keybase 105 Nov 13, 2022
This repo is some SDK of Binance

Binance API Go Language SDK This is a Binance Go language sdk that uses a method similar to HuobiRDCenter/huobi_Golang Official Documents Please make

Mickey (Ah !) 591 Jun 1, 2021