Skip to content
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

Get account balances via rest api #83

Closed
cryptochassis opened this issue Apr 13, 2021 · 1 comment · Fixed by #146
Closed

Get account balances via rest api #83

cryptochassis opened this issue Apr 13, 2021 · 1 comment · Fixed by #146
Labels
good first issue Good for newcomers

Comments

@cryptochassis
Copy link
Contributor

cryptochassis commented Apr 13, 2021

Is your feature request related to a problem? Please describe.
Getting account balances of assets via rest api is important: it allows syncing of information between the exchange and the customer's trading server; it allows algorithms to determine the right action to take knowing the balances.

Describe the solution you'd like
Add an operation type of GET_ACCOUNT_BALANCES to class Request. Add a type of GET_ACCOUNT_BALANCES to class Message. Take bitmex as an example.

  • Modify member function void convertReq(http::request<http::string_body>& req, const Request& request, const Request::Operation operation, const TimePoint& now, const std::string& symbolId, const std::map<std::string, std::string>& credential) in include/ccapi_cpp/service/ccapi_execution_management_service_bitmex.h so that its switch statement can handle Request::Operation::GET_ACCOUNT_BALANCES. Use member function appendParam to handle optional parameter of ACCOUNT_ID and ASSET (the name of the asset such as "USD") for operation GET_ACCOUNT_BALANCES.

  • Modify member function std::vector<Message> convertTextMessageToMessage(const Request& request, const std::string& textMessage, const TimePoint& timeReceived) in include/ccapi_cpp/service/ccapi_execution_management_service.h so that its switch statement can handle Request::Operation::GET_ACCOUNT_BALANCES and adds a Message to its return. This Message will contain one or more Elements with each Element having a nameValueMap with keys: ACCOUNT_ID (optional), ASSET (optional), QUANTITY_AVAILABLE_FOR_TRADING (required, the amount of the asset available for trading).

  • Add appropriate unit tests on request conversions and response conversions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant