Skip to content
bit_he edited this page Dec 11, 2020 · 4 revisions

1.创建现货API接口实例

package main

import (
	"github.com/nntaoli-project/goex"
	"github.com/nntaoli-project/goex/builder"
	"log"
)

func main() {
	api := builder.DefaultAPIBuilder.APIKey("").APISecretkey("").ApiPassphrase("").Build(goex.OKEX) //创建现货api实例
	log.Println(api.GetExchangeName())
	log.Println(api.GetTicker(goex.BTC_USDT)) //获取ticker
}

2. 创建期货API接口

package main

import (
	"github.com/nntaoli-project/goex"
	"github.com/nntaoli-project/goex/builder"
	"log"
)

func main() {
	api := builder.DefaultAPIBuilder.BuildFuture(goex.OKEX) //创建api实例
	//api := builder.DefaultAPIBuilder.BuildFuture(goex.OKEX_SWAP) //创建Swap API实例
	log.Println(api.GetExchangeName())
	log.Println(api.GetFutureTicker(goex.BTC_USDT, goex.QUARTER_CONTRACT)) //获取ticker
}
Clone this wiki locally