crypto-chassis/ccapi

A way to get a complete list of symbols on any exchange

Closed this issue · 5 comments

This might not fall under a feature request and there might already be a simple solution, but after playing around with your API for a little bit, I noticed there are way too many configuration items and some I'm not sure how to obtain. The main one being a complete list of all the symbols available on an exchange. How do I obtain this information? I'd like to subscribe to all the coins periodically.

Try Request request(Request::Operation::GET_INSTRUMENTS, "coinbase", "");

Try Request request(Request::Operation::GET_INSTRUMENTS, "coinbase", "");

I'm new to this library and I couldn't find anything in the examples that uses Request::Operation::GET_INSTRUMETNS, is the request supposed to return a list of symbols? if so how do I get that list? I saw the toString() function which returns this:

Request [exchange = binance-us, marginType = , instrument = , serviceName = market_data, correlationId = 6D6a2kBR, secondaryCorrelationId = , paramList = [ ], credential = {}, operation = GET_INSTRUMENTS, timeSent = 1970-01-01T00:00:00.000000000Z]

Actually let me reword my question, what's the best way to subscribe to all the coins to receive price updates? Currently the way I implemented it is to have a session for each coin which I'm guessing is wrong because even though it works for a few seconds but then somewhere in the thread it crashes. The examples are nice but I wish there was a better documentation so I could understand the proper usage better.

when you send the request, the handler given in your session will receive the event corresponding to your request, the examples in the repo shows how to implement a custom handler and process received events.
As of my knowledge, there is no predefined request returning the list of symbols available within each exchange, but you could performed it by yourself using ccapi::Request::Operation::GENERIC_PUBLIC_REQUEST and then forming the request url following the desired exchange, and then handle the response with your handler:

ccapi::Request request(ccapi::Request::Operation::GENERIC_PUBLIC_REQUEST,CCAPI_EXCHANGE_NAME_KUCOIN, "", correlation_id);
request.appendParam({
{"HTTP_METHOD", SB_GET},
{"HTTP_PATH", SB_MKT_INFO_KUCOIN},
{"HTTP_QUERY_STRING","symbol=" + symbol},
});

Actually let me reword my question, what's the best way to subscribe to all the coins to receive price updates? Currently the way I implemented it is to have a session for each coin which I'm guessing is wrong because even though it works for a few seconds but then somewhere in the thread it crashes. The examples are nice but I wish there was a better documentation so I could understand the proper usage better.

You can use just one session for all coins like this: https://github.com/crypto-chassis/ccapi#multiple-exchanges-andor-instruments.