diff --git a/README.md b/README.md index 9e02c2c..c688c4a 100644 --- a/README.md +++ b/README.md @@ -241,4 +241,4 @@ ws.IsolatedSubPositions("XRP-USDT", [](const SubPositionsResponse &data) { //LOG(INFO) << item.contract_code << ":" << item.direction << "/" << item.volume << "/" << item.margin_mode; } }); -``` \ No newline at end of file +``` diff --git a/huobi_futures/coin_futures/ws/WSNotifyClinet.hpp b/huobi_futures/coin_futures/ws/WSNotifyClinet.hpp index 0853006..9579d37 100644 --- a/huobi_futures/coin_futures/ws/WSNotifyClinet.hpp +++ b/huobi_futures/coin_futures/ws/WSNotifyClinet.hpp @@ -24,6 +24,12 @@ typedef huobi_futures::coin_futures::ws::response_notify::SubContractInfoRespons #include "huobi_futures/coin_futures/ws/response/notify/SubTriggerOrderResponse.hpp" typedef huobi_futures::coin_futures::ws::response_notify::SubTriggerOrderResponse SubTriggerOrderResponse; +#include "huobi_futures/coin_futures/ws/response/notify/SubAlgoOrdersResponse.hpp" +typedef huobi_futures::coin_futures::ws::response_notify::SubAlgoOrdersResponse SubAlgoOrdersResponse; + +#include "huobi_futures/coin_futures/ws/response/notify/SubAccountResponse.hpp" +typedef huobi_futures::coin_futures::ws::response_notify::SubAccountResponse SubAccountResponse; + #include "huobi_futures/wsbase/WSOpData.hpp" typedef huobi_futures::wsbase::WSOpData WSOpData; @@ -573,6 +579,94 @@ namespace huobi_futures Unsub(op_data.ToJson(), ch.str()); } + // 订阅策略订单 + typedef std::function _OnSubAlgoOrdersResponse; + void SubAlgoOrders(const string &contract_code, _OnSubAlgoOrdersResponse callbackFun, const string &cid = utils::DEFAULT_ID) + { + // 构建频道:algo_orders.$contract_code + stringstream ch; + ch << "algo_orders." << contract_code; + + WSOpData op_data; + op_data.op = "sub"; + op_data.topic = ch.str(); + op_data.cid = cid; + + Sub(op_data.ToJson(), ch.str(), [&](const string &data) { + SubAlgoOrdersResponse obj; + JS::ParseContext parseContext(data); + parseContext.allow_unnasigned_required_members = false; + + if (parseContext.parseTo(obj) != JS::Error::NoError) + { + std::string errorStr = parseContext.makeErrorString(); + LOG(ERROR) << "Error parsing struct SubAlgoOrdersResponse error"; + LOG(ERROR) << data; + return; + } + callbackFun(obj); + }); + } + + // 取消订阅策略订单 + void UnsubAlgoOrders(const string &contract_code, const string &cid = utils::DEFAULT_ID) + { + // 构建频道:algo_orders.$contract_code + stringstream ch; + ch << "algo_orders." << contract_code; + + WSOpData op_data; + op_data.op = "unsub"; + op_data.topic = ch.str(); + op_data.cid = cid; + + Unsub(op_data.ToJson(), ch.str()); + } + + // 订阅账户变动数据 + typedef std::function _OnSubAccountResponse; + void SubAccount(_OnSubAccountResponse callbackFun, const string &cid = utils::DEFAULT_ID) + { + // 构建频道:account + stringstream ch; + ch << "account"; + + WSOpData op_data; + op_data.op = "sub"; + op_data.topic = ch.str(); + op_data.cid = cid; + + Sub(op_data.ToJson(), ch.str(), [callbackFun](const string &data) { + SubAccountResponse obj; + JS::ParseContext parseContext(data); + parseContext.allow_unnasigned_required_members = false; + + if (parseContext.parseTo(obj) != JS::Error::NoError) + { + std::string errorStr = parseContext.makeErrorString(); + LOG(ERROR) << "Error parsing struct SubAccountResponse error"; + LOG(ERROR) << data; + return; + } + callbackFun(obj); + }); + } + + // 取消订阅账户变动数据 + void UnsubAccount(const string &cid = utils::DEFAULT_ID) + { + // 构建频道:account + stringstream ch; + ch << "account"; + + WSOpData op_data; + op_data.op = "unsub"; + op_data.topic = ch.str(); + op_data.cid = cid; + + Unsub(op_data.ToJson(), ch.str()); + } + // sub trigger_order end // ---------------------------------------------------------------------------------------------------- }; diff --git a/huobi_futures/coin_futures/ws/response/notify/SubAccountResponse.hpp b/huobi_futures/coin_futures/ws/response/notify/SubAccountResponse.hpp new file mode 100644 index 0000000..b7a5661 --- /dev/null +++ b/huobi_futures/coin_futures/ws/response/notify/SubAccountResponse.hpp @@ -0,0 +1,74 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace coin_futures + { + namespace ws + { + namespace response_notify + { + struct SubAccountResponse + { + struct CurrencyDetail + { + std::optional currency; + std::optional equity; + std::optional isolated_equity; + std::optional available; + std::optional withdraw_available; + std::optional profit_unreal; + std::optional isolated_profit_unreal; + std::optional initial_margin; + std::optional maintenance_margin; + std::optional maintenance_margin_rate; + std::optional initial_margin_rate; + std::optional voucher; + std::optional voucher_value; + std::optional created_time; + std::optional updated_time; + + JS_OBJ(currency, equity, isolated_equity, available, withdraw_available, + profit_unreal, isolated_profit_unreal, initial_margin, maintenance_margin, + maintenance_margin_rate, initial_margin_rate, voucher, voucher_value, + created_time, updated_time); + }; + + struct AccountData + { + std::optional state; + std::optional equity; + std::optional initial_margin; + std::optional maintenance_margin; + std::optional maintenance_margin_rate; + std::optional profit_unreal; + std::optional available_margin; + std::optional voucher_value; + std::optional created_time; + std::optional updated_time; + std::optional version; + std::optional> details; + + JS_OBJ(state, equity, initial_margin, maintenance_margin, maintenance_margin_rate, + profit_unreal, available_margin, voucher_value, created_time, updated_time, + version, details); + }; + + std::string op; + std::string topic; + std::optional ts; + std::optional event; + std::optional uid; + std::optional> data; + + JS_OBJ(op, topic, ts, event, uid, data); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/coin_futures/ws/response/notify/SubAlgoOrdersResponse.hpp b/huobi_futures/coin_futures/ws/response/notify/SubAlgoOrdersResponse.hpp new file mode 100644 index 0000000..84b0c8c --- /dev/null +++ b/huobi_futures/coin_futures/ws/response/notify/SubAlgoOrdersResponse.hpp @@ -0,0 +1,75 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace coin_futures + { + namespace ws + { + namespace response_notify + { + struct SubAlgoOrdersResponse + { + struct Data + { + std::optional id; + std::optional algo_id; + std::optional algo_client_order_id; + std::optional contract_code; + std::optional volume; + std::optional type; + std::optional state; + std::optional position_side; + std::optional margin_mode; + std::optional side; + std::optional tp_trigger_price; + std::optional tp_order_price; + std::optional tp_type; + std::optional tp_trigger_price_type; + std::optional sl_trigger_price; + std::optional sl_order_price; + std::optional sl_type; + std::optional sl_trigger_price_type; + std::optional price; + std::optional price_match; + std::optional trigger_price; + std::optional trigger_price_type; + std::optional active_price; + std::optional order_price_type; + std::optional callback_rate; + std::optional reduce_only; + std::optional actual_volume; + std::optional actual_price; + std::optional actual_time; + std::optional relation_order_id; + std::optional created_time; + std::optional updated_time; + std::optional order_source; + + JS_OBJ(id, algo_id, algo_client_order_id, contract_code, volume, type, state, + position_side, margin_mode, side, tp_trigger_price, tp_order_price, tp_type, + tp_trigger_price_type, sl_trigger_price, sl_order_price, sl_type, + sl_trigger_price_type, price, price_match, trigger_price, trigger_price_type, + active_price, order_price_type, callback_rate, reduce_only, actual_volume, + actual_price, actual_time, relation_order_id, created_time, updated_time, + order_source); + }; + + std::string op; + std::string topic; + std::optional ts; + std::optional event; + std::optional uid; + std::optional> data; + + JS_OBJ(op, topic, ts, event, uid, data); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/AccountClient.hpp b/huobi_futures/linear_swap/restful/AccountClient.hpp index fe2287a..59e5e47 100644 --- a/huobi_futures/linear_swap/restful/AccountClient.hpp +++ b/huobi_futures/linear_swap/restful/AccountClient.hpp @@ -91,6 +91,9 @@ typedef huobi_futures::linear_swap::restful::response_account::SwapAccountBalanc #include "huobi_futures/linear_swap/restful/response/account/SwapMultiAssetsMarginResponse.hpp" typedef huobi_futures::linear_swap::restful::response_account::SwapMultiAssetsMarginResponse SwapMultiAssetsMarginResponse; +#include "huobi_futures/linear_swap/restful/response/account/SwapAccountBillsResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_account::SwapAccountBillsResponse SwapAccountBillsResponse; + namespace huobi_futures { namespace linear_swap @@ -1501,13 +1504,75 @@ namespace huobi_futures path << "?" << option.str(); } // url - string url = pb->Build("POST", path.str()); + string url = pb->Build("GET", path.str()); // post auto result = url_base::HttpRequest::Instance().Get(url); return result; } + std::shared_ptr SwapGetAccountBills( + const string &contract_code, + const string &margin_mode, + const string &type, + const string &start_time, + const string &end_time, + int64_t from, + int32_t limit, + const string &direct) + { + // path + stringstream path; + path << "/v5/account/bills"; + + // option - GET请求,参数在URL中 + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (margin_mode != "") + { + option << "&margin_mode=" << margin_mode; + } + if (type != "") + { + option << "&type=" << type; + } + if (start_time != "") + { + option << "&start_time=" << start_time; + } + if (end_time != "") + { + option << "&end_time=" << end_time; + } + if (from != 0) + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + if (direct != "") + { + option << "&direct=" << direct; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + std::shared_ptr QueryEarnProjectList(const string ¤cy, int pageNum, int pageSize) { // path diff --git a/huobi_futures/linear_swap/restful/AlgoClient.hpp b/huobi_futures/linear_swap/restful/AlgoClient.hpp new file mode 100644 index 0000000..f5a7219 --- /dev/null +++ b/huobi_futures/linear_swap/restful/AlgoClient.hpp @@ -0,0 +1,395 @@ +#pragma once + +#include +#include +#include + +#include "huobi_futures/url_base/PrivateUrlBuilder.hpp" +#include "huobi_futures/url_base/HttpRequest.hpp" +#include "huobi_futures/utils/const_val.hpp" + +// 引入响应结果 +#include "huobi_futures/linear_swap/restful/response/algo/AlgoOrderResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_algo::AlgoOrderResponse AlgoOrderResponse; + +#include "huobi_futures/linear_swap/restful/response/algo/AlgoCancelOrdersResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_algo::AlgoCancelOrdersResponse AlgoCancelOrdersResponse; + +#include "huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrdersResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_algo::AlgoQueryOrdersResponse AlgoQueryOrdersResponse; + +#include "huobi_futures/linear_swap/restful/response/algo/AlgoQueryOpenOrdersResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_algo::AlgoQueryOpenOrdersResponse AlgoQueryOpenOrdersResponse; + +#include "huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrderHistoryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_algo::AlgoQueryOrderHistoryResponse AlgoQueryOrderHistoryResponse; + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + class AlgoClient + { + public: + AlgoClient(const string &access_key, const string &secret_key, const string &host = utils::DEFAULT_HOST) + { + pb = std::make_shared(access_key, secret_key, host); + } + + // POST请求 - 策略委托下单 + std::shared_ptr AlgoOrder( + const string &contract_code, + const string &type, + const string &position_side, + const string &side, + const string &margin_mode, + const string &algo_client_order_id = "", + const string &volume = "", + const string &tp_trigger_price = "", + const string &tp_order_price = "", + const string &tp_type = "", + const string &tp_trigger_price_type = "", + const string &sl_trigger_price = "", + const string &sl_order_price = "", + const string &sl_type = "", + const string &sl_trigger_price_type = "", + const string &price = "", + const string &price_match = "", + const string &trigger_price = "", + const string &trigger_price_type = "", + const string &active_price = "", + const string &order_price_type = "", + const string &callback_rate = "", + const string &reduce_only = "") + { + // path + stringstream path; + path << "/v5/algo/order"; + + // option + stringstream content; + if (contract_code != "") + { + content << ",\"contract_code\":\"" << contract_code << "\""; + } + if (type != "") + { + content << ",\"type\":\"" << type << "\""; + } + if (position_side != "") + { + content << ",\"position_side\":\"" << position_side << "\""; + } + if (side != "") + { + content << ",\"side\":\"" << side << "\""; + } + if (margin_mode != "") + { + content << ",\"margin_mode\":\"" << margin_mode << "\""; + } + if (algo_client_order_id != "") + { + content << ",\"algo_client_order_id\":\"" << algo_client_order_id << "\""; + } + if (volume != "") + { + content << ",\"volume\":\"" << volume << "\""; + } + if (tp_trigger_price != "") + { + content << ",\"tp_trigger_price\":\"" << tp_trigger_price << "\""; + } + if (tp_order_price != "") + { + content << ",\"tp_order_price\":\"" << tp_order_price << "\""; + } + if (tp_type != "") + { + content << ",\"tp_type\":\"" << tp_type << "\""; + } + if (tp_trigger_price_type != "") + { + content << ",\"tp_trigger_price_type\":\"" << tp_trigger_price_type << "\""; + } + if (sl_trigger_price != "") + { + content << ",\"sl_trigger_price\":\"" << sl_trigger_price << "\""; + } + if (sl_order_price != "") + { + content << ",\"sl_order_price\":\"" << sl_order_price << "\""; + } + if (sl_type != "") + { + content << ",\"sl_type\":\"" << sl_type << "\""; + } + if (sl_trigger_price_type != "") + { + content << ",\"sl_trigger_price_type\":\"" << sl_trigger_price_type << "\""; + } + if (price != "") + { + content << ",\"price\":\"" << price << "\""; + } + if (price_match != "") + { + content << ",\"price_match\":\"" << price_match << "\""; + } + if (trigger_price != "") + { + content << ",\"trigger_price\":\"" << trigger_price << "\""; + } + if (trigger_price_type != "") + { + content << ",\"trigger_price_type\":\"" << trigger_price_type << "\""; + } + if (active_price != "") + { + content << ",\"active_price\":\"" << active_price << "\""; + } + if (order_price_type != "") + { + content << ",\"order_price_type\":\"" << order_price_type << "\""; + } + if (callback_rate != "") + { + content << ",\"callback_rate\":\"" << callback_rate << "\""; + } + if (reduce_only != "") + { + content << ",\"reduce_only\":\"" << reduce_only << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + // POST请求 - 撤销策略委托 + std::shared_ptr AlgoCancelOrders( + const string &algo_id = "", + const string &algo_client_order_id = "", + const string &contract_code = "") + { + // path + stringstream path; + path << "/v5/algo/cancel-orders"; + + // option + stringstream content; + if (algo_id != "") + { + content << ",\"algo_id\":\"" << algo_id << "\""; + } + if (algo_client_order_id != "") + { + content << ",\"algo_client_order_id\":\"" << algo_client_order_id << "\""; + } + if (contract_code != "") + { + content << ",\"contract_code\":\"" << contract_code << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + // GET请求 - 查询策略委托 + std::shared_ptr AlgoQueryOrders( + const string &type, + const string &algo_id = "", + const string &algo_client_order_id = "", + const string &contract_code = "") + { + // path + stringstream path; + path << "/v5/algo/order"; + + // option + stringstream option; + if (type != "") + { + option << "&type=" << type; + } + if (algo_id != "") + { + option << "&algo_id=" << algo_id; + } + if (algo_client_order_id != "") + { + option << "&algo_client_order_id=" << algo_client_order_id; + } + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询当前未触发策略委托 + std::shared_ptr AlgoQueryOpenOrders( + const string &type, + const string &contract_code = "", + const string &algo_id = "", + const string &algo_client_order_id = "", + int64_t from = 0, + int32_t limit = 0, + const string &direct = "") + { + // path + stringstream path; + path << "/v5/algo/order/opens"; + + // option + stringstream option; + if (type != "") + { + option << "&type=" << type; + } + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (algo_id != "") + { + option << "&algo_id=" << algo_id; + } + if (algo_client_order_id != "") + { + option << "&algo_client_order_id=" << algo_client_order_id; + } + if (from != 0) + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + if (direct != "") + { + option << "&direct=" << direct; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询历史策略委托 + std::shared_ptr AlgoQueryOrderHistory( + const string &type, + const string &contract_code = "", + const string &margin_mode = "", + const string &states = "", + const string &start_time = "", + const string &end_time = "", + int64_t from = 0, + int32_t limit = 0, + const string &direct = "") + { + // path + stringstream path; + path << "/v5/algo/order/history"; + + // option + stringstream option; + if (type != "") + { + option << "&type=" << type; + } + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (margin_mode != "") + { + option << "&margin_mode=" << margin_mode; + } + if (states != "") + { + option << "&states=" << states; + } + if (start_time != "") + { + option << "&start_time=" << start_time; + } + if (end_time != "") + { + option << "&end_time=" << end_time; + } + if (from != 0) + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + if (direct != "") + { + option << "&direct=" << direct; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + private: + std::shared_ptr pb; + }; + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/CopytradingTraderClient.hpp b/huobi_futures/linear_swap/restful/CopytradingTraderClient.hpp new file mode 100644 index 0000000..8d27a5c --- /dev/null +++ b/huobi_futures/linear_swap/restful/CopytradingTraderClient.hpp @@ -0,0 +1,450 @@ +#pragma once + +#include +#include +#include + +#include "huobi_futures/url_base/PrivateUrlBuilder.hpp" +#include "huobi_futures/url_base/HttpRequest.hpp" +#include "huobi_futures/utils/const_val.hpp" + +// 引入响应结果 +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderInstrumentsResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderInstrumentsResponse CopytradingTraderInstrumentsResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderStatisticsResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderStatisticsResponse CopytradingTraderStatisticsResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistoryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderProfitSharingHistoryResponse CopytradingTraderProfitSharingHistoryResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistorySummaryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderProfitSharingHistorySummaryResponse CopytradingTraderProfitSharingHistorySummaryResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderUnrealizedProfitSharingSummaryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderUnrealizedProfitSharingSummaryResponse CopytradingTraderUnrealizedProfitSharingSummaryResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowersResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderFollowersResponse CopytradingTraderFollowersResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderDeleteFollowerResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderDeleteFollowerResponse CopytradingTraderDeleteFollowerResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderTransferResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderTransferResponse CopytradingTraderTransferResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowerSettingsResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderFollowerSettingsResponse CopytradingTraderFollowerSettingsResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderConfigResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderConfigResponse CopytradingTraderConfigResponse; + +#include "huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderApikeyResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_copytradingtrader::CopytradingTraderApikeyResponse CopytradingTraderApikeyResponse; + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + class CopytradingTraderClient + { + public: + CopytradingTraderClient(const string &access_key, const string &secret_key, const string &host = utils::DEFAULT_HOST) + { + pb = std::make_shared(access_key, secret_key, host); + } + + // GET请求 - 查询交易员支持的合约信息 + std::shared_ptr QueryTraderInstruments(const string &instType) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/instruments"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询交易员数据统计 + std::shared_ptr QueryTraderStatistics(const string &instType) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/statistics"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询交易员分润历史 + std::shared_ptr QueryTraderProfitSharingHistory( + const string &instId, const string &instType, const string &begin, const string &end, + const string &after, const string &before, int32_t limit) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/profit-sharing-history"; + + // option + stringstream option; + if (instId != "") + { + option << "&instId=" << instId; + } + if (instType != "") + { + option << "&instType=" << instType; + } + if (begin != "") + { + option << "&begin=" << begin; + } + if (end != "") + { + option << "&end=" << end; + } + if (after != "") + { + option << "&after=" << after; + } + if (before != "") + { + option << "&before=" << before; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询交易员分润历史汇总 + std::shared_ptr QueryTraderProfitSharingHistorySummary(const string &instType) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/profit-sharing-history-summary"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询交易员待分润汇总 + std::shared_ptr QueryTraderUnrealizedProfitSharingSummary( + const string &instType, const string &ccy) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/unrealized-profit-sharing-summary"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + if (ccy != "") + { + option << "&ccy=" << ccy; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询跟随者列表 + std::shared_ptr QueryTraderFollowers( + const string &instType, const string &begin, const string &end, + const string &after, const string &before, int32_t limit) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/followers"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + if (begin != "") + { + option << "&begin=" << begin; + } + if (end != "") + { + option << "&end=" << end; + } + if (after != "") + { + option << "&after=" << after; + } + if (before != "") + { + option << "&before=" << before; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // POST请求 - 删除跟随者 + std::shared_ptr DeleteTraderFollower( + const string &instType, const string &followerUids) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/follower"; + + // option + stringstream content; + if (instType != "") + { + content << ",\"instType\":\"" << instType << "\""; + } + if (followerUids != "") + { + content << ",\"followerUids\":\"" << followerUids << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + // POST请求 - 交易员资金划转 + std::shared_ptr TraderTransfer( + const string &amt, const string &from, const string &to, const string &ccy) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/transfer"; + + // option + stringstream content; + if (amt != "") + { + content << ",\"amt\":\"" << amt << "\""; + } + if (from != "") + { + content << ",\"from\":\"" << from << "\""; + } + if (to != "") + { + content << ",\"to\":\"" << to << "\""; + } + if (ccy != "") + { + content << ",\"ccy\":\"" << ccy << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + // POST请求 - 交易员跟单设置 + std::shared_ptr TraderFollowerSettings( + const string &instType, bool enable, const string &profitSharingRatio, const string &maxFollowers) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/follower-settings"; + + // option + stringstream content; + if (instType != "") + { + content << ",\"instType\":\"" << instType << "\""; + } + content << ",\"enable\":\"" << (enable ? "true" : "false") << "\""; + if (profitSharingRatio != "") + { + content << ",\"profitSharingRatio\":\"" << profitSharingRatio << "\""; + } + if (maxFollowers != "") + { + content << ",\"maxFollowers\":\"" << maxFollowers << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + // GET请求 - 查询交易员配置 + std::shared_ptr TraderConfig(const string &instType) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/config"; + + // option + stringstream option; + if (instType != "") + { + option << "&instType=" << instType; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // POST请求 - 交易员APIkey管理 + std::shared_ptr TraderApikey(const string &instType) + { + // path + stringstream path; + path << "/api/v6/copyTrading/trader/apikey"; + + // option + stringstream content; + if (instType != "") + { + content << ",\"instType\":\"" << instType << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + private: + std::shared_ptr pb; + }; + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/MarketClient.hpp b/huobi_futures/linear_swap/restful/MarketClient.hpp index 2119fb4..87cafa9 100644 --- a/huobi_futures/linear_swap/restful/MarketClient.hpp +++ b/huobi_futures/linear_swap/restful/MarketClient.hpp @@ -92,6 +92,33 @@ typedef huobi_futures::linear_swap::restful::response_market::GetBasisResponse G #include "huobi_futures/linear_swap/restful/response/market/GetBatchMergedResponseV2.hpp" typedef huobi_futures::linear_swap::restful::response_market::GetBatchMergedResponseV2 GetBatchMergedResponseV2; +#include "huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketFundingRateResponse GetMarketFundingRateResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateHistoryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketFundingRateHistoryResponse GetMarketFundingRateHistoryResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketOpenInterestResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketOpenInterestResponse GetMarketOpenInterestResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketPriceLimitResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketPriceLimitResponse GetMarketPriceLimitResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketLiquidationOrdersResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketLiquidationOrdersResponse GetMarketLiquidationOrdersResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketSettlementHistoryResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketSettlementHistoryResponse GetMarketSettlementHistoryResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketEliteAccountRatioResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketEliteAccountRatioResponse GetMarketEliteAccountRatioResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketElitePositionRatioResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketElitePositionRatioResponse GetMarketElitePositionRatioResponse; + +#include "huobi_futures/linear_swap/restful/response/market/GetMarketEstimatedSettlementPriceResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_market::GetMarketEstimatedSettlementPriceResponse GetMarketEstimatedSettlementPriceResponse; + namespace huobi_futures { namespace linear_swap @@ -987,7 +1014,7 @@ namespace huobi_futures { // location stringstream location; - location << "/v5/market/risk_limit"; + location << "/v5/market/risk/limit"; // option @@ -1059,6 +1086,344 @@ namespace huobi_futures return result; } + // GET请求 - 查询当前资金费率 + std::shared_ptr GetFundingRate(const string &contract_code) + { + // path + stringstream path; + path << "/v5/market/funding_rate"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询历史资金费率 + std::shared_ptr GetFundingRateHistory( + const string &contract_code, + const string &start_time = "", + const string &end_time = "", + int64_t from = 0, + int32_t limit = 0, + const string &direct = "") + { + // path + stringstream path; + path << "/v5/market/funding_rate_history"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (start_time != "") + { + option << "&start_time=" << start_time; + } + if (end_time != "") + { + option << "&end_time=" << end_time; + } + if (from != 0) + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + if (direct != "") + { + option << "&direct=" << direct; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询持仓总量 + std::shared_ptr GetOpenInterest(const string &contract_code) + { + // path + stringstream path; + path << "/v5/market/open_interest"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询价格限制 + std::shared_ptr GetPriceLimit(const string &contract_code) + { + // path + stringstream path; + path << "/v5/market/price_limit"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询强平订单 + std::shared_ptr GetLiquidationOrders( + const string &contract_code = "", + const string &pair = "", + const string &start_time = "", + const string &end_time = "", + const string &direct = "", + int64_t from = 0, + int32_t limit = 0) + { + // path + stringstream path; + path << "/v5/market/liquidation_orders"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (pair != "") + { + option << "&pair=" << pair; + } + if (start_time != "") + { + option << "&start_time=" << start_time; + } + if (end_time != "") + { + option << "&end_time=" << end_time; + } + if (direct != "") + { + option << "&direct=" << direct; + } + if (from != 0) + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询结算历史 + std::shared_ptr GetSettlementHistory( + const string &contract_code = "", + const string &start_time = "", + const string &end_time = "", + const string &direct = "", + const string &from = "", + int32_t limit = 0) + { + // path + stringstream path; + path << "/v5/market/settlement_history"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (start_time != "") + { + option << "&start_time=" << start_time; + } + if (end_time != "") + { + option << "&end_time=" << end_time; + } + if (direct != "") + { + option << "&direct=" << direct; + } + if (from != "") + { + option << "&from=" << from; + } + if (limit != 0) + { + option << "&limit=" << limit; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询精英账户多空持仓对比(账户数) + std::shared_ptr GetEliteAccountRatio( + const string &contract_code, + const string &period) + { + // path + stringstream path; + path << "/v5/market/elite_account_ratio"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (period != "") + { + option << "&period=" << period; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询精英账户多空持仓对比(持仓数) + std::shared_ptr GetElitePositionRatio( + const string &contract_code, + const string &period) + { + // path + stringstream path; + path << "/v5/market/elite_position_ratio"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + if (period != "") + { + option << "&period=" << period; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + + // GET请求 - 查询预估结算价 + std::shared_ptr GetEstimatedSettlementPrice(const string &contract_code) + { + // path + stringstream path; + path << "/v5/market/estimated_settlement_price"; + + // option + stringstream option; + if (contract_code != "") + { + option << "&contract_code=" << contract_code; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // 市场数据接口不需要鉴权,直接使用base url + string url = utils::DEFAULT_HOST + path.str(); + + // get + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + private: std::shared_ptr pb; }; diff --git a/huobi_futures/linear_swap/restful/OrderClient.hpp b/huobi_futures/linear_swap/restful/OrderClient.hpp index 07fefee..f547b55 100644 --- a/huobi_futures/linear_swap/restful/OrderClient.hpp +++ b/huobi_futures/linear_swap/restful/OrderClient.hpp @@ -83,6 +83,12 @@ typedef huobi_futures::linear_swap::restful::response_order::SwapPositionModeRes #include "huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitResponse.hpp" typedef huobi_futures::linear_swap::restful::response_order::SwapPositionRiskLimitResponse SwapPositionRiskLimitResponse; +#include "huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitTierResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_order::SwapPositionRiskLimitTierResponse SwapPositionRiskLimitTierResponse; + +#include "huobi_futures/linear_swap/restful/response/order/SwapPositionMarginResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_order::SwapPositionMarginResponse SwapPositionMarginResponse; + #include "huobi_futures/linear_swap/restful/response/order/SwapTradeOrderHistoryResponse.hpp" typedef huobi_futures::linear_swap::restful::response_order::SwapTradeOrderHistoryResponse SwapTradeOrderHistoryResponse; @@ -92,6 +98,9 @@ typedef huobi_futures::linear_swap::restful::response_order::SwapTradeOrderOpens #include "huobi_futures/linear_swap/restful/response/order/SwapTradeOrderResponse.hpp" typedef huobi_futures::linear_swap::restful::response_order::SwapTradeOrderResponse SwapTradeOrderResponse; +#include "huobi_futures/linear_swap/restful/response/order/SwapTradeCancelAfterResponse.hpp" +typedef huobi_futures::linear_swap::restful::response_order::SwapTradeCancelAfterResponse SwapTradeCancelAfterResponse; + #include "huobi_futures/linear_swap/restful/response/order/SwapTradeOrderTradesResponse.hpp" typedef huobi_futures::linear_swap::restful::response_order::SwapTradeOrderTradesResponse SwapTradeOrderTradesResponse; @@ -1841,6 +1850,36 @@ namespace huobi_futures return result; } + std::shared_ptr SwapTradeCancelAfter(const string &on_off, const string &time_out) + { + // path + stringstream path; + path << "/v5/trade/cancel-after"; + + // option - 这里是GET请求,参数在URL中 + stringstream option; + if (on_off != "") + { + option << "&on_off=" << on_off; + } + if (time_out != "") + { + option << "&time_out=" << time_out; + } + + if (!option.str().empty()) + { + path << "?" << option.str().substr(1); + } + + // url + string url = pb->Build("GET", path.str()); + + // get - 发送GET请求 + auto result = url_base::HttpRequest::Instance().Get(url); + return result; + } + std::shared_ptr SwapTradeBatchorder(string contract_code, string margin_mode, string position_side, string side, string type, string price_match, string client_order_id, string price, string volume, @@ -2464,7 +2503,7 @@ namespace huobi_futures { // path stringstream path; - path << "/v5/position/riskLimit"; + path << "/v5/position/risk/limit"; // option stringstream option; if (contract_code != "") { @@ -2489,6 +2528,82 @@ namespace huobi_futures return result; } + std::shared_ptr SwapPositionRiskLimitTier(const string &contract_code, const string &margin_mode) + { + // path - 对应Java中的 POSITION_RISK_LIMIT_TIER = "/v5/position/risk/limit_tier" + stringstream path; + path << "/v5/position/risk/limit_tier"; + + // 构建请求体 + stringstream content; + if (contract_code != "") + { + content << ",\"contract_code\":\"" << contract_code << "\""; + } + if (margin_mode != "") + { + content << ",\"margin_mode\":\"" << margin_mode << "\""; + } + + // 组装JSON数据 + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; // substr(1)去掉第一个逗号 + } + + // url - 构建完整URL(不需要参数,参数在body中) + string url = pb->Build("POST", path.str()); + + // post - 发送POST请求,对应Java中的doPost + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + + std::shared_ptr SwapPositionMargin( + const string &contract_code, + const string &position_side, + const string &amount, + const string &type) + { + // path + stringstream path; + path << "/v5/position/margin"; + + // option - POST请求,参数在body中 + stringstream content; + if (contract_code != "") + { + content << ",\"contract_code\":\"" << contract_code << "\""; + } + if (position_side != "") + { + content << ",\"position_side\":\"" << position_side << "\""; + } + if (amount != "") + { + content << ",\"amount\":\"" << amount << "\""; + } + if (type != "") + { + content << ",\"type\":\"" << type << "\""; + } + + // data + stringstream data; + if (!content.str().empty()) + { + data << "{" << content.str().substr(1) << "}"; + } + + // url + string url = pb->Build("POST", path.str()); + + // post + auto result = url_base::HttpRequest::Instance().Post(url, data.str()); + return result; + } + std::shared_ptr GetTradeOrder(string contract_code, string margin_mode, string order_id, string client_order_id) { diff --git a/huobi_futures/linear_swap/restful/response/account/SwapAccountBillsResponse.hpp b/huobi_futures/linear_swap/restful/response/account/SwapAccountBillsResponse.hpp new file mode 100644 index 0000000..fcb144a --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/account/SwapAccountBillsResponse.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_account + { + struct SwapAccountBillsResponse + { + struct Data + { + std::optional id; + std::optional contract_code; + std::optional margin_mode; + std::optional type; + std::optional currency; + std::optional amount; + std::optional created_time; + + JS_OBJ(id, contract_code, margin_mode, type, currency, amount, created_time); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/algo/AlgoCancelOrdersResponse.hpp b/huobi_futures/linear_swap/restful/response/algo/AlgoCancelOrdersResponse.hpp new file mode 100644 index 0000000..dc7af70 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/algo/AlgoCancelOrdersResponse.hpp @@ -0,0 +1,40 @@ +// huobi_futures/linear_swap/restful/response_algo/AlgoCancelOrdersResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_algo + { + struct AlgoCancelOrdersResponse + { + struct Data + { + std::optional algo_id; + std::optional algo_client_order_id; + std::optional success; + std::optional error_msg; + std::optional error_code; + + JS_OBJ(algo_id, algo_client_order_id, success, error_msg, error_code); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/algo/AlgoOrderResponse.hpp b/huobi_futures/linear_swap/restful/response/algo/AlgoOrderResponse.hpp new file mode 100644 index 0000000..9efaa2b --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/algo/AlgoOrderResponse.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_algo + { + struct AlgoOrderResponse + { + struct Data + { + std::optional algo_id; + std::optional algo_client_order_id; + + JS_OBJ(algo_id, algo_client_order_id); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOpenOrdersResponse.hpp b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOpenOrdersResponse.hpp new file mode 100644 index 0000000..fcb6cd4 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOpenOrdersResponse.hpp @@ -0,0 +1,73 @@ +// huobi_futures/linear_swap/restful/response_algo/AlgoQueryOpenOrdersResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_algo + { + struct AlgoQueryOpenOrdersResponse + { + struct Data + { + std::optional id; + std::optional volume; + std::optional type; + std::optional state; + std::optional side; + std::optional algo_id; + std::optional algo_client_order_id; + std::optional contract_code; + std::optional position_side; + std::optional margin_mode; + std::optional created_time; + std::optional updated_time; + std::optional order_source; + std::optional active_price; + std::optional callback_rate; + std::optional reduce_only; + std::optional order_price_type; + std::optional tp_trigger_price; + std::optional tp_order_price; + std::optional tp_type; + std::optional tp_trigger_price_type; + std::optional sl_trigger_price; + std::optional sl_order_price; + std::optional sl_type; + std::optional sl_trigger_price_type; + std::optional price; + std::optional price_match; + std::optional trigger_price; + std::optional trigger_price_type; + std::optional actual_volume; + std::optional actual_price; + std::optional actual_time; + std::optional relation_order_id; + + JS_OBJ(id, volume, type, state, side, algo_id, algo_client_order_id, contract_code, + position_side, margin_mode, created_time, updated_time, order_source, + active_price, callback_rate, reduce_only, order_price_type, tp_trigger_price, + tp_order_price, tp_type, tp_trigger_price_type, sl_trigger_price, sl_order_price, + sl_type, sl_trigger_price_type, price, price_match, trigger_price, + trigger_price_type, actual_volume, actual_price, actual_time, relation_order_id); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrderHistoryResponse.hpp b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrderHistoryResponse.hpp new file mode 100644 index 0000000..654eda4 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrderHistoryResponse.hpp @@ -0,0 +1,73 @@ +// huobi_futures/linear_swap/restful/response_algo/AlgoQueryOrderHistoryResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_algo + { + struct AlgoQueryOrderHistoryResponse + { + struct Data + { + std::optional id; + std::optional volume; + std::optional type; + std::optional state; + std::optional side; + std::optional price; + std::optional algo_id; + std::optional algo_client_order_id; + std::optional contract_code; + std::optional position_side; + std::optional margin_mode; + std::optional relation_order_id; + std::optional actual_volume; + std::optional actual_price; + std::optional actual_time; + std::optional created_time; + std::optional updated_time; + std::optional order_source; + std::optional price_match; + std::optional trigger_price; + std::optional trigger_price_type; + std::optional tp_trigger_price; + std::optional tp_order_price; + std::optional tp_type; + std::optional tp_trigger_price_type; + std::optional sl_trigger_price; + std::optional sl_order_price; + std::optional sl_type; + std::optional sl_trigger_price_type; + std::optional active_price; + std::optional order_price_type; + std::optional callback_rate; + std::optional reduce_only; + + JS_OBJ(id, volume, type, state, side, price, algo_id, algo_client_order_id, + contract_code, position_side, margin_mode, relation_order_id, actual_volume, + actual_price, actual_time, created_time, updated_time, order_source, + price_match, trigger_price, trigger_price_type, tp_trigger_price, tp_order_price, + tp_type, tp_trigger_price_type, sl_trigger_price, sl_order_price, sl_type, + sl_trigger_price_type, active_price, order_price_type, callback_rate, reduce_only); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrdersResponse.hpp b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrdersResponse.hpp new file mode 100644 index 0000000..dec2b7a --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/algo/AlgoQueryOrdersResponse.hpp @@ -0,0 +1,74 @@ +// huobi_futures/linear_swap/restful/response_algo/AlgoQueryOrdersResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_algo + { + struct AlgoQueryOrdersResponse + { + struct Data + { + std::optional id; + std::optional algo_id; + std::optional algo_client_order_id; + std::optional contract_code; + std::optional volume; + std::optional type; + std::optional state; + std::optional position_side; + std::optional margin_mode; + std::optional side; + std::optional tp_trigger_price; + std::optional tp_order_price; + std::optional tp_type; + std::optional tp_trigger_price_type; + std::optional sl_trigger_price; + std::optional sl_order_price; + std::optional sl_type; + std::optional sl_trigger_price_type; + std::optional price; + std::optional price_match; + std::optional trigger_price; + std::optional trigger_price_type; + std::optional active_price; + std::optional order_price_type; + std::optional callback_rate; + std::optional reduce_only; + std::optional actual_volume; + std::optional actual_price; + std::optional actual_time; + std::optional relation_order_id; + std::optional created_time; + std::optional updated_time; + std::optional order_source; + + JS_OBJ(id, algo_id, algo_client_order_id, contract_code, volume, type, state, + position_side, margin_mode, side, tp_trigger_price, tp_order_price, tp_type, + tp_trigger_price_type, sl_trigger_price, sl_order_price, sl_type, + sl_trigger_price_type, price, price_match, trigger_price, trigger_price_type, + active_price, order_price_type, callback_rate, reduce_only, actual_volume, + actual_price, actual_time, relation_order_id, created_time, updated_time, + order_source); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderApikeyResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderApikeyResponse.hpp new file mode 100644 index 0000000..ef223bb --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderApikeyResponse.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderApikeyResponse + { + struct Data + { + std::optional label; + std::optional accessKey; + std::optional secretKey; + std::optional> perm; + std::optional ts; + JS_OBJ(label, accessKey, secretKey, perm, ts); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderConfigResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderConfigResponse.hpp new file mode 100644 index 0000000..45d45a7 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderConfigResponse.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderConfigResponse + { + struct Data + { + std::optional enable; + std::optional profitSharingRatio; + std::optional maxFollowers; + JS_OBJ(enable, profitSharingRatio, maxFollowers); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderDeleteFollowerResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderDeleteFollowerResponse.hpp new file mode 100644 index 0000000..8ed5a9a --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderDeleteFollowerResponse.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderDeleteFollowerResponse + { + struct Data + { + std::optional followerUid; + std::optional sCode; + std::optional sMsg; + JS_OBJ(followerUid, sCode, sMsg); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowerSettingsResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowerSettingsResponse.hpp new file mode 100644 index 0000000..fa21e30 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowerSettingsResponse.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderFollowerSettingsResponse + { + struct Data + { + std::optional instType; + std::optional enable; + std::optional profitSharingRatio; + std::optional maxFollowers; + JS_OBJ(instType, enable, profitSharingRatio, maxFollowers); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowersResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowersResponse.hpp new file mode 100644 index 0000000..a07c8aa --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderFollowersResponse.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderFollowersResponse + { + struct Data + { + std::optional id; + std::optional instType; + std::optional followerAvatarLink; + std::optional followerName; + std::optional followerUid; + std::optional followTime; + std::optional followerAssetAmt; + std::optional followerProfitSharingAmt; + std::optional followerTradeAmt; + std::optional totalProfitSharingAmt; + JS_OBJ(id, instType, followerAvatarLink, followerName, followerUid, + followTime, followerAssetAmt, followerProfitSharingAmt, + followerTradeAmt, totalProfitSharingAmt); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderInstrumentsResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderInstrumentsResponse.hpp new file mode 100644 index 0000000..134d321 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderInstrumentsResponse.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderInstrumentsResponse + { + struct Data + { + std::optional instId; + std::optional instType; + JS_OBJ(instId, instType); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistoryResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistoryResponse.hpp new file mode 100644 index 0000000..13ffb86 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistoryResponse.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderProfitSharingHistoryResponse + { + struct Data + { + std::optional id; + std::optional instType; + std::optional followerName; + std::optional ccy; + std::optional profitSharingAmt; + std::optional ts; + JS_OBJ(id, instType, followerName, ccy, profitSharingAmt, ts); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistorySummaryResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistorySummaryResponse.hpp new file mode 100644 index 0000000..1f7118f --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderProfitSharingHistorySummaryResponse.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderProfitSharingHistorySummaryResponse + { + struct Data + { + std::optional instType; + std::optional ccy; + std::optional totalAmt; + JS_OBJ(instType, ccy, totalAmt); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderStatisticsResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderStatisticsResponse.hpp new file mode 100644 index 0000000..f3cc2af --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderStatisticsResponse.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderStatisticsResponse + { + struct ProfitDetail + { + std::optional pnlRate; + std::optional pnl; + std::optional ts; + JS_OBJ(pnlRate, pnl, ts); + }; + + struct Data + { + std::optional instType; + std::optional totalFollowerNum; + std::optional curFollowerNum; + std::optional totalPnl; + std::optional followerTotalPnl; + std::optional winRate; + std::optional winNum; + std::optional lossNum; + std::optional> profitDetails90d; + JS_OBJ(instType, totalFollowerNum, curFollowerNum, totalPnl, followerTotalPnl, + winRate, winNum, lossNum, profitDetails90d); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderTransferResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderTransferResponse.hpp new file mode 100644 index 0000000..4d77409 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderTransferResponse.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderTransferResponse + { + struct Data + { + // 可能为空 + JS_OBJ(); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderUnrealizedProfitSharingSummaryResponse.hpp b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderUnrealizedProfitSharingSummaryResponse.hpp new file mode 100644 index 0000000..2a35706 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/copytradingtrader/CopytradingTraderUnrealizedProfitSharingSummaryResponse.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_copytradingtrader + { + struct CopytradingTraderUnrealizedProfitSharingSummaryResponse + { + struct Data + { + std::optional instType; + std::optional ccy; + std::optional totalAmt; + JS_OBJ(instType, ccy, totalAmt); + }; + std::optional> data; + std::optional> code; + std::optional msg; + std::optional> ts; + JS_OBJ(data, code, msg, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketEliteAccountRatioResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketEliteAccountRatioResponse.hpp new file mode 100644 index 0000000..e816c9b --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketEliteAccountRatioResponse.hpp @@ -0,0 +1,39 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketEliteAccountRatioResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketEliteAccountRatioResponse + { + struct Data + { + std::optional contract_code; + std::optional buy_ratio; + std::optional sell_ratio; + std::optional ts; + + JS_OBJ(contract_code, buy_ratio, sell_ratio, ts); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketElitePositionRatioResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketElitePositionRatioResponse.hpp new file mode 100644 index 0000000..f3615e8 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketElitePositionRatioResponse.hpp @@ -0,0 +1,39 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketElitePositionRatioResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketElitePositionRatioResponse + { + struct Data + { + std::optional contract_code; + std::optional buy_ratio; + std::optional sell_ratio; + std::optional ts; + + JS_OBJ(contract_code, buy_ratio, sell_ratio, ts); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketEstimatedSettlementPriceResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketEstimatedSettlementPriceResponse.hpp new file mode 100644 index 0000000..3134792 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketEstimatedSettlementPriceResponse.hpp @@ -0,0 +1,38 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketEstimatedSettlementPriceResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketEstimatedSettlementPriceResponse + { + struct Data + { + std::optional contract_code; + std::optional settlement_type; + std::optional estimated_settlement_price; + + JS_OBJ(contract_code, settlement_type, estimated_settlement_price); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateHistoryResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateHistoryResponse.hpp new file mode 100644 index 0000000..3526016 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateHistoryResponse.hpp @@ -0,0 +1,40 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketFundingRateHistoryResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketFundingRateHistoryResponse + { + struct Data + { + std::optional id; + std::optional contract_code; + std::optional funding_rate; + std::optional funding_time; + + JS_OBJ(id, contract_code, funding_rate, funding_time); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional success; + std::optional ts; + + JS_OBJ(code, data, message, success, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateResponse.hpp new file mode 100644 index 0000000..dcfd802 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketFundingRateResponse.hpp @@ -0,0 +1,42 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketFundingRateResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketFundingRateResponse + { + struct Data + { + std::optional contract_code; + std::optional funding_rate; + std::optional funding_time; + std::optional next_funding_time; + std::optional min_funding_rate; + std::optional max_funding_rate; + + JS_OBJ(contract_code, funding_rate, funding_time, next_funding_time, min_funding_rate, max_funding_rate); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional success; + std::optional ts; + + JS_OBJ(code, data, message, success, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketLiquidationOrdersResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketLiquidationOrdersResponse.hpp new file mode 100644 index 0000000..e965743 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketLiquidationOrdersResponse.hpp @@ -0,0 +1,44 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketLiquidationOrdersResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketLiquidationOrdersResponse + { + struct Data + { + std::optional id; + std::optional contract_code; + std::optional liquidation_time; + std::optional side; + std::optional position_side; + std::optional volume; + std::optional amount; + std::optional bankrupt_price; + std::optional trade_turnover; + + JS_OBJ(id, contract_code, liquidation_time, side, position_side, volume, amount, bankrupt_price, trade_turnover); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketOpenInterestResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketOpenInterestResponse.hpp new file mode 100644 index 0000000..907241d --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketOpenInterestResponse.hpp @@ -0,0 +1,42 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketOpenInterestResponse.hpp +#pragma once + +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketOpenInterestResponse + { + struct Data + { + std::optional contract_code; + std::optional amount; + std::optional volume; + std::optional value; + std::optional trade_amount; + std::optional trade_volume; + std::optional trade_turnover; + + JS_OBJ(contract_code, amount, volume, value, trade_amount, trade_volume, trade_turnover); + }; + + std::optional code; + std::optional data; + std::optional message; + std::optional success; + std::optional ts; + + JS_OBJ(code, data, message, success, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketPriceLimitResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketPriceLimitResponse.hpp new file mode 100644 index 0000000..ee9dc18 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketPriceLimitResponse.hpp @@ -0,0 +1,38 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketPriceLimitResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketPriceLimitResponse + { + struct Data + { + std::optional contract_code; + std::optional high_limit; + std::optional low_limit; + + JS_OBJ(contract_code, high_limit, low_limit); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketRiskLimitResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketRiskLimitResponse.hpp index 9a9c9bd..cd00f8d 100644 --- a/huobi_futures/linear_swap/restful/response/market/GetMarketRiskLimitResponse.hpp +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketRiskLimitResponse.hpp @@ -29,8 +29,9 @@ namespace huobi_futures std::string maintenance_margin_rate; std::string max_volume; std::string min_volume; + std::string volume_unit; - JS_OBJ(contract_code, contract_type, margin_mode, tier, max_lever, maintenance_margin_rate, max_volume, min_volume); + JS_OBJ(contract_code, contract_type, margin_mode, tier, max_lever, maintenance_margin_rate, max_volume, min_volume, volume_unit); }; std::optional data; diff --git a/huobi_futures/linear_swap/restful/response/market/GetMarketSettlementHistoryResponse.hpp b/huobi_futures/linear_swap/restful/response/market/GetMarketSettlementHistoryResponse.hpp new file mode 100644 index 0000000..30f74d3 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/market/GetMarketSettlementHistoryResponse.hpp @@ -0,0 +1,40 @@ +// huobi_futures/linear_swap/restful/response_market/GetMarketSettlementHistoryResponse.hpp +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_market + { + struct GetMarketSettlementHistoryResponse + { + struct Data + { + std::optional id; + std::optional contract_code; + std::optional settlement_time; + std::optional clawback_ratio; + std::optional settlement_price; + + JS_OBJ(id, contract_code, settlement_time, clawback_ratio, settlement_price); + }; + + std::optional code; + std::optional> data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/order/SwapPositionMarginResponse.hpp b/huobi_futures/linear_swap/restful/response/order/SwapPositionMarginResponse.hpp new file mode 100644 index 0000000..afba664 --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/order/SwapPositionMarginResponse.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_order + { + struct SwapPositionMarginResponse + { + struct Data + { + // DataBean 为空结构 + JS_OBJ(); + }; + + std::optional code; + std::optional data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitResponse.hpp b/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitResponse.hpp index a6bc0ba..8b86819 100644 --- a/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitResponse.hpp +++ b/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitResponse.hpp @@ -29,8 +29,9 @@ namespace huobi_futures std::string maintenance_margin_rate; std::string max_volume; std::string min_volume; + std::string volume_unit; - JS_OBJ(contract_code, contract_type, margin_mode, position_side, max_lever, maintenance_margin_rate, max_volume, min_volume); + JS_OBJ(contract_code, contract_type, margin_mode, position_side, max_lever, maintenance_margin_rate, max_volume, min_volume, volume_unit); }; std::optional data; diff --git a/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitTierResponse.hpp b/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitTierResponse.hpp new file mode 100644 index 0000000..45fbd3b --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/order/SwapPositionRiskLimitTierResponse.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_order + { + struct SwapPositionRiskLimitTierResponse + { + // 对应Java的Integer code + std::optional code; + + // 对应Java的List data + struct DataBean + { + // 对应Java的contract_code + std::string contract_code; + + // 对应Java的margin_mode + std::string margin_mode; + + // 对应Java的tier + std::string tier; + + // 对应Java的max_lever + std::string max_lever; + + // 对应Java的maintenance_margin_rate + std::string maintenance_margin_rate; + + // 对应Java的max_volume + std::string max_volume; + + // 对应Java的min_volume + std::string min_volume; + + // 对应Java的volume_unit + std::string volume_unit; + + JS_OBJ(contract_code, margin_mode, tier, max_lever, maintenance_margin_rate, + max_volume, min_volume, volume_unit); + }; + + // data是一个列表 + std::optional> data; + + // 对应Java的message + std::optional message; + + // 对应Java的ts + int64_t ts; + + JS_OBJ(code, data, message, ts); + }; + } // namespace response_order + } // namespace restful + } // namespace linear_swap +} // namespace huobi_futures \ No newline at end of file diff --git a/huobi_futures/linear_swap/restful/response/order/SwapTradeCancelAfterResponse.hpp b/huobi_futures/linear_swap/restful/response/order/SwapTradeCancelAfterResponse.hpp new file mode 100644 index 0000000..59b054c --- /dev/null +++ b/huobi_futures/linear_swap/restful/response/order/SwapTradeCancelAfterResponse.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include "huobi_futures/json_struct/json_struct.h" + +namespace huobi_futures +{ + namespace linear_swap + { + namespace restful + { + namespace response_order + { + struct SwapTradeCancelAfterResponse + { + struct Data + { + std::optional current_time; + std::optional trigger_time; + + JS_OBJ(current_time, trigger_time); + }; + + std::optional code; + std::optional data; + std::optional message; + std::optional ts; + + JS_OBJ(code, data, message, ts); + }; + } + } + } +} \ No newline at end of file