ByBitApi.打开活动订单返回timestamp参数为空使用Libcurlc++
创始人
2025-01-12 20:00:46
0

该问题是由于API请求中timestamp参数为空导致的。可以通过使用Libcurl c++的代码示例来解决如下:

#include 
#include 
#include 
#include 

std::string bybitApiSignature(const std::string& secret, const std::string& verb, const std::string& url, const int64_t& expires, const std::string& body) {
    std::stringstream prehash;
    prehash << verb << url << expires << body;
    const std::string message = prehash.str();

    std::vector result(HMAC_SHA256_DIGEST_LENGTH);
    HMAC_SHA256(result.data(), secret.c_str(), secret.size(), message.c_str(), message.size());

    return base64_encode(result.data(), result.size());
}

int main() {
    CURL* curl;
    CURLcode res;

    curl_global_init(CURL_GLOBAL_DEFAULT);

    curl = curl_easy_init();

    std::string verb = "GET";
    std::string endpoint = "/open-api/order/list";
    std::string params = "limit=10&order_status=New";
    const int64_t expires = get_current_timestamp() + 10;
    const std::string body = "";

    std::stringstream ss;
    ss << "https://api.bybit.com" << endpoint << "?api_key=" << apikey << "&" << params
        << "×tamp=" << expires << "&sign=" << bybitApiSignature(secret, verb, endpoint, expires, body);

    std::string url = ss.str();

    if (curl) {
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
        curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    }

    curl_global_cleanup();
    return 0;
}

其中,需要注意对timestamp参数进行正确的传递。

相关内容

热门资讯

今天下午!wepoker透视脚... 今天下午!wepoker透视脚本免费,德扑之星的辅助工具介绍,都是是有挂(有挂技术)1、每一步都需要...
今天上午!wepokerplu... 今天上午!wepokerplus透视脚本免费,德普之星透视软件免费入口官网,原来存在有挂(有挂存在)...
经调查!wepoker有没有辅... 经调查!wepoker有没有辅助,德扑之星私人局辅助器,都是真的有挂(有挂分享)1.德扑之星私人局辅...
针对!wepoker私人局怎么... 针对!wepoker私人局怎么玩,德扑之星有透视辅助吗,果然真的是有挂(有挂教学)在进入德扑之星有透...
据相关数据显示!wepoker... 据相关数据显示!wepoker私人局辅助器怎么用,德普辅助器怎么用,总是真的有挂(有挂规律)德普辅助...
出现新变化!德州圈脚本,德扑之... 出现新变化!德州圈脚本,德扑之星有透视辅助吗,一贯真的是有挂(详细教程);1、下载好德扑之星有透视辅...
今年以来!wepoker破解器... 今年以来!wepoker破解器激活码,智星德州插件最新版本更新内容详解,一贯真的有挂(揭秘有挂)1、...
攻略辅助挂!wepoker分析... 攻略辅助挂!wepoker分析,智星德州插件2024最新版,原来确实有挂(有挂分享)亲,关键说明,智...
这一问题亟待解决!wepoke... 这一问题亟待解决!wepoker怎么挂底牌,德扑之心免费透视,切实是真的有挂(详细教程)1、德扑之心...
日前!xpoker辅助神器,德... 日前!xpoker辅助神器,德普之星透视免费,总是是真的有挂(有挂教程)1、让任何用户在无需德普之星...