https://github.com/xenking/binance-api
Binance-API is a fast and lightweight Golang implementation for Binance API, providing complete API coverage, and supports both REST API, WebSockets API, Event Streams API
https://github.com/xenking/binance-api
api binance binance-api binance-exchange bitcoin btc exchange go goland sdk
Last synced: 5 months ago
JSON representation
Binance-API is a fast and lightweight Golang implementation for Binance API, providing complete API coverage, and supports both REST API, WebSockets API, Event Streams API
- Host: GitHub
- URL: https://github.com/xenking/binance-api
- Owner: xenking
- License: mit
- Created: 2020-11-30T04:22:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T02:15:11.000Z (almost 3 years ago)
- Last Synced: 2024-06-19T11:21:57.820Z (almost 2 years ago)
- Topics: api, binance, binance-api, binance-exchange, bitcoin, btc, exchange, go, goland, sdk
- Language: Go
- Homepage:
- Size: 226 KB
- Stars: 8
- Watchers: 2
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Golang Binance API
[](https://pkg.go.dev/github.com/xenking/binance-api)
[](https://goreportcard.com/report/github.com/xenking/binance-api)

[](https://codecov.io/gh/xenking/binance-api)
binance-api is a fast and lightweight Golang implementation for [Binance API](https://github.com/binance/binance-spot-api-docs), providing complete API coverage, and supports both REST API and websockets API
This library created to help you interact with the Binance API, streaming candlestick charts data, market depth, or use other advanced features binance exposes via API.
## Quickstart
```golang
package main
import (
"log"
"github.com/xenking/binance-api"
)
func main() {
client := binance.NewClient("API-KEY", "SECRET")
err := client.Ping()
if err != nil {
panic(err)
}
prices, err := client.Prices()
if err != nil {
panic(err)
}
for _, p := range prices {
log.Printf("symbol: %s, price: %s", p.Symbol, p.Price)
}
}
```
## Installation
```
go get -u github.com/xenking/binance-api
```
## Getting started
```golang
// Create default client
client := binance.NewClient("API-KEY", "SECRET")
// Send ping request
err := client.Ping()
// Create client with custom request window size
client := binance.NewClient("API-KEY", "SECRET").ReqWindow(5000)
// Create websocket client
wsClient := ws.NewClient()
// Connect to Klines websocket
ws, err := wsClient.Klines("ETHBTC", binance.KlineInterval1m)
// Read ws
msg, err := ws.Read()
```
Full documentation on [pkg.go.dev](https://pkg.go.dev/github.com/xenking/binance-api)
## License
This library is under the [MIT License](https://opensource.org/licenses/MIT). See the [LICENSE](LICENSE.md) file for more info.