https://github.com/alexjorgef/go-bittrex
Go wrapper for the Bittrex crypto-currency exchange API.
https://github.com/alexjorgef/go-bittrex
api bittrex bittrex-api bittrex-exchange cryptocurrency exchange go golang signalr websocket wrapper
Last synced: 5 months ago
JSON representation
Go wrapper for the Bittrex crypto-currency exchange API.
- Host: GitHub
- URL: https://github.com/alexjorgef/go-bittrex
- Owner: alexjorgef
- License: mit
- Created: 2022-07-06T00:49:45.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T07:02:24.000Z (about 3 years ago)
- Last Synced: 2025-04-08T02:47:13.418Z (about 1 year ago)
- Topics: api, bittrex, bittrex-api, bittrex-exchange, cryptocurrency, exchange, go, golang, signalr, websocket, wrapper
- Language: Go
- Homepage: https://deps.dev/go/github.com%2Falexjorgef%2Fgo-bittrex
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-bittrex
[](https://github.com/alexjorgef/go-bittrex/actions?query=workflow%3ATest)
[](https://github.com/alexjorgef/go-bittrex/actions?query=workflow%3ALint)
[](https://codecov.io/gh/alexjorgef/go-bittrex)
[](https://goreportcard.com/report/github.com/alexjorgef/go-bittrex)
[](https://godoc.org/github.com/alexjorgef/go-bittrex)
go-bittrex is a Go client library for accessing the [Bittrex API](https://bittrex.github.io/api).
# Install
```console
go get github.com/alexjorgef/go-bittrex
```
## Quick Start
Check more advanced examples [here](examples/).
### REST API
```go
package main
import (
"fmt"
"log"
"github.com/alexjorgef/go-bittrex/bittrex"
)
func main() {
client := bittrex.New("", "")
currency, err := client.GetCurrency("ETH")
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%+v\n", currency)
}
```
### Websocket
```go
package main
import (
"fmt"
"log"
"time"
"github.com/alexjorgef/go-bittrex/bittrex"
)
func main() {
// Bittrex client
client := bittrex.New("", "")
// Open channels and start a websocket connection that write to it
ch := make(chan bittrex.Ticker)
errCh := make(chan error)
stopCh := make(chan bool)
go func() { errCh <- client.SubscribeTickerUpdates("BTC-USD", ch, stopCh) }()
go func() { errCh <- client.SubscribeTickerUpdates("ETH-USD", ch, stopCh) }()
go func() { errCh <- client.SubscribeTickerUpdates("ADA-USD", ch, stopCh) }()
// Read from ticker/error channels only 1 time
select {
case ticker := <-ch:
fmt.Printf("%+v\n", ticker)
case err := <-errCh:
fmt.Printf("%+v\n", err)
}
// Read from channels and stop after 35 seconds
for start := time.Now(); time.Since(start) < (35 * time.Second); {
select {
case ticker := <-ch:
fmt.Printf("%+v\n", ticker)
case err := <-errCh:
fmt.Printf("%+v\n", err)
}
}
// Read from channels infinitely
for {
select {
case ticker := <-ch:
fmt.Printf("%+v\n", ticker)
case err := <-errCh:
fmt.Printf("%+v\n", err)
}
}
}
```
## References
This repository is a cleaned & updated version of [toorop/go-bittrex](https://github.com/toorop/go-bittrex) repo (inspired from [alexeykaravan/go-bittrex-v3](https://github.com/alexeykaravan/go-bittrex-v3) fork).
[i13]: https://github.com/alexjorgef/go-bittrex/issues/13