n1nj4z33 / iqoptionapi

IQ Option API 4.x (Python 2.7) The project is obsolete and is not supported because of problems with access to IQ Options in Russia
119 stars 542 forks source link

Is possible to get chart data? #40

Open CZ-DannyK opened 6 years ago

CZ-DannyK commented 6 years ago

Hi,

i am trying to find out if is possible to subscribe to new chart data. I have found subcribe method, but it wants some channel name and i am not sure what should i put there.

Is is event possible with this library to obtain fresh chart data?

Thanks for help

l9sheen commented 6 years ago

I am new to this library and am unaware of how it works, not even sure how to buy yet. If you manage to get stock data from this API please let us know how it could be done.

Thanks

CZ-DannyK commented 6 years ago

Hi,

i cant say exactly how to update this API as i am not so python experienced to update module (dont know exactly how to update source code and debug them from some test script yet).

Anyway, i have reworked basic parts to .NET and found message to send to receive new chart data:

{ name: "subscribeMessage", msg: { name: "quote-generated", version: "1.0", params: { routingFilters: { active_id: 73 } } } }

Id 73 is now for BTCX (Bitcoin). After this message i am receiving updated quotes data from websocket.

Hope this help, Cheers :)

l9sheen commented 6 years ago

Cheers,

I am intrigued by this API but it's a shame it's not well documented or updated. Is there anyway you could send me some code so I can implement it myself. Having real-time data will be very beneficial? I imagine getting it to work might take some effort but will be great to get it done.

Thanks

CZ-DannyK commented 6 years ago

Hi,

@l9sheen I gave you access to my private dummy repo. I left for you in readme way to contact me. So take a look.

Cheers

SonyPony commented 6 years ago

Hi,

is this issue related to how to get data from custom indicator?

Thanks in advance

CZ-DannyK commented 6 years ago

Hi SonyPony,

no, this is about how to get realtime data feed from IQ. Regarding custom indicators. I dont believe server is sending any indicator data. I am quite sure indicators are calculated from predownloaded OHLC data directly in IQ plaftorm.

Cheers

kanXuT commented 6 years ago

CZ-DannyK, but this is for ticks data (also you can use { "name" : "setActives", "msg" : { "actives" : [1,2,3] } } ), what about candles?

CZ-DannyK commented 6 years ago

@kanXuT You can read getting of candles already from this api, but here is message: { name = "candles", msg = new { active_id = 1, duration = 60, chunk_size = 6, from = XXXXXXXXXX, till = XXXXXXXXXX } }

duration: candle timeframe in seconds (1 min in my example) chunk_size: number of candles send in one batch from: from timestamp to: to timestamp

Cheers

kanXuT commented 6 years ago

Thx @CZ-DannyK you are right, but this is on demand, not subscription like ticks. I'm just wondered if I miss something :).

CZ-DannyK commented 6 years ago

@kanXuT I dont think they have something like this :) They just download inital candles and then form new candles from incoming ticks. If you want new candle every minute for example, you could just do async request every minute with from and to parametrs for last minute candle.

vinydl commented 6 years ago

Below code get details of only one active.

    data = {"active_id": 95,
                "duration": 1,
                "chunk_size": 25,
                "from": timestamp,
                "till": xxxxxx}

if i want details of multiple actives at same instance, what would be the solution?

CZ-DannyK commented 6 years ago

@vinydl Not sure, if candles message support array of active_ids ("active_id": [1, 2, 3]) so you can try, if IQ can handle something like this. Otherwise send multiple requests, each one for single active_id.

vinydl commented 6 years ago

@CZ-DannyK : As of now i am using multiple requests for each id's. I am not sure about array of ids

CZ-DannyK commented 6 years ago

@vinydl You can try and see, and you could let us know results of this experiment :)

vinydl commented 6 years ago

list is not working.. i tried now.

CZ-DannyK commented 6 years ago

@vinydl Ahh, ok, shame. Thank for this! :)

kanXuT commented 6 years ago

@CZ-DannyK, yeah, i do it that way, but it's painful :) - but better that forming own from ticks .. the ticks seems little bit unstable for me

CZ-DannyK commented 6 years ago

@kanXuT Who knows why it is messy on your environment. I dont have any problem with getting new ticks.

Niks005 commented 6 years ago

Its possible. You will have write new websocket object for newChartData.

First you have subscribe the active then iqoption will start sending live data with websocket message name "newChartData".

You will get it in client.py file in method on_message. just check name=="newChartData"

CZ-DannyK commented 6 years ago

@Niks005 Thanks for answer, i have already figured it out, but it might help someone else :)

trashvin commented 5 years ago

How to unsubscribe from the newChartData? After using setActives and used the data, I need to unsubscribe .