-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Description
Hello, CCXT community!
We're excited to announce that we publicly released the GO version of CCXT (for now, only Rest capabilities).
It works very similarly to the other languages.
You can check the package here: https://pkg.go.dev/github.com/ccxt/ccxt/go/v4
Install
go install github.com/ccxt/ccxt/go/v4@latest
Examples
package main
import (
"github.com/ccxt/ccxt/go/v4"
"fmt"
)
func main() {
exchange := ccxt.NewBinance(map[string]interface{}{
"apiKey": "MY KEY",
"secret": "MY SECRET",
})
orderParams := map[string]interface{}{
"clientOrderId": "myOrderId68768678",
}
<-exchange.LoadMarkets() // not required, but you can pre-load the markets
order, err := exchange.CreateOrder("BTC/USDT", "limit", "buy", 0.001, ccxt.WithCreateOrderPrice(6000), ccxt.WithCreateOrderParams(orderParams))
if err != nil {
if ccxtError, ok := err.(*ccxt.Error); ok {
if ccxtError.Type == "InvalidOrder" {
fmt.Println("Invalid order")
} else {
fmt.Println("Some other error")
}
}
} else {
fmt.Println(*order.Id)
}
}
You can check some examples here: https://github.com/ccxt/ccxt/tree/master/examples/go/
Thank you for using CCXT!
Yours, the CCXT Dev Team
AresArtemius, Dan-krm, carlosmiei, ttodua, kroitor and 7 moreDan-krm, carlosmiei, ttodua, kroitor, TraderWithPython and 4 morettodua, kroitor, TraderWithPython, fl0wo, suenot and 4 more