C++ market/quotes/subscribing

Please, if someone sees my error:

bool IronbeamBroker::subscribeSymbols(const std::string& streamId) {

cpr::Header hdr{
{"Authorization", std::string("Bearer ") + token_},
{"Accept", "application/json"}
};
if (subQuotes_) {
    const std::string url = makeUrl("/market/quotes/subscribe/" + streamId);
    logError(url);
    auto r = cpr::Get(
        cpr::Url{ url },
        cpr::Parameters{ {"symbols","XCME:MNQ.H26"} },
        hdr
    );

    if (r.error || r.status_code != 200) {
       logError("subscribeQuotes failed HTTP " + std::to_string(r.status_code) + " body=" + r.text);
       logError(url);
    //    logError(symbolsParams{0});
        return false;
    }

}

start Streaming() streaming enabled

[logError] in createStreamId.

[logError] https://live.ironbeamapi.com/v2/stream/create
[logError] create StreamId completed.
00f1d5b5-897f-4f6b-bf36-c5c70b2d144e

[logError] https://live.ironbeamapi.com/v2/market/quotes/subscribe/00f1d5b5-897f-4f6b-bf36-c5c70b2d144e
[logError] subscribeQuotes failed HTTP 400 body={“additionalProperties”:{},“error1”:“Can’t subscribe to quotes”,“status”:“ERROR”,“message”:“Error”}
[logError] https://live.ironbeamapi.com/v2/market/quotes/subscribe/00f1d5b5-897f-4f6b-bf36-c5c70b2d144e

Good afternoon.

Please try using “wss” instead of “https” in the endpoint.

Also, you must open the websocket stream before subscribing to quotes. The endpoint for that will be: wss://live.ironbeamapi.com/v2/stream/{stream_id}?token={token}

1 Like