{"id":28717415,"url":"https://github.com/rowingdude/libtradier","last_synced_at":"2025-06-15T03:15:39.868Z","repository":{"id":297497249,"uuid":"991315024","full_name":"rowingdude/libtradier","owner":"rowingdude","description":"A C++ library for the Tradier API","archived":false,"fork":false,"pushed_at":"2025-06-05T20:12:18.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T20:23:40.814Z","etag":null,"topics":["api-client","async","cpp","cpp20","finance","financial-data","financial-tools","investment","market-data","options-trading","order-management","portfolio","rest-api","sdk","stock-market","tradier","trading","trading-library","websocket"],"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/rowingdude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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,"zenodo":null},"funding":{"github":null,"patreon":"rowingdude","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"rowingdude","thanks_dev":null,"custom":null}},"created_at":"2025-05-27T12:49:44.000Z","updated_at":"2025-06-05T20:12:19.000Z","dependencies_parsed_at":"2025-06-05T20:33:55.400Z","dependency_job_id":null,"html_url":"https://github.com/rowingdude/libtradier","commit_stats":null,"previous_names":["rowingdude/libtradier"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rowingdude/libtradier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowingdude%2Flibtradier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowingdude%2Flibtradier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowingdude%2Flibtradier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowingdude%2Flibtradier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rowingdude","download_url":"https://codeload.github.com/rowingdude/libtradier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowingdude%2Flibtradier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259914924,"owners_count":22931334,"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":["api-client","async","cpp","cpp20","finance","financial-data","financial-tools","investment","market-data","options-trading","order-management","portfolio","rest-api","sdk","stock-market","tradier","trading","trading-library","websocket"],"created_at":"2025-06-15T03:15:39.095Z","updated_at":"2025-06-15T03:15:39.845Z","avatar_url":"https://github.com/rowingdude.png","language":"C++","funding_links":["https://patreon.com/rowingdude","https://buymeacoffee.com/rowingdude"],"categories":[],"sub_categories":[],"readme":"# libtradier - Tradier API C++ Library\n\nA comprehensive C++ library for interfacing with the Tradier brokerage API, providing full access to trading, market data, account management, and streaming capabilities.\n\n## Overview\n\nlibtradier is a modern C++20 library that enables developers to integrate Tradier's trading platform into their applications. The library supports both synchronous and asynchronous operations, real-time market data streaming, and comprehensive order management functionality.\n\n## Features\n\n### Core Functionality\n- Complete Tradier API coverage for trading operations\n- Account management and portfolio tracking\n- Real-time and historical market data access\n- Options chain data and analytics\n- Watchlist management\n- Corporate actions and dividend information\n\n### Technical Capabilities\n- Synchronous and asynchronous API calls\n- WebSocket streaming for real-time data\n- Thread-safe operations with built-in thread pool\n- Comprehensive error handling and validation\n- OAuth 2.0 authentication support\n- Configurable rate limiting\n- Automatic retry mechanisms with exponential backoff\n\n### Supported Environments\n- Production and sandbox trading environments\n- Multiple authentication methods\n- Configurable endpoint management\n- SSL/TLS secure communications\n\n## Dependencies\n\nThe library requires the following dependencies:\n\n- [libcurl](https://curl.se/libcurl/) - HTTP client functionality\n- [nlohmann/json](https://github.com/nlohmann/json) - JSON parsing and serialization\n- [Boost](https://www.boost.org/) - System and thread libraries\n- [OpenSSL](https://www.openssl.org/) - SSL/TLS support\n- [websocketpp](https://github.com/zaphoyd/websocketpp) - WebSocket client (optional)\n\n## Installation\n\n### Prerequisites\n\nInstall the required system dependencies:\n\n#### Ubuntu/Debian\n```bash\nsudo apt update\nsudo apt install build-essential cmake pkg-config\nsudo apt install libcurl4-openssl-dev nlohmann-json3-dev\nsudo apt install libboost-system-dev libboost-thread-dev\nsudo apt install libssl-dev libwebsocketpp-dev\n```\n\n#### Building from Source\n\n```bash\ngit clone https://github.com/your-username/libtradier.git\ncd libtradier\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j$(nproc)\nsudo make install\n```\n\n### CMake Integration\n\nAdd to your CMakeLists.txt:\n\n```cmake\nfind_package(libtradier REQUIRED)\ntarget_link_libraries(your_target libtradier::tradier)\n```\n\n## Quick Start\n\n### Basic Setup\n\n```cpp\n#include \u003ctradier/client.hpp\u003e\n#include \u003ciostream\u003e\n\nint main() {\n    // Configure for sandbox environment\n    tradier::Config config;\n    config.setEnvironment(tradier::Environment::SANDBOX);\n    config.setAccessToken(\"your-access-token\");\n    \n    // Create client\n    tradier::TradierClient client(config);\n    \n    // Get account information\n    auto result = client.account().getProfile();\n    if (result.isSuccess()) {\n        auto profile = result.value();\n        std::cout \u003c\u003c \"Account ID: \" \u003c\u003c profile.accountId \u003c\u003c std::endl;\n    }\n    \n    return 0;\n}\n```\n\n### Market Data Access\n\n```cpp\n// Get real-time quotes\nauto quotes = client.market().getQuotes({\"AAPL\", \"MSFT\", \"GOOGL\"});\nif (quotes.isSuccess()) {\n    for (const auto\u0026 quote : quotes.value()) {\n        std::cout \u003c\u003c quote.symbol \u003c\u003c \": $\" \u003c\u003c quote.last \u003c\u003c std::endl;\n    }\n}\n\n// Get options chain\nauto options = client.market().getOptionsChain(\"AAPL\", \"2024-01-19\");\nif (options.isSuccess()) {\n    // Process options data\n}\n```\n\n### Asynchronous Operations\n\n```cpp\n// Async market data with callback\nclient.market().getQuotesAsync({\"AAPL\"}, [](const auto\u0026 result) {\n    if (result.isSuccess()) {\n        auto quotes = result.value();\n        // Process quotes in callback\n    }\n});\n\n// Async with future\nauto future = client.market().getQuotesAsync({\"MSFT\"});\nauto result = future.get(); // Blocks until complete\n```\n\n### Trading Operations\n\n```cpp\n// Place a market order\ntradier::OrderRequest order;\norder.accountId = \"your-account-id\";\norder.symbol = \"AAPL\";\norder.side = tradier::OrderSide::BUY;\norder.quantity = 100;\norder.type = tradier::OrderType::MARKET;\n\nauto result = client.trading().placeOrder(order);\nif (result.isSuccess()) {\n    std::cout \u003c\u003c \"Order placed: \" \u003c\u003c result.value().orderId \u003c\u003c std::endl;\n}\n```\n\n### WebSocket Streaming\n\n```cpp\n// Connect to real-time data stream\nauto connection = client.streaming().connect(\"quotes\");\n\nconnection.setMessageHandler([](const std::string\u0026 message) {\n    // Process real-time market data\n    std::cout \u003c\u003c \"Received: \" \u003c\u003c message \u003c\u003c std::endl;\n});\n\nconnection.connect();\n// Stream data...\nconnection.disconnect();\n```\n\n## Configuration\n\n### Environment Setup\n\n```cpp\ntradier::Config config;\n\n// Production environment\nconfig.setEnvironment(tradier::Environment::PRODUCTION);\nconfig.setBaseUrl(\"https://api.tradier.com\");\n\n// Sandbox environment  \nconfig.setEnvironment(tradier::Environment::SANDBOX);\nconfig.setBaseUrl(\"https://sandbox.tradier.com\");\n\n// Authentication\nconfig.setAccessToken(\"your-access-token\");\nconfig.setClientId(\"your-client-id\");\nconfig.setClientSecret(\"your-client-secret\");\n```\n\n### Rate Limiting\n\n```cpp\n// Configure rate limiting (120 requests per minute default)\nconfig.setRateLimit(120, std::chrono::minutes(1));\n\n// Custom timeout settings\nconfig.setTimeout(std::chrono::seconds(30));\n```\n\n## Error Handling\n\nThe library uses a Result pattern for comprehensive error handling:\n\n```cpp\nauto result = client.market().getQuote(\"AAPL\");\n\nif (result.isSuccess()) {\n    auto quote = result.value();\n    // Use quote data\n} else {\n    auto error = result.error();\n    std::cerr \u003c\u003c \"Error \" \u003c\u003c error.statusCode \n              \u003c\u003c \": \" \u003c\u003c error.message \u003c\u003c std::endl;\n}\n```\n\n## Documentation\n\n### API Reference\n\nComplete API documentation is available in the include directory headers. Key namespaces include:\n\n- `tradier::market` - Market data operations\n- `tradier::trading` - Order management and trading\n- `tradier::account` - Account and portfolio management\n- `tradier::streaming` - Real-time data streaming\n- `tradier::auth` - Authentication and authorization\n\n### Error Codes\n\nThe library provides specific error types for different failure scenarios:\n\n- `ValidationError` - Input parameter validation failures\n- `AuthenticationError` - Authentication and authorization issues\n- `ConnectionError` - Network and connectivity problems\n- `RateLimitError` - API rate limit exceeded\n- `ApiError` - General API response errors\n\n## Development\n\n### Building with Debug Support\n\n```bash\ncmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_DEBUG_LOGGING=ON ..\nmake\n```\n\n### Testing\n\n```bash\ncmake -DBUILD_TESTS=ON ..\nmake\nctest\n```\n\n### Memory Analysis\n\n```bash\ncmake -DENABLE_VALGRIND_TESTS=ON ..\nmake valgrind-test\n```\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome. Please ensure all tests pass and follow the existing code style before submitting pull requests.\n\n## Support\n\nFor issues and questions:\n\n- GitHub Issues: Report bugs and feature requests\n- Documentation: Refer to header files for detailed API documentation\n- Tradier API Documentation: [https://documentation.tradier.com/](https://documentation.tradier.com/)\n\n## Disclaimer\n\nThis software is provided free of charge under the MIT License. Users assume all responsibility for trading decisions and financial outcomes. The authors are not liable for any losses incurred through the use of this software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowingdude%2Flibtradier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frowingdude%2Flibtradier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowingdude%2Flibtradier/lists"}