Skip to content

CCXT GO #25173

@carlosmiei

Description

@carlosmiei

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

Discord Telegram Telegram Twitter Follow

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions