Lu-Yi-Hsun / iqoptionapi

IQ Option API
372 stars 289 forks source link

is it possible to get a list of active assets? #33

Open s77rt opened 6 years ago

s77rt commented 6 years ago

Hi, is it possible to get a list of active/open assets?

Lu-Yi-Hsun commented 6 years ago

@dzmodest this sample is check binary option("trubo") EURUSD assets is open or not

from iqoptionapi.stable_api import IQ_Option
money=IQ_Option("email","password")
init_info=money.get_all_init()
OP_code = money.get_all_ACTIVES_OPCODE()
if init_info["result"]["turbo"]["actives"][str(OP_code["EURUSD"])]["enabled"]==True:
    print("open")
else:
    print("close")

you can print ""init_info=money.get_all_init()"" look the json and you can do waht you want

s77rt commented 6 years ago

@Lu-Yi-Hsun thanks, this works but not all the time for some assets it does not if they are not listed in iqoption i think example if you try now: NZDUSD 8 you will get an error message something like 'error key code 8' ( don't have time to write for now, sorry, hope it's clear for now )

Lu-Yi-Hsun commented 6 years ago

@dzmodest because NZDUSD not in iqoption binary option so it get error (i can not find NZDUSD in iqoption binary option)

s77rt commented 6 years ago

is there an alternative method that works for OTC assets?

Lu-Yi-Hsun commented 6 years ago

I think I will implement function for easy use~

mymggithub commented 5 years ago

Is there a way to do that for forex and stocks? image

Lu-Yi-Hsun commented 5 years ago

check asset open time?

mymggithub commented 5 years ago

@Lu-Yi-Hsun Would you do that by using I_want_money.get_overnight_fee("cfd","GOOGLE") and then compair it to I_want_money.get_server_timestamp()???? because time zones can be a pain.