GoEx project is designed to unify and standardize the interfaces of each digital asset trading platform. The same strategy can be switched to any trading platform at any time without changing any code.
Exchange | Market API | Order API | Version |
---|---|---|---|
hbg.com | Y | Y | 1 |
hbdm.com | Y (REST / WS) | Y | 1 |
okex.com (spot/future) | Y (REST / WS) | Y | 1 |
okex.com (swap future) | Y | Y | 2 |
binance.com | Y | Y | 1 |
bitstamp.net | Y | Y | 1 |
bitfinex.com | Y | Y | 1 |
zb.com | Y | Y | 1 |
kraken.com | Y | Y | * |
poloniex.com | Y | Y | * |
aacoin.com | Y | Y | 1 |
allcoin.ca | Y | Y | * |
big.one | Y | Y | 2|3 |
fcoin.com | Y (REST / WS) | Y | 2 |
hitbtc.com | Y | Y | * |
coinex.com | Y | Y | 1 |
exx.com | Y | Y | 1 |
bithumb.com | Y | Y | * |
gate.io | Y | N | 1 |
btcbox.co.jp | Y | N | * |
bittrex.com | Y | N | 1.1 |
btcchina.com | Y | Y | 1 |
coinbig.com | Y | Y | * |
go get github.com/GitTsewell/GoEx
package main
import (
"github.com/GitTsewell/GoEx"
"github.com/GitTsewell/GoEx/builder"
"log"
"time"
)
func main() {
apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second)
//apiBuilder := builder.NewAPIBuilder().HttpTimeout(5 * time.Second).HttpProxy("socks5://127.0.0.1:1080")
//build spot api
//api := apiBuilder.APIKey("").APISecretkey("").ClientID("123").Build(goex.BITSTAMP)
api := apiBuilder.APIKey("").APISecretkey("").Build(goex.HUOBI_PRO)
log.Println(api.GetExchangeName())
log.Println(api.GetTicker(goex.BTC_USD))
log.Println(api.GetDepth(2, goex.BTC_USD))
//log.Println(api.GetAccount())
//log.Println(api.GetUnfinishOrders(goex.BTC_USD))
//build future api
futureApi := apiBuilder.APIKey("").APISecretkey("").BuildFuture(goex.HBDM)
log.Println(futureApi.GetExchangeName())
log.Println(futureApi.GetFutureTicker(goex.BTC_USD, goex.QUARTER_CONTRACT))
log.Println(futureApi.GetFutureDepth(goex.BTC_USD, goex.QUARTER_CONTRACT, 5))
//log.Println(futureApi.GetFutureUserinfo()) // account
//log.Println(futureApi.GetFuturePosition(goex.BTC_USD , goex.QUARTER_CONTRACT))//position info
}
import (
"github.com/GitTsewell/GoEx"
"github.com/GitTsewell/GoEx/huobi"
//"github.com/GitTsewell/GoEx/okcoin"
"log"
)
func main() {
//ws := okcoin.NewOKExFutureWs() //ok future
ws := huobi.NewHbdmWs() //huobi future
//setup callback
ws.SetCallbacks(func(ticker *goex.FutureTicker) {
log.Println(ticker)
}, func(depth *goex.Depth) {
log.Println(depth)
}, func(trade *goex.Trade, contract string) {
log.Println(contract, trade)
})
//subscribe
ws.SubscribeTrade(goex.BTC_USDT, goex.NEXT_WEEK_CONTRACT)
ws.SubscribeDepth(goex.BTC_USDT, goex.QUARTER_CONTRACT, 5)
ws.SubscribeTicker(goex.BTC_USDT, goex.QUARTER_CONTRACT)
}
- use GoLand development.
- turn off the auto format function.
- DONOT reformat existing files, which will result in a particularly bad commit.
- use the OrderID2 field instead of the OrderID
Join QQ group: 574829125