{"id":17672128,"url":"https://github.com/mpogotsky/xapi-cpp","last_synced_at":"2025-04-20T14:30:46.304Z","repository":{"id":259131903,"uuid":"837166761","full_name":"MPogotsky/xapi-cpp","owner":"MPogotsky","description":"A C++ library that provides a simple API for interacting with the xStation5 trading platform.","archived":false,"fork":false,"pushed_at":"2025-02-17T19:03:08.000Z","size":108,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T23:51:05.708Z","etag":null,"topics":["boost","boost-asio","boost-json","coroutines","cpp","cpp-lib","cpp20","ssl","traiding-api","websockets","xapi","xopenhub-api","xstation-api","xstation5","xtb","xtb-api"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MPogotsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-02T11:01:45.000Z","updated_at":"2025-02-17T18:59:27.000Z","dependencies_parsed_at":"2025-02-17T19:25:44.819Z","dependency_job_id":"5c94d09d-42e2-41c4-a53c-be61e1571a8c","html_url":"https://github.com/MPogotsky/xapi-cpp","commit_stats":null,"previous_names":["mpogotsky/xapi-cpp"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPogotsky%2Fxapi-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPogotsky%2Fxapi-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPogotsky%2Fxapi-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MPogotsky%2Fxapi-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MPogotsky","download_url":"https://codeload.github.com/MPogotsky/xapi-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249909228,"owners_count":21343940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boost","boost-asio","boost-json","coroutines","cpp","cpp-lib","cpp20","ssl","traiding-api","websockets","xapi","xopenhub-api","xstation-api","xstation5","xtb","xtb-api"],"created_at":"2024-10-24T04:07:04.109Z","updated_at":"2025-04-20T14:30:46.298Z","avatar_url":"https://github.com/MPogotsky.png","language":"C++","readme":"# xStation5 API C++ Library\n\n[![Test xapi-cpp](https://github.com/MPogotsky/xapi-cpp/actions/workflows/test-xapi-cpp.yml/badge.svg)](https://github.com/MPogotsky/xapi-cpp/actions/workflows/test-xapi-cpp.yml) \n[![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/MPogotsky/xapi-cpp/LICENSE)\n\n\nThis library provides C++ interface to work with [XTB](https://www.xtb.com) xStation5 accounts. It can be used to connect to xStation5 platform, retrieve market data and execute trades.\n\nAPI documentation: \u003chttp://developers.xstore.pro/documentation\u003e\n\n### Disclaimer\nThis xStation5 API C++ library is not affiliated with, endorsed by, or in any way officially connected to the xStation5 trading platform or its parent company. \n\nPlease refer to the [license](LICENSE) file (MIT License) for terms and conditions governing the use of this library, including disclaimers of warranties and liabilities.\n\n## Requirements\n\nMake sure to list all necessary dependencies and tools required to build and install the library.\n\n- **C++ Compiler**: Any C++20-compliant compiler (e.g., GCC, Clang)\n- **CMake**: Version 3.22 or higher\n- **Boost**: Version 1.83.0 or higher\n- **OpenSSL**: Version 3.0.2 or higher\n\n\n### Build \u0026 Install\nStep-by-step guide to build the project using CMake.\n\n1. Clone the repository and navigate to the `xapi-cpp` directory:\n\n    ```bash\n    git clone https://github.com/MPogotsky/xapi-cpp.git\n    cd xapi-cpp\n    ```\n\n2. Create a `build` directory and navigate into it:\n\n    ```bash\n    mkdir build\n    cd build\n    ```\n\n3. Run CMake to configure and build Release version of the library:\n\n    ```bash\n    cmake ..\n    cmake --build . \n    ```\n\n4. Run CMake command to install library:\n\n    ```bash\n    cmake --install . \n    ```\n\n## Usage\nTo use xAPI, an active account on the xStation5 trading platform is required. It could be a real account, or demo account. To create one, you can visit [xtb.com](https://www.xtb.com) \n\nOnce your account is set up, you can leverage the Xapi library to connect to the platform and start trading.\n\n### Cmake configuration\n\nXapi supports ``find_package``, simplifying the process of linking the library to your project. A typical `CMakeLists.txt` for your project might look like this:\n\n```cmake\n    cmake_minimum_required(VERSION 3.10)\n    project(ExampleApp)\n\n    set(CMAKE_CXX_STANDARD 20)\n    set(CMAKE_CXX_STANDARD_REQUIRED ON)\n\n    find_package(Xapi REQUIRED)\n\n    add_executable(ExampleApp main.cpp)\n\n    target_link_libraries(ExampleApp\n        PRIVATE\n        Boost::system\n        Boost::json\n        Boost::url\n        Xapi::Xapi\n    )\n```\n\n### Example getAllSymbols\nHere’s a simple example of how to use the library in your ``main.cpp``:\n```cpp\n#include \u003ciostream\u003e\n#include \u003cstring\u003e\n#include \u003cboost/asio.hpp\u003e\n#include \u003cboost/json.hpp\u003e\n#include \u003cxapi/Xapi.hpp\u003e\n\n\nboost::asio::awaitable\u003cvoid\u003e run(boost::asio::io_context \u0026context)\n{\n    const boost::json::object accountCredentials = {\n        {\"accountId\", \"accountId\"}, // Replace value with your account ID\n        {\"password\", \"password\"}, // Replace valuer with your password\n        {\"accountType\", \"demo\"} // Account type, \"demo\" or \"real\"\n    };\n\n    xapi::XStationClient user(context, accountCredentials);\n\n    try\n    {\n        co_await user.login();\n\n        auto result = co_await user.getAllSymbols();\n        std::cout \u003c\u003c boost::json::serialize(result) \u003c\u003c std::endl;\n\n        co_await user.logout();\n    }\n    catch (xapi::exception::ConnectionClosed \u0026e)\n    {\n        std::cout \u003c\u003c \"Connection failed: \" \u003c\u003c e.what() \u003c\u003c std::endl;\n    }\n    catch (xapi::exception::LoginFailed \u0026e)\n    {\n        std::cout \u003c\u003c \"Logging failed: \" \u003c\u003c e.what() \u003c\u003c std::endl;\n    }\n    catch (std::exception \u0026e)\n    {\n        std::cout \u003c\u003c e.what() \u003c\u003c std::endl;\n    }\n}\n\nint main(int argc, char const *argv[])\n{\n    boost::asio::io_context context;\n\n    boost::asio::co_spawn(context, run(context), boost::asio::detached);\n\n    context.run();\n    return 0;\n}\n```\n\nMore examples can be found in [examples](examples/) folder.\n\n## Runing Tests\nTo build the tests, follow these steps:\n\n1. Navigate to the `build` directory.\n2. Run the following commands to configure debug mode and build the tests using CMake:\n\n    ```bash\n    cmake -DCMAKE_BUILD_TYPE=Debug ..\n    cmake --build .\n    ```\n\n    Once the build process is complete, you will have the tests ready to run.\n\n    Use command below to run unit tests:\n\n    ```bash\n    test/tests\n    ```\n\n## Getting Help\n\nIf you have questions, issues, or need assistance with this project, you can visit the [GitHub Issues](https://github.com/MPogotsky/xapi-cpp/issues) page to report problems or check for known issues.\n\nFeel free to reach out via email at matsvei.pahotski@gmail.com if you need direct assistance.\n\n\n## Contributing\n\nTo contribute, please fork the repository, make your changes, and submit a pull request. All contributions will be reviewed, and any useful additions are welcome. Any review or improvement suggestions you may have are greatly appreciated\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpogotsky%2Fxapi-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpogotsky%2Fxapi-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpogotsky%2Fxapi-cpp/lists"}