Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/qct/cryptocurrency-exchange-api
goex项目是为了统一并标准化各个数字资产交易平台的接口而设计,同一个策略可以随时切换到任意一个交易平台,而不需要更改任何代码。
23+
交易所 | 行情接口 | 交易接口 | 版本号 |
---|---|---|---|
hbg.com | Y | Y | 1 |
hbdm.com | Y | Y | 1 |
okex.com | Y | Y | 3 |
binance.com | Y | Y | 1 |
kucoin.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 | 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 | * |
coinbig.com | Y | Y | * |
coinbene.com | Y | Y | * |
go get github.com/nntaoli-project/goex
建议go mod 管理依赖
require (
github.com/nntaoli-project/goex v1.0.4
)
package main
import (
"github.com/nntaoli-project/goex"
"github.com/nntaoli-project/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/nntaoli-project/goex"
"github.com/nntaoli-project/goex/huobi"
//"github.com/nntaoli-project/goex/okcoin"
"log"
)
func main() {
//ws := okcoin.NewOKExFutureWs() //ok期货
ws := huobi.NewHbdmWs() //huobi期货
//设置回调函数
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)
})
//订阅行情
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)
}
BTC:13cBHLk6B7t3Uj7caJbCwv1UaiuiA6Qx8z
LTC:LVxM7y1K2dnpuNBU42ei3dKzPySf4VAm1H
ETH:0x98573ddb33cdddce480c3bc1f9279ccd88ca1e93
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.