📦 goex/ nntaoli-project
Cryptocurrency Exchange REST API SDK Wrapper Implemented With the golang, Supporting OKX, Binance
Открыть на GitHub ↗обновлён 1мес назад
Звёзды
★ 2.0k
Форки
645
За неделю
—
За месяц
—
Рост %
—
Язык
Go
Установка и запуск
Example
package main
import (
goexv2 "github.com/nntaoli-project/goex/v2"
"github.com/nntaoli-project/goex/v2/logger"
"github.com/nntaoli-project/goex/v2/model"
"github.com/nntaoli-project/goex/v2/options"
"log"
)
func main() {
logger.SetLevel(logger.DEBUG) // set log level
//goexv2.DefaultHttpCli.SetProxy("socks5://127.0.0.1:1080") //socks5 proxy
goexv2.DefaultHttpCli.SetTimeout(5) // 5 second
_, _, err := goexv2.OKx.Spot.GetExchangeInfo() //must call
if err != nil {
panic(err)
}
//This CurrencyPair structure contains various information about the trading pair, such as price_precision and qty_precision,min_qty ...
btcUSDTCurrencyPair, err := goexv2.OKx.Spot.NewCurrencyPair(model.BTC, model.USDT)
if err != nil {
panic(err)
}
//public api
log.Println(goexv2.OKx.Spot.GetTicker(btcUSDTCurrencyPair))
//private api
okxPrvApi := goexv2.OKx.Spot.NewPrvApi(
options.WithApiKey(""),
options.WithApiSecretKey(""),
options.WithPassphrase(""))
//create order api
order, _, err := okxPrvApi.CreateOrder(btcUSDTCurrencyPair, 0.01, 18000, model.Spot_Buy, model.OrderType_Limit)
log.Println(err)
log.Println(order)
}
Из README репозитория · полный README на GitHub
Категории
Теги
api-restbinanceokxquant