Go client for the BitMart Cloud API.
- Provides exchange quick trading API
- Easier withdrawal
- Efficiency, higher speeds, and lower latencies
- Priority in development and maintenance
- Dedicated and responsive technical support
- Provide webSocket apis calls
-
1.Go 1.12.7 support
-
2.Downloads or updates code's dependencies
go get -u github.com/bitmartexchange/bitmart-go-sdk-api
- An example of a spot trade API
- Replace it with your own API KEY
- Run
package gotest
import (
"github.com/bitmartexchange/bitmart-go-sdk-api"
"log"
)
func main() {
client := bitmart.NewClient(bitmart.Config{
Url:"https://api-cloud.bitmart.com", // Ues Https url
ApiKey:"Your API KEY",
SecretKey:"Your Secret KEY",
Memo:"Your Memo",
TimeoutSecond:10,
IsPrint:true,
})
var ac, err = client.PostSpotSubmitOrder(bitmart.Order{Symbol: TEST_SYMBOL, Side: "buy", Type: "limit", Size: "0.1", Price: "8800", Notional: ""})
if err != nil {
log.Panic(err)
} else {
bitmart.PrintResponse(ac)
}
}
package gotest
import (
"github.com/bitmartexchange/bitmart-go-sdk-api"
"fmt"
"sync"
)
func OnMessage(message string) {
fmt.Println("------------------------>")
}
func main() {
var wg sync.WaitGroup
wg.Add(3)
ws := bitmart.NewWS(bitmart.Config{
WsUrl: "wss://ws-manager-compress.bitmart.com/api?protocol=1.1",
ApiKey:"Your API KEY",
SecretKey:"Your Secret KEY",
Memo:"Your Memo",
TimeoutSecond:10,
IsPrint:true,
})
_ = ws.Connection(OnMessage)
channels := []string{
// public channel
bitmart.CreateChannel(WS_PUBLIC_SPOT_TICKER, "BTC_USDT"),
}
ws.SubscribeWithLogin(channels)
// Just test, Please do not use in production.
wg.Wait()
}
package gotest
import (
"github.com/bitmartexchange/bitmart-go-sdk-api"
"fmt"
"sync"
)
func OnMessage(message string) {
fmt.Println("------------------------>")
}
func main() {
var wg sync.WaitGroup
wg.Add(3)
ws := bitmart.NewWS(bitmart.Config{
WsUrl: "wss://ws-manager-compress.bitmart.com/user?protocol=1.1",
ApiKey:"Your API KEY",
SecretKey:"Your Secret KEY",
Memo:"Your Memo",
TimeoutSecond:10,
IsPrint:true,
})
_ = ws.Connection(OnMessage)
channels := []string{
// private channel
bitmart.CreateChannel(WS_USER_SPOT_ORDER, "BTC_USDT"),
}
ws.SubscribeWithLogin(channels)
// Just test, Please do not use in production.
wg.Wait()
}
- Update endpoints for Spot
/spot/v1/symbols/details
Add a new respond parameter trade_status, to show the trading status of a trading pair symbol.
- websocket public channel address
wss://ws-manager-compress.bitmart.com?protocol=1.1
will be taken down on 2022-02-28 UTC time,The new address iswss://ws-manager-compress.bitmart.com/api?protocol=1.1
- New endpoints for Spot
/spot/v2/orders
Get User Order History V2/spot/v1/batch_orders
Batch Order
- Update endpoints for Spot
/spot/v1/symbols/kline
Add new field 'quote_volume'/spot/v1/symbols/trades
Add optional parameter N to return the number of items, the default is up to 50 items/spot/v1/order_detail
Add new field 'unfilled_volume'/spot/v1/submit_order
The request parameter type added limit_maker and ioc order types
- New endpoints for Account
/account/v2/deposit-withdraw/history
Get Deposit And Withdraw History V2
- Update endpoints for Account
/account/v1/wallet
Remove the account_type,Only respond to currency accounts; you can bring currency parameters (optional)
- Update endpoints for Spot WebSocket
- Public-Depth Channel:
- spot/depth50 50 Level Depth Channel
- spot/depth100 100 Level Depth Channel
- User-Trade Channel:
- Eligible pushes add new orders successfully
- Public-Depth Channel:
- New endpoints for Spot WebSocket
- Public - ticket channels
- Public - K channel
- Public - trading channels
- Public - depth channels
- Login
- User - Trading Channel
- Interface Spot API
Cancel Order
update to v2 version that isPOST https://api-cloud.bitmart.com/spot/v2/cancel_order
- UserAgent set "BitMart-GO-SDK/1.0.1"
- Interface Spot API
/spot/v1/symbols/book
addsize
parameter, which represents the number of depths