-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gateio: Add websocket request functions for futures trading (btc and usdt margined) #1603
base: master
Are you sure you want to change the base?
Conversation
…larity on purpose. Change connections map to point to candidate to track subscriptions for future dynamic connections holder and drop struct ConnectionDetails.
…rror but websocket frame error or anything really makes the reader routine return and then connection never cycles and the buffer gets filled. * Handle reconnection via an errors.Is check which is simpler and in that scope allow for quick disconnect reconnect without waiting for connection cycle. * Dial now uses code from DialContext but just calls context.Background() * Don't allow reader to return on parse binary response error. Just output error and return a non nil response
…would hang connection reader for eternity.
… item to nil for systems that do not require rate limiting; add glorious nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice stuff. Haven't done a test run yet. Will look into testnet usage
exchanges/gateio/gateio_test.go
Outdated
@@ -3451,7 +3451,7 @@ func TestProcessFuturesOrdersPushData(t *testing.T) { | |||
incoming string | |||
status order.Status | |||
}{ | |||
{`{"channel":"futures.orders","event":"update","time":1541505434,"time_ms":1541505434123,"result":[{"contract":"BTC_USD","create_time":1628736847,"create_time_ms":1628736847325,"fill_price":40000.4,"finish_as":"","finish_time":1628736848,"finish_time_ms":1628736848321,"iceberg":0,"id":4872460,"is_close":false,"is_liq":false,"is_reduce_only":false,"left":0,"mkfr":-0.00025,"price":40000.4,"refr":0,"refu":0,"size":1,"status":"open","text":"-","tif":"gtc","tkfr":0.0005,"user":"110xxxxx"}]}`, order.Open}, | |||
{`{"channel":"futures.orders","event":"update","time":1541505434,"time_ms":1541505434123,"result":[{"contract":"BTC_USD","create_time":1628736847,"create_time_ms":1628736847325,"fill_price":40000.4,"finish_as":"","finish_time":1628736848,"finish_time_ms":1628736848321,"iceberg":0,"id":4872460,"is_close":false,"is_liq":false,"is_reduce_only":false,"left":0,"mkfr":-0.00025,"price":40000.4,"refr":0,"refu":0,"size":1,"status":"OPEN","text":"-","tif":"gtc","tkfr":0.0005,"user":"110xxxxx"}]}`, order.Open}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caps status doesn't match API docs anywhere. Show me some freshly baked order json and I won't make you change it back 🌈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I got no idea from memory will test it out again. 👀
exchanges/gateio/gateio_wrapper.go
Outdated
resp, err = s.DeriveSubmitResponse(got[0].ID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
resp.Side, err = order.StringToOrderSide(got[0].Side) | ||
if err != nil { | ||
return nil, err | ||
} | ||
resp.Status, err = order.StringToOrderStatus(got[0].Status) | ||
if err != nil { | ||
return nil, err | ||
} | ||
resp.Pair = s.Pair | ||
resp.Date = got[0].CreateTime.Time() | ||
resp.ClientOrderID = got[0].Text | ||
resp.Date = got[0].CreateTimeMs.Time() | ||
resp.LastUpdated = got[0].UpdateTimeMs.Time() | ||
return resp, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really trust your submitted values to match 100% with the actual results for all order types? In the other case you don't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also set resp.Date twice here. I am sure that must be for efficiency reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully addressed this comment here
PR Description
Requires dependency #1598
Type of change
Please delete options that are not relevant and add an
x
in[]
as item is complete.How has this been tested
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and
also consider improving test coverage whilst working on a certain feature or package.
Checklist