-
Notifications
You must be signed in to change notification settings - Fork 664
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
Add MultiAssetModeService for Future #487
Add MultiAssetModeService for Future #487
Conversation
Hello @adshao . |
v2/futures/position_service.go
Outdated
// ChangeMultiAssetModeService change user's multi-asset mode | ||
type ChangeMultiAssetModeService struct { | ||
c *Client | ||
multiAssetsMargin string |
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.
multiAssetsMargin string | |
multiAssetsMargin bool |
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 referred https://binance-docs.github.io/apidocs/futures/en/#change-multi-assets-mode-trade, where it is seen as
POST /fapi/v1/multiAssetsMargin (HMAC SHA256)
has the parameter as below.
multiAssetsMargin | STRING | YES | "true": Multi-Assets Mode; "false": Single-Asset Mode
I follow the Binance api doc. When getting multi-asset mode, the response is bool type, but when we change by POST, its parameter multi-asset mode is string type.
v2/futures/position_service.go
Outdated
if multiAssetsMargin { | ||
s.multiAssetsMargin = "true" | ||
} else { | ||
s.multiAssetsMargin = "false" | ||
} |
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.
if multiAssetsMargin { | |
s.multiAssetsMargin = "true" | |
} else { | |
s.multiAssetsMargin = "false" | |
} | |
s.multiAssetsMargin = multiAssetsMargin |
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.
Same comment as above.
Thank you for the work, please check my review comments. |
Thank you for your review and comments. In summary, from https://binance-docs.github.io/apidocs/futures/en/#change-multi-assets-mode-trade, where it is seen as Following the above link, it seems |
setFormParams will automatically convert |
Thanks for further explanation. As I reviewed Is
to
? But, after reviewing
r.setFormParams(params{
|
I think |
…itionModeService as bool
@adshao Thanks a lot for your comment.
I found
I checked the related unit tests are all passed. |
I found the endpoint
/fapi/v1/multiAssetsMargin
is not supported yet to get or change the multi-asset mode of a user.I added the related services accordingly in the following files in
v2/futures
.