bitmartexchange / bitmart-go-sdk-api Goto Github PK
View Code? Open in Web Editor NEWGo client for the BitMart API
License: MIT License
Go client for the BitMart API
License: MIT License
// reconnect to websocket
func (ws *CloudWS) reconnection() {
time.Sleep(time.Duration(2) * time.Second)
log.Printf("Reconnecting to %s", ws.Config.WsUrl)
c, _, err := websocket.DefaultDialer.Dial(ws.Config.WsUrl, nil)
if err != nil {
log.Fatalf("Connect failed. dial:%+v", err)
}
if ws.Config.IsPrint {
log.Printf("Connected to %s", ws.Config.WsUrl)
}
ws.Conn = c
if ws.reconnectUseLogin {
ws.SubscribeWithLogin(ws.reconnectUseChannels)
} else {
ws.SubscribeWithoutLogin(ws.reconnectUseChannels)
}
}
这里的log.Fatalf 会引发此问题
I try to use this method “PostSpotBatchOrders”, but it has a parameter error.
// PostSpotBatchOrders /** Batch New Order(v2) (SIGNED)
func (cloudClient *CloudClient) PostSpotBatchOrders(orderParams [1]Order) (*CloudResponse, error) {
params := NewParams()
params["order_params"] = orderParams
return cloudClient.requestWithParams(POST, API_SPOT_BATCH_ORDERS_URL, params, SIGNED)
}
orderParams [1]Order
This parameter will prevent the correct order slice from being sent, it can only accept an order array of length one. I think he should be orderParams []Order
.
this api is :
curl
-H 'X-BM-KEY:{{AccessKey}}'
-H 'X-BM-TIMESTAMP:{{currentTime}}'
-H 'X-BM-SIGN:{{SIGN}}'
-X POST -d '{
"order_params":[
{
"symbol":"BTC_USDT",
"size":"0.1",
"price":"8800",
"side":"buy",
"type":"limit"
},
{
"symbol":"BTC_USDT",
"size":"0.1",
"price":"8800",
"side":"sell",
"type":"limit"
}
]
}'
https://api-cloud.bitmart.com/spot/v2/batch_orders
Hello I am trying to use the SDK, but for an example I want to see if the status code of the request that I've made is 200
, how do I do that when the struct for the CloudResponse
looks like so:
type CloudResponse struct {
httpStatus int
response string
limit RateLimit
}
Basically the response
object is being unusable since that the fields are not exported, how can I make use of that or do I understand that wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.