diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1e70a6..06f0a1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,10 @@ jobs: run: | choco install ninja + - name: Setup MSVC Developer Command Prompt (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + - name: Setup CMake and vcpkg uses: lukka/get-cmake@latest @@ -84,7 +88,7 @@ jobs: - name: Test library linkage (Windows) if: runner.os == 'Windows' run: | - cd bin/build/${{ env.PRESET_NAME }}/example/${{ matrix.build_type }} + cd bin/build/${{ env.PRESET_NAME }}/example dir - name: Upload build artifacts diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cd5519..623b8d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,19 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if(APPLE) set(CMAKE_INSTALL_RPATH "@loader_path/../lib") +elseif(WIN32) + # On Windows, DLLs are found via PATH or same directory as executable + set(CMAKE_INSTALL_RPATH "") endif() # Options option(BINANCECPP_BUILD_EXAMPLES "Build examples" ON) +option(BINANCECPP_DEPLOY_MODE "Enable deployment mode, disables examples" OFF) + +# Deployment mode overrides examples setting +if(BINANCECPP_DEPLOY_MODE) + set(BINANCECPP_BUILD_EXAMPLES OFF CACHE BOOL "Deploy mode disables examples" FORCE) +endif() # Find packages diff --git a/CMakePresets.json b/CMakePresets.json index 663faa3..228d8f7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -50,26 +50,32 @@ "name": "windows-debug", "inherits": "debug", "displayName": "Windows Debug", - "description": "Debug Windows build using vcpkg with Visual Studio", - "generator": "Visual Studio 17 2022", - "architecture": "x64", + "description": "Debug Windows build using vcpkg with Ninja and MSVC", + "generator": "Ninja", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" + }, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_C_COMPILER": "cl.exe" } }, { "name": "windows-release", "inherits": "release", "displayName": "Windows Release", - "description": "Release Windows build using vcpkg with Visual Studio", - "generator": "Visual Studio 17 2022", - "architecture": "x64", + "description": "Release Windows build using vcpkg with Ninja and MSVC", + "generator": "Ninja", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" + }, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_C_COMPILER": "cl.exe" } }, { @@ -132,13 +138,16 @@ "name": "windows-deploy", "inherits": "deploy", "displayName": "Windows Deploy", - "description": "Production Windows deployment build without examples", - "generator": "Visual Studio 17 2022", - "architecture": "x64", + "description": "Production Windows deployment build without examples using Ninja and MSVC", + "generator": "Ninja", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" + }, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_C_COMPILER": "cl.exe" } }, { diff --git a/example/example.cpp b/example/example.cpp index 82152e8..86930a9 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -9,7 +9,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" constexpr const char* API_KEY = "api key"; diff --git a/example/example_aggTrades.cpp b/example/example_aggTrades.cpp index 776348f..56b3b16 100644 --- a/example/example_aggTrades.cpp +++ b/example/example_aggTrades.cpp @@ -5,7 +5,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" std::map> aggTradeCache; diff --git a/example/example_depthCache.cpp b/example/example_depthCache.cpp index a15c85f..5b9c8c2 100644 --- a/example/example_depthCache.cpp +++ b/example/example_depthCache.cpp @@ -5,7 +5,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" std::map> depthCache; diff --git a/example/example_klines.cpp b/example/example_klines.cpp index 60d09e0..bdfc7fa 100644 --- a/example/example_klines.cpp +++ b/example/example_klines.cpp @@ -5,7 +5,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" std::map> klinesCache; diff --git a/example/example_template.cpp b/example/example_template.cpp index 34ede2e..73b9968 100644 --- a/example/example_template.cpp +++ b/example/example_template.cpp @@ -4,7 +4,7 @@ #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" #define API_KEY "myapikey" diff --git a/example/example_userStream.cpp b/example/example_userStream.cpp index 06d9337..e0cc7e5 100644 --- a/example/example_userStream.cpp +++ b/example/example_userStream.cpp @@ -4,7 +4,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" #define API_KEY "api key" diff --git a/example/example_wapi.cpp b/example/example_wapi.cpp index b2d36aa..7f3bfc8 100644 --- a/example/example_wapi.cpp +++ b/example/example_wapi.cpp @@ -5,7 +5,7 @@ #include #include -#include "binance_cpp.h" +#include "binance_api.h" #include "binance_websocket.h" #define API_KEY "api key" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0557f5f..544f886 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,12 +23,16 @@ set_target_properties(binancecpp PROPERTIES EXPORT_NAME binancecpp ) +# Define export macro for Windows DLL +target_compile_definitions(binancecpp PRIVATE BINANCECPP_EXPORTS) + # Link libraries target_link_libraries(binancecpp - PRIVATE + PUBLIC JsonCpp::JsonCpp + PRIVATE CURL::libcurl - websockets + $,websockets,websockets_shared> ) # Include directories @@ -43,9 +47,13 @@ target_include_directories(binancecpp # Compiler-specific options for C++20 target_compile_options(binancecpp PRIVATE - -fPIC + # Position Independent Code for Unix systems only + $<$>:-fPIC> + # C++20 concepts support $<$:-fconcepts> $<$:-fconcepts-ts> + # Windows-specific options + $<$:/std:c++20> ) # Add alias for consistent naming diff --git a/src/binance.h b/src/binance.h deleted file mode 100644 index 70999a8..0000000 --- a/src/binance.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - Author: blackb1rd - Date : 2025/08/11 - - C++ library for Binance API - Main Header - Following Google C++ Style Guide naming conventions - Modular design based on official Binance API documentation structure - https://developers.binance.com/ -*/ - -#ifndef BINANCE_CPP_H -#define BINANCE_CPP_H - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BINANCE_HOST "https://api.binance.com" - -template -concept StringLike = std::convertible_to; - -template -concept Numeric = std::integral || std::floating_point; - -// Include all Financial Trading modules following official Binance API -// structure -#include "financial_trading/algo_trading.h" -#include "financial_trading/copy_trading.h" -#include "financial_trading/derivatives_trading.h" -#include "financial_trading/margin_trading.h" -#include "financial_trading/spot_trading.h" -#include "financial_trading/wallet.h" - -class BinanceCPP -{ - static std::string api_key; - static std::string secret_key; - static CURL *curl; - - public: - static void curl_api(std::string &url, std::string &result_json); - static void curl_api_with_header(std::string &url, - std::string &result_json, - std::vector &extra_http_header, - std::string &post_data, - std::string &action); - [[nodiscard]] static size_t curl_cb(void *content, - size_t size, - size_t nmemb, - std::string *buffer); - - static void init(); - static void init(std::string_view api_key, std::string_view secret_key); - static void cleanup() noexcept; - - // Public API - static void get_exchangeInfo(Json::Value &json_result); - static void get_serverTime(Json::Value &json_result); - - static void get_allPrices(Json::Value &json_result); - [[nodiscard]] static double get_price(std::string_view symbol); - - static void get_allBookTickers(Json::Value &json_result); - static void get_bookTicker(std::string_view symbol, Json::Value &json_result); - - static void get_depth(std::string_view symbol, - int limit, - Json::Value &json_result); - static void get_aggTrades(std::string_view symbol, - int fromId, - time_t startTime, - time_t endTime, - int limit, - Json::Value &json_result); - static void get_24hr(std::string_view symbol, Json::Value &json_result); - static void get_klines(std::string_view symbol, - std::string_view interval, - int limit, - time_t startTime, - time_t endTime, - Json::Value &json_result); - - // API + Secret keys required - static void get_account(long recvWindow, Json::Value &json_result); - - static void get_myTrades(std::string_view symbol, - int limit, - long fromId, - long recvWindow, - Json::Value &json_result); - - static void get_openOrders(std::string_view symbol, - long recvWindow, - Json::Value &json_result); - - static void get_allOrders(std::string_view symbol, - long orderId, - int limit, - long recvWindow, - Json::Value &json_result); - - static void send_order(std::string_view symbol, - std::string_view side, - std::string_view type, - std::string_view timeInForce, - double quantity, - double price, - std::string_view newClientOrderId, - double stopPrice, - double icebergQty, - long recvWindow, - Json::Value &json_result); - - static void get_order(std::string_view symbol, - long orderId, - std::string_view origClientOrderId, - long recvWindow, - Json::Value &json_result); - - static void cancel_order(std::string_view symbol, - long orderId, - std::string_view origClientOrderId, - std::string_view newClientOrderId, - long recvWindow, - Json::Value &json_result); - - // API key required - static void start_userDataStream(Json::Value &json_result); - static void keep_userDataStream(std::string_view listenKey); - static void close_userDataStream(std::string_view listenKey); - - // WAPI - static void withdraw(std::string_view asset, - std::string_view address, - std::string_view addressTag, - double amount, - std::string_view name, - long recvWindow, - Json::Value &json_result); - - static void get_depositHistory(std::string_view asset, - int status, - long startTime, - long endTime, - long recvWindow, - Json::Value &json_result); - - static void get_withdrawHistory(std::string_view asset, - int status, - long startTime, - long endTime, - long recvWindow, - Json::Value &json_result); - - static void get_depositAddress(std::string_view asset, - long recvWindow, - Json::Value &json_result); -}; - -namespace binance_cpp -{ -// Main API namespace bringing together all financial trading modules -// Use the specific namespace modules for organized API access: -// - financial_trading::spot_trading -// - financial_trading::derivatives_trading -// - financial_trading::margin_trading -// - financial_trading::algo_trading -// - financial_trading::wallet -// - financial_trading::copy_trading -} // namespace binance_cpp - -#endif // BINANCE_CPP_H diff --git a/src/binance_api.h b/src/binance_api.h new file mode 100644 index 0000000..78f754d --- /dev/null +++ b/src/binance_api.h @@ -0,0 +1,94 @@ +/* + Author: blackb1rd + Date : 2025/08/11 + + C++ library for Binance API - Main Header + Following Google C++ Style Guide naming conventions + Modular design based on official Binance API documentation structure + https://developers.binance.com/ +*/ + +#ifndef BINANCE_API_H +#define BINANCE_API_H + +#include "binance_cpp.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BINANCE_HOST "https://api.binance.com" + +// Note: StringLike and Numeric concepts are defined in binance_cpp.h + +// Include all Financial Trading modules following official Binance API +// structure +#include "financial_trading/algo_trading.h" +#include "financial_trading/copy_trading.h" +#include "financial_trading/derivatives_trading.h" +#include "financial_trading/margin_trading.h" +#include "financial_trading/spot_trading.h" +#include "financial_trading/wallet.h" + +namespace binance_cpp +{ + +// Core API functionality +namespace core +{ +class BINANCECPP_API BinanceAPI +{ + public: + static std::string api_key_; + static std::string secret_key_; + static CURL* curl_; + + static void CurlAPI(std::string& url, std::string& result_json); + static void CurlAPIWithHeader(std::string& url, + std::string& result_json, + std::vector& extra_http_header, + std::string& post_data, + std::string& action); + [[nodiscard]] static size_t CurlCallback(void* content, + size_t size, + size_t nmemb, + std::string* buffer); + + static void Init(); + static void Init(std::string_view api_key, std::string_view secret_key); + static void Cleanup() noexcept; + + // API key management + static void SetAPIKey(std::string_view api_key); + static void SetSecretKey(std::string_view secret_key); + [[nodiscard]] static const std::string& GetAPIKey() noexcept; + [[nodiscard]] static const std::string& GetSecretKey() noexcept; +}; +} // namespace core + +// Main API namespace bringing together all financial trading modules +// Use the specific namespace modules for organized API access: +// - financial_trading::spot_trading +// - financial_trading::derivatives_trading +// - financial_trading::margin_trading +// - financial_trading::algo_trading +// - financial_trading::wallet +// - financial_trading::copy_trading + +} // namespace binance_cpp + +#endif // BINANCE_API_H diff --git a/src/binance_cpp.h b/src/binance_cpp.h index eafffe2..76ade7d 100644 --- a/src/binance_cpp.h +++ b/src/binance_cpp.h @@ -11,6 +11,18 @@ #ifndef BINANCE_CPP_H #define BINANCE_CPP_H +// Windows DLL export/import macros +#ifdef _WIN32 + #ifdef BINANCECPP_EXPORTS + #define BINANCECPP_API __declspec(dllexport) + #else + #define BINANCECPP_API __declspec(dllimport) + #endif + #define NOMINMAX // Prevent Windows min/max macros from conflicting with std::min/max +#else + #define BINANCECPP_API +#endif + #include #include @@ -37,51 +49,134 @@ concept StringLike = std::convertible_to; template concept Numeric = std::integral || std::floating_point; -// Include all Financial Trading modules following official Binance API -// structure -#include "financial_trading/algo_trading.h" -#include "financial_trading/copy_trading.h" -#include "financial_trading/derivatives_trading.h" -#include "financial_trading/margin_trading.h" -#include "financial_trading/spot_trading.h" -#include "financial_trading/wallet.h" - -namespace binance_cpp +class BINANCECPP_API BinanceCPP { + static std::string api_key; + static std::string secret_key; + static CURL *curl; -// Core API functionality -namespace core -{ -class BinanceAPI -{ public: - static std::string api_key_; - static std::string secret_key_; - static CURL* curl_; - - static void CurlAPI(std::string& url, std::string& result_json); - static void CurlAPIWithHeader(std::string& url, - std::string& result_json, - std::vector& extra_http_header, - std::string& post_data, - std::string& action); - [[nodiscard]] static size_t CurlCallback(void* content, - size_t size, - size_t nmemb, - std::string* buffer); - - static void Init(); - static void Init(std::string_view api_key, std::string_view secret_key); - static void Cleanup() noexcept; - - // API key management - static void SetAPIKey(std::string_view api_key); - static void SetSecretKey(std::string_view secret_key); - [[nodiscard]] static const std::string& GetAPIKey() noexcept; - [[nodiscard]] static const std::string& GetSecretKey() noexcept; + static void curl_api(std::string &url, std::string &result_json); + static void curl_api_with_header(std::string &url, + std::string &result_json, + std::vector &extra_http_header, + std::string &post_data, + std::string &action); + [[nodiscard]] static size_t curl_cb(void *content, + size_t size, + size_t nmemb, + std::string *buffer); + + static void init(); + static void init(std::string_view api_key, std::string_view secret_key); + static void cleanup() noexcept; + + // Public API + static void get_exchangeInfo(Json::Value &json_result); + static void get_serverTime(Json::Value &json_result); + + static void get_allPrices(Json::Value &json_result); + [[nodiscard]] static double get_price(std::string_view symbol); + + static void get_allBookTickers(Json::Value &json_result); + static void get_bookTicker(std::string_view symbol, Json::Value &json_result); + + static void get_depth(std::string_view symbol, + int limit, + Json::Value &json_result); + static void get_aggTrades(std::string_view symbol, + int fromId, + time_t startTime, + time_t endTime, + int limit, + Json::Value &json_result); + static void get_24hr(std::string_view symbol, Json::Value &json_result); + static void get_klines(std::string_view symbol, + std::string_view interval, + int limit, + time_t startTime, + time_t endTime, + Json::Value &json_result); + + // API + Secret keys required + static void get_account(long recvWindow, Json::Value &json_result); + + static void get_myTrades(std::string_view symbol, + int limit, + long fromId, + long recvWindow, + Json::Value &json_result); + + static void get_openOrders(std::string_view symbol, + long recvWindow, + Json::Value &json_result); + + static void get_allOrders(std::string_view symbol, + long orderId, + int limit, + long recvWindow, + Json::Value &json_result); + + static void send_order(std::string_view symbol, + std::string_view side, + std::string_view type, + std::string_view timeInForce, + double quantity, + double price, + std::string_view newClientOrderId, + double stopPrice, + double icebergQty, + long recvWindow, + Json::Value &json_result); + + static void get_order(std::string_view symbol, + long orderId, + std::string_view origClientOrderId, + long recvWindow, + Json::Value &json_result); + + static void cancel_order(std::string_view symbol, + long orderId, + std::string_view origClientOrderId, + std::string_view newClientOrderId, + long recvWindow, + Json::Value &json_result); + + // API key required + static void start_userDataStream(Json::Value &json_result); + static void keep_userDataStream(std::string_view listenKey); + static void close_userDataStream(std::string_view listenKey); + + // WAPI + static void withdraw(std::string_view asset, + std::string_view address, + std::string_view addressTag, + double amount, + std::string_view name, + long recvWindow, + Json::Value &json_result); + + static void get_depositHistory(std::string_view asset, + int status, + long startTime, + long endTime, + long recvWindow, + Json::Value &json_result); + + static void get_withdrawHistory(std::string_view asset, + int status, + long startTime, + long endTime, + long recvWindow, + Json::Value &json_result); + + static void get_depositAddress(std::string_view asset, + long recvWindow, + Json::Value &json_result); }; -} // namespace core +namespace binance_cpp +{ // Main API namespace bringing together all financial trading modules // Use the specific namespace modules for organized API access: // - financial_trading::spot_trading @@ -90,7 +185,6 @@ class BinanceAPI // - financial_trading::algo_trading // - financial_trading::wallet // - financial_trading::copy_trading - } // namespace binance_cpp #endif // BINANCE_CPP_H diff --git a/src/binance_logger.h b/src/binance_logger.h index f541bf6..2bdbd5f 100644 --- a/src/binance_logger.h +++ b/src/binance_logger.h @@ -1,6 +1,8 @@ #ifndef BINANCE_LOGGER_H #define BINANCE_LOGGER_H +#include "binance_cpp.h" + // Platform-specific includes #ifdef _WIN32 #include @@ -36,7 +38,7 @@ #define HAS_STD_FORMAT 0 #endif -class BinanceCPP_logger +class BINANCECPP_API BinanceCPP_logger { static int debug_level; static std::string debug_log_file; diff --git a/src/binance_utils.h b/src/binance_utils.h index f657cf7..89af37c 100644 --- a/src/binance_utils.h +++ b/src/binance_utils.h @@ -6,6 +6,7 @@ // Cross-platform includes #ifdef _WIN32 +#define NOMINMAX // Prevent Windows min/max macros from conflicting with std::min/max #include #include #define F_OK 0 diff --git a/src/binance_websocket.cpp b/src/binance_websocket.cpp index 1a5dea9..771ee7e 100644 --- a/src/binance_websocket.cpp +++ b/src/binance_websocket.cpp @@ -1,3 +1,7 @@ +#ifdef _WIN32 +#define NOMINMAX // Prevent Windows min/max macros from conflicting with std::min/max +#endif + #include "binance_websocket.h" #include "binance_logger.h" @@ -91,7 +95,10 @@ void BinanceCPP_websocket::init() void BinanceCPP_websocket::connect_endpoint(CB cb, std::string_view path) { char ws_path[1024]; - strcpy(ws_path, path.data()); + // Use safer string copy with bounds checking + size_t path_len = std::min(path.length(), sizeof(ws_path) - 1); + std::memcpy(ws_path, path.data(), path_len); + ws_path[path_len] = '\0'; /* Connect if we are not connected to the server. */ struct lws_client_connect_info ccinfo = {0}; diff --git a/src/binance_websocket.h b/src/binance_websocket.h index ef465f2..ea1a913 100644 --- a/src/binance_websocket.h +++ b/src/binance_websocket.h @@ -2,6 +2,8 @@ #ifndef BINANCE_WEBSOCKET_H #define BINANCE_WEBSOCKET_H +#include "binance_cpp.h" + // Modern C++20 headers #include #include @@ -10,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +28,7 @@ constexpr int BINANCE_WS_PORT = 9443; // Modern C++20 callback type using std::function using CB = std::function; -class BinanceCPP_websocket +class BINANCECPP_API BinanceCPP_websocket { static struct lws_context *context; static struct lws_protocols protocols[]; diff --git a/src/core/binance_api.cpp b/src/core/binance_api.cpp index eb1775d..5178978 100644 --- a/src/core/binance_api.cpp +++ b/src/core/binance_api.cpp @@ -10,7 +10,7 @@ #include #include -#include "../binance_cpp.h" +#include "../binance_api.h" #include "../binance_logger.h" #include "../binance_utils.h" diff --git a/src/financial_trading/spot_trading.h b/src/financial_trading/spot_trading.h index 4d065d9..a8e434c 100644 --- a/src/financial_trading/spot_trading.h +++ b/src/financial_trading/spot_trading.h @@ -10,6 +10,8 @@ #ifndef BINANCE_CPP_SPOT_TRADING_H #define BINANCE_CPP_SPOT_TRADING_H +#include "../binance_cpp.h" + #include #include @@ -37,7 +39,7 @@ class ExchangeInformation static void GetSystemStatus(Json::Value& json_result); }; -class ServerTime +class BINANCECPP_API ServerTime { public: static void GetServerTime(Json::Value& json_result); @@ -47,7 +49,7 @@ class ServerTime // Market Data Endpoints (Public) namespace market_data_endpoints { -class OrderBook +class BINANCECPP_API OrderBook { public: static void GetOrderBook(std::string_view symbol, @@ -116,7 +118,7 @@ class KlineCandlestickData Json::Value& json_result); }; -class TradeData +class BINANCECPP_API TradeData { public: static void GetAggregateTradesList(std::string_view symbol, @@ -137,7 +139,7 @@ class TradeData // Account Endpoints (Private - Requires API Key + Signature) namespace account_endpoints { -class AccountInformation +class BINANCECPP_API AccountInformation { public: static void GetAccountInformation(long recv_window, Json::Value& json_result); @@ -350,7 +352,7 @@ class SOROrders // User Data Stream Endpoints (Requires API Key) namespace user_data_stream_endpoints { -class UserDataStream +class BINANCECPP_API UserDataStream { public: static void CreateListenKey(Json::Value& json_result); diff --git a/src/financial_trading/spot_trading/account_endpoints/get_account_information.cpp b/src/financial_trading/spot_trading/account_endpoints/get_account_information.cpp index c0b6e9c..11a11d4 100644 --- a/src/financial_trading/spot_trading/account_endpoints/get_account_information.cpp +++ b/src/financial_trading/spot_trading/account_endpoints/get_account_information.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/account_endpoints/get_account_trade_list.cpp b/src/financial_trading/spot_trading/account_endpoints/get_account_trade_list.cpp index c93dab8..28d7b57 100644 --- a/src/financial_trading/spot_trading/account_endpoints/get_account_trade_list.cpp +++ b/src/financial_trading/spot_trading/account_endpoints/get_account_trade_list.cpp @@ -8,7 +8,7 @@ (SIGNED) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/general_endpoints/get_exchange_info.cpp b/src/financial_trading/spot_trading/general_endpoints/get_exchange_info.cpp index b98f8d0..e93add0 100644 --- a/src/financial_trading/spot_trading/general_endpoints/get_exchange_info.cpp +++ b/src/financial_trading/spot_trading/general_endpoints/get_exchange_info.cpp @@ -8,7 +8,7 @@ information Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/general_endpoints/get_system_status.cpp b/src/financial_trading/spot_trading/general_endpoints/get_system_status.cpp index bd660f0..8f3f4e1 100644 --- a/src/financial_trading/spot_trading/general_endpoints/get_system_status.cpp +++ b/src/financial_trading/spot_trading/general_endpoints/get_system_status.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/general_endpoints/server_time.cpp b/src/financial_trading/spot_trading/general_endpoints/server_time.cpp index 6c37c38..ca0aa56 100644 --- a/src/financial_trading/spot_trading/general_endpoints/server_time.cpp +++ b/src/financial_trading/spot_trading/general_endpoints/server_time.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "binance_cpp.h" +#include "../../../binance_api.h" #include "binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/general_endpoints/test_connectivity.cpp b/src/financial_trading/spot_trading/general_endpoints/test_connectivity.cpp index db46362..5a44c9d 100644 --- a/src/financial_trading/spot_trading/general_endpoints/test_connectivity.cpp +++ b/src/financial_trading/spot_trading/general_endpoints/test_connectivity.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "binance_cpp.h" +#include "../../../binance_api.h" #include "binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_all.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_all.cpp index 3b7e1f0..1f9ec2c 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_all.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_all.cpp @@ -8,7 +8,7 @@ symbols) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_with_symbol.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_with_symbol.cpp index f3157c4..d26ee37 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_with_symbol.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_24hr_ticker_price_change_statistics_with_symbol.cpp @@ -8,7 +8,7 @@ symbol) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_aggregate_trades_list.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_aggregate_trades_list.cpp index 561b439..9a51fc8 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_aggregate_trades_list.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_aggregate_trades_list.cpp @@ -6,7 +6,7 @@ GET /api/v3/aggTrades - Compressed/Aggregate trades list */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_klines_candlestick_data.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_klines_candlestick_data.cpp index b4d45da..97e93b1 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_klines_candlestick_data.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_klines_candlestick_data.cpp @@ -6,7 +6,7 @@ GET /api/v3/klines - Kline/candlestick bars for a symbol */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_price.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_price.cpp index 38889d2..55d1fb0 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_price.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_price.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_all.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_all.cpp index e2244ab..62a3907 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_all.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_all.cpp @@ -8,7 +8,7 @@ symbols) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_with_symbol.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_with_symbol.cpp index 0267995..230ff06 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_with_symbol.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_rolling_window_price_change_statistics_with_symbol.cpp @@ -8,7 +8,7 @@ symbol) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_all.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_all.cpp index 98523e3..736bc9d 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_all.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_all.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_with_symbol.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_with_symbol.cpp index ff005ae..9db079d 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_with_symbol.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_order_book_ticker_with_symbol.cpp @@ -8,7 +8,7 @@ parameter) Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_all.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_all.cpp index a7169eb..19915fb 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_all.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_all.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_with_symbol.cpp b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_with_symbol.cpp index 47fd150..da7f710 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_with_symbol.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/get_symbol_price_ticker_with_symbol.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/market_data_endpoints/order_book.cpp b/src/financial_trading/spot_trading/market_data_endpoints/order_book.cpp index d3a994a..cb5bfdd 100644 --- a/src/financial_trading/spot_trading/market_data_endpoints/order_book.cpp +++ b/src/financial_trading/spot_trading/market_data_endpoints/order_book.cpp @@ -8,7 +8,7 @@ Following Google C++ Style Guide naming conventions */ -#include "binance_cpp.h" +#include "../../../binance_api.h" #include "binance_logger.h" namespace binance_cpp diff --git a/src/financial_trading/spot_trading/user_data_stream_endpoints/close_listen_key.cpp b/src/financial_trading/spot_trading/user_data_stream_endpoints/close_listen_key.cpp index 41261e9..69b1dee 100644 --- a/src/financial_trading/spot_trading/user_data_stream_endpoints/close_listen_key.cpp +++ b/src/financial_trading/spot_trading/user_data_stream_endpoints/close_listen_key.cpp @@ -6,7 +6,7 @@ DELETE /api/v3/userDataStream - Close out a user data stream */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/user_data_stream_endpoints/create_listen_key.cpp b/src/financial_trading/spot_trading/user_data_stream_endpoints/create_listen_key.cpp index 42fabbc..d5cfbb0 100644 --- a/src/financial_trading/spot_trading/user_data_stream_endpoints/create_listen_key.cpp +++ b/src/financial_trading/spot_trading/user_data_stream_endpoints/create_listen_key.cpp @@ -6,7 +6,7 @@ POST /api/v3/userDataStream - Create a ListenKey */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/spot_trading/user_data_stream_endpoints/ping_extend_listen_key.cpp b/src/financial_trading/spot_trading/user_data_stream_endpoints/ping_extend_listen_key.cpp index b3cff58..82a73e6 100644 --- a/src/financial_trading/spot_trading/user_data_stream_endpoints/ping_extend_listen_key.cpp +++ b/src/financial_trading/spot_trading/user_data_stream_endpoints/ping_extend_listen_key.cpp @@ -6,7 +6,7 @@ PUT /api/v3/userDataStream - Ping/Keep-alive a ListenKey */ -#include "../../../binance_cpp.h" +#include "../../../binance_api.h" #include "../../../binance_logger.h" #include "../../../binance_utils.h" diff --git a/src/financial_trading/wallet.h b/src/financial_trading/wallet.h index 04a1a17..bf157f5 100644 --- a/src/financial_trading/wallet.h +++ b/src/financial_trading/wallet.h @@ -10,6 +10,8 @@ #ifndef BINANCE_CPP_WALLET_H #define BINANCE_CPP_WALLET_H +#include "../binance_cpp.h" + #include #include @@ -24,7 +26,7 @@ namespace wallet // System Status namespace system_status { -class SystemInformation +class BINANCECPP_API SystemInformation { public: static void GetSystemStatus(Json::Value& json_result); @@ -46,7 +48,7 @@ class SystemInformation // Deposit Management namespace deposit { -class DepositOperations +class BINANCECPP_API DepositOperations { public: static void GetDepositHistory(std::string_view coin, @@ -74,7 +76,7 @@ class DepositOperations // Withdrawal Management namespace withdraw { -class WithdrawOperations +class BINANCECPP_API WithdrawOperations { public: static void Withdraw(std::string_view coin, @@ -98,7 +100,7 @@ class WithdrawOperations Json::Value& json_result); }; -class WithdrawSettings +class BINANCECPP_API WithdrawSettings { public: static void GetCapitalConfigGetall(long recv_window, @@ -130,7 +132,7 @@ class WithdrawSettings // Asset Management namespace asset_management { -class AssetDetails +class BINANCECPP_API AssetDetails { public: static void GetAssetDetail(std::string_view asset, @@ -150,7 +152,7 @@ class AssetDetails Json::Value& json_result); }; -class UniversalTransferOperations +class BINANCECPP_API UniversalTransferOperations { public: static void UniversalTransfer(std::string_view type, @@ -162,7 +164,7 @@ class UniversalTransferOperations Json::Value& json_result); }; -class FundingWallet +class BINANCECPP_API FundingWallet { public: static void GetFundingWallet(std::string_view asset, @@ -195,7 +197,7 @@ class FundingWallet // API Key Management namespace api_management { -class APIKeyInformation +class BINANCECPP_API APIKeyInformation { public: static void GetAPIKeyPermission(long recv_window, Json::Value& json_result); @@ -205,7 +207,7 @@ class APIKeyInformation // Convert Management namespace convert { -class ConvertOperations +class BINANCECPP_API ConvertOperations { public: static void GetConvertTradeHistory(long start_time, @@ -238,7 +240,7 @@ class ConvertOperations // Sub-Account Management namespace sub_account { -class SubAccountOperations +class BINANCECPP_API SubAccountOperations { public: static void CreateVirtualSubAccount(std::string_view sub_account_string, diff --git a/src/financial_trading/wallet/deposit_operations.cpp b/src/financial_trading/wallet/deposit_operations.cpp index 349d68b..f5e406f 100644 --- a/src/financial_trading/wallet/deposit_operations.cpp +++ b/src/financial_trading/wallet/deposit_operations.cpp @@ -6,7 +6,8 @@ Implementation of deposit operations for wallet functionality */ -#include "../../binance_cpp.h" +// Include the main header first to ensure BINANCECPP_API is defined +#include "../../binance_api.h" #include "../../binance_logger.h" #include "../../binance_utils.h" @@ -19,7 +20,7 @@ namespace wallet namespace deposit { -void DepositOperations::GetDepositHistory(std::string_view coin, +BINANCECPP_API void DepositOperations::GetDepositHistory(std::string_view coin, int status, long start_time, long end_time, @@ -107,7 +108,7 @@ void DepositOperations::GetDepositHistory(std::string_view coin, } } -void DepositOperations::GetDepositAddress(std::string_view coin, +BINANCECPP_API void DepositOperations::GetDepositAddress(std::string_view coin, std::string_view network, long recv_window, Json::Value& json_result) diff --git a/src/financial_trading/wallet/withdraw_operations.cpp b/src/financial_trading/wallet/withdraw_operations.cpp index cbaa2f7..73431d6 100644 --- a/src/financial_trading/wallet/withdraw_operations.cpp +++ b/src/financial_trading/wallet/withdraw_operations.cpp @@ -6,7 +6,8 @@ Implementation of withdraw operations for wallet functionality */ -#include "../../binance_cpp.h" +// Include the main header first to ensure BINANCECPP_API is defined +#include "../../binance_api.h" #include "../../binance_logger.h" #include "../../binance_utils.h" @@ -19,7 +20,7 @@ namespace wallet namespace withdraw { -void WithdrawOperations::Withdraw(std::string_view coin, +BINANCECPP_API void WithdrawOperations::Withdraw(std::string_view coin, std::string_view address, double amount, std::string_view address_tag, @@ -105,7 +106,7 @@ void WithdrawOperations::Withdraw(std::string_view coin, } } -void WithdrawOperations::GetWithdrawHistory(std::string_view coin, +BINANCECPP_API void WithdrawOperations::GetWithdrawHistory(std::string_view coin, std::string_view withdraw_order_id, int status, long start_time, diff --git a/test_api_structure.cpp b/test_api_structure.cpp index 803e2f6..a5cd04e 100644 --- a/test_api_structure.cpp +++ b/test_api_structure.cpp @@ -7,7 +7,7 @@ #include -#include "src/binance_cpp.h" +#include "binance_api.h" int main() { diff --git a/test_new_structure.cpp b/test_new_structure.cpp index e9839ef..8a023bc 100644 --- a/test_new_structure.cpp +++ b/test_new_structure.cpp @@ -7,7 +7,7 @@ #include -#include "src/binance_cpp.h" +#include "binance_api.h" int main() {