All Projects → pdepip → Go Binance

pdepip / Go Binance

Licence: mit
Golang wrapper for Binance API

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Binance

java-binance-api
Java Binance API Client
Stars: ✭ 72 (-15.29%)
Mutual labels:  api-wrapper, binance
Binancedotnet
Official C# Wrapper for the Binance exchange API, with REST and WebSocket endpoints
Stars: ✭ 102 (+20%)
Mutual labels:  api-wrapper, binance
Binance-Asset-Manager
Extension of binance-python to automatically calculate balances and trade any trading pair.
Stars: ✭ 21 (-75.29%)
Mutual labels:  api-wrapper, binance
Binance
A .NET Standard Binance API library.
Stars: ✭ 199 (+134.12%)
Mutual labels:  api-wrapper, binance
Binance.net
.Net API wrapper for the Binance web API
Stars: ✭ 349 (+310.59%)
Mutual labels:  api-wrapper, binance
Avenue
Wrapper around URLSession and URLSessionTask to enable seamless integration with Operation / OperationQueue.
Stars: ✭ 58 (-31.76%)
Mutual labels:  api-wrapper
Psmsgraph
A PowerShell module for the Microsoft Graph API
Stars: ✭ 71 (-16.47%)
Mutual labels:  api-wrapper
Binancescanner
💰 Configurable Cryptocurrency Price & Volume Scanner for Binance
Stars: ✭ 54 (-36.47%)
Mutual labels:  binance
Wikipedir
R's MediaWiki API client library
Stars: ✭ 54 (-36.47%)
Mutual labels:  api-wrapper
Simple Binance Trader
This is a simple trading bot for the binance exchange.
Stars: ✭ 79 (-7.06%)
Mutual labels:  binance
Goex
Exchange Rest And WebSocket API For Golang Wrapper support okcoin,okex,huobi,hbdm,bitmex,coinex,poloniex,bitfinex,bitstamp,binance,kraken,bithumb,zb,hitbtc,fcoin, coinbene
Stars: ✭ 1,188 (+1297.65%)
Mutual labels:  binance
Poloniex
Poloniex python API client for humans
Stars: ✭ 71 (-16.47%)
Mutual labels:  api-wrapper
Crypto Trading Bot
Cryptocurrency trading bot in javascript for Bitfinex, Bitmex, Binance, FTX, Bybit ... (public edition)
Stars: ✭ 1,089 (+1181.18%)
Mutual labels:  binance
Crypto Coin Alerts
An application that let you set alerts for the prices of several cryptocurrencies
Stars: ✭ 72 (-15.29%)
Mutual labels:  binance
Pypoloniex
Python wrapper for calling cryptocurrency data from Poloniex API
Stars: ✭ 57 (-32.94%)
Mutual labels:  api-wrapper
Cryptotik
deprecated
Stars: ✭ 78 (-8.24%)
Mutual labels:  binance
Github
Ruby interface to GitHub API
Stars: ✭ 1,081 (+1171.76%)
Mutual labels:  api-wrapper
Myq Api
An updated API to interface with myQ devices
Stars: ✭ 71 (-16.47%)
Mutual labels:  api-wrapper
Frostybot Js
Frostybot-JS is a cryptocurrency trading API endpoint, designed to execute webhook or REST requests as orders on a variety of well-known exchanges. While primarily designed to automate your Tradingview strategies, Frostybot can also be integrated with any other software using webhooks or REST. Bitmex, FTX, Deribit and Binance are supported.
Stars: ✭ 72 (-15.29%)
Mutual labels:  binance
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-18.82%)
Mutual labels:  api-wrapper

Go Binance API

Summary

Go client for Binance

Installation

go get github.com/pdepip/go-binance/binance

Documentation

Full API Documentation can be found at https://www.binance.com/restapipub.html

Setup

Creating a client:

import (
	"os"
	"go-binance/binance"
)

// Secure method
secret := os.Getenv("BINANCE_SECRET")
key    := os.Getenv("BINANCE_KEY")

// Unsecure method
secret := "mySecret"
key    := "myKey"

client :=  binance.New(secret, key)

Examples

Get Current Positions

package main

import (
    "os"
    "fmt"
    "github.com/pdepip/go-binance/binance"
)

func main() {

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    positions, err := client.GetPositions()

    if err != nil {
        panic(err)
    }

    for _, p := range positions {
        fmt.Println(p.Asset, p.Free, p.Locked)
    }
}

Place a Limit Order

package main

import (
	"os"
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {
    // Params
    order := binance.LimitOrder {
        Symbol:      "BNBBTC",
        Side:        "BUY",
        Type:        "LIMIT",
        TimeInForce: "GTC",
        Quantity:    50.0,
        Price:       0.00025,
    }

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    res, err := client.PlaceLimitOrder(order)
    
    if err != nil {
    	panic(err)
    }
    
    fmt.Println(res)
}

Place a Market Order

package main

import (
	"os"
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {
    // Params
    order := binance.MarketOrder {
        Symbol:   "BNBBTC",
        Side:     "BUY",
        Type:     "MARKET",
        Quantity: 50.0,
    }

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    res, err := client.PlaceMarketOrder(order)
    
    if err != nil {
    	panic(err)
    }
    
    fmt.Println(res)
}

Check Order Status

import (
	"os"
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {
    // Params
    orderQuery := binance.OrderQuery {
        Symbol:  "BNBBTC",
        OrderId: "yourOrderId",
    }

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    res, err := client.CheckOrder(orderQuery)
    
    if err != nil {
    	panic(err)
    }
    
    fmt.Println(res)
}

Cancel an Order

import (
	"os"
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {
    // Params
    orderQuery := binance.OrderQuery {
        Symbol:  "BNBBTC",
        OrderId: "yourOrderId",
    }

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    res, err := client.CancelOrder(orderQuery)
    
    if err != nil {
    	panic(err)
    }
    
    fmt.Println(res)
}

Get Open Orders


import (
	"os"
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {
    // Params
    orderQuery := binance.OpenOrdersQuery {
        Symbol: "BNBBTC",
    }

    client := binance.New(os.Getenv("BINANCE_KEY"), os.Getenv("BINANCE_SECRET"))
    res, err := client.GetOpenOrders(orderQuery)
    
    if err != nil {
    	panic(err)
    }
    
    fmt.Println(res)
}

Get the Order Book

import (
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {

    // Params
    query := binance.OrderBookQuery {
        Symbol: "BNBBTC",
        Limit: 100,
    }

    client := binance.New("", "")
    res, err := client.GetOrderBook(query)

    if err != nil {
        panic(err)
    }
    
    fmt.Println(res)

}

Get Latest Price of a Symbol

import (
	"fmt"
	"github.com/pdepip/go-binance/binance"
)

func main() {

    // Params
    query := binance.SymbolQuery {
        Symbol: "BNBBTC",
    }

    client := binance.New("", "")
    res, err := client.GetLastPrice(query)

    if err != nil {
        panic(err)
    }
    
    fmt.Println(res)

}

Local Depth Cache

See examples/depth.go. Script connects to Binance websocket and maintains a simple local depth cache.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].