-
Notifications
You must be signed in to change notification settings - Fork 632
创建交易所实例
bit_he edited this page Jan 5, 2021
·
3 revisions
package main
import (
"github.com/nntaoli-project/goex"
"github.com/nntaoli-project/goex/builder"
"log"
)
func main() {
api := builder.DefaultAPIBuilder.Build(goex.OKEX) //创建现货api实例
log.Println(api.GetExchangeName())
log.Println(api.GetTicker(goex.BTC_USDT)) //获取ticker
}
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
}
package main
import (
"github.com/nntaoli-project/goex"
"github.com/nntaoli-project/goex/builder"
"log"
)
func main() {
api ,err := builder.DefaultAPIBuilder. BuildFuturesWs(goex.OKEX) //创建api实例
api.SubscribeDepth(goex.BTC_USDT, goex.THIS_WEEK) //订阅深度数据
}