अगर आप Python से IQ Option का market data पढ़ना चाहते हैं, तो unofficial library iqoptionapi का get_candles method सबसे common starting point है। इससे किसी भी asset और timeframe की historical candles download की जा सकती हैं — backtests, indicators और bots की नींव। इस सीधी guide में हम सही syntax, confuse करने वाले parameters (timestamp और candle size), एक working example और एक ऐसी API के real risks दिखाते हैं जो official नहीं है

Python में IQ Option API का पूरा step-by-step चाहिए — connection, candles और execution के examples के साथ?

Python में IQ Option API की guide देखें →

get_candles क्या है?

iqoptionapi community द्वारा maintain की जाने वाली (unofficial) library है जो उन्हीं WebSocket channels से IQ Option से connect होती है जिन्हें browser इस्तेमाल करता है। get_candles method किसी तय समय पर खत्म होने वाली candles का एक batch request करता है, और हर candle के open, high, low, close, volume और timestamps वाली dictionaries की list return करता है।

सबसे पहले: library install करें और demo account (PRACTICE mode) पर connect करें। नया code कभी सीधे real account पर test न करें।

Syntax और parameters

सामान्य signature है get_candles(asset, interval, count, end_time):

asset — pair, जैसे: “EURUSD”
interval — candle की size seconds में (60 = 1 min, 300 = 5 min)
count — कितनी candles return करनी हैं
end_time — सबसे हाल की candle का Unix timestamp (आमतौर पर time.time())

Working example

import time from iqoptionapi.stable_api import IQ_Option api = IQ_Option(“apna@email.com”, “apna_password”) api.connect() api.change_balance(“PRACTICE”) # testing ke liye hamesha demo asset = “EURUSD” interval = 60 # 1 minute ki candles count = 100 # aakhri 100 candles end_time = time.time() # abhi tak candles = api.get_candles(asset, interval, count, end_time) for c in candles[-3:]: # aakhri 3 dikhata hai print(“open:”, c[“open”], “close:”, c[“close”], “max:”, c[“max”], “min:”, c[“min”])

List के हर item में open, close, max, min, volume keys और from/to times होते हैं। “real-time” candles के लिए बस get_candles को loop में end_time = time.time() के साथ call करते रहें, या जब repolling के बिना updates चाहिए हों तो continuous streams (start_candles_stream / get_realtime_candles) इस्तेमाल करें।

आम errors

खाली list: आमतौर पर asset बंद है (weekend/timing) या नाम ग़लत है। get_all_open_time() से खुले हुए assets check करें।

उल्टा timestamp: end_time period का अंत होना चाहिए, शुरुआत नहीं। पुरानी history के लिए count × interval घटाएँ।

Disconnection: unofficial API बार-बार गिरती है — reconnection implement करें और हर call से पहले api.check_connect() check करें।

Unofficial API इस्तेमाल करने के risks

IQ Option retail clients के लिए कोई official API publish नहीं करतीiqoptionapi site के protocol पर reverse engineering करती है, जिसका मतलब: platform के किसी भी update पर यह काम करना बंद कर सकती है, terms of use का उल्लंघन कर सकती है, और heavy/automated use में account limit हो सकता है। study और backtest के लिए ज़िम्मेदारी से इस्तेमाल करें, और unaudited code से निकले signals पर कभी आँख मूँदकर भरोसा न करें।

FAQ

क्या get_candles real-time data लेता है?
यह आपके बताए instant पर खत्म होने वाला एक batch खींचता है। continuous updates के लिए streams इस्तेमाल करें (start_candles_stream / get_realtime_candles)।

Candle का minimum interval क्या है?
आम तौर पर 60 seconds (1 minute)। 5, 10 और 15 seconds जैसी values asset और platform पर availability पर निर्भर करती हैं।

क्या iqoptionapi official है?
नहीं। यह community project है, IQ Option के support के बिना, और कभी भी टूट सकती है।

क्या इस data से backtest कर सकते हैं?
हाँ, historical candles को batches में download करके। gaps और timestamps के timezone (Unix/UTC) पर ध्यान दें।

Disclaimer: binary options बेहद high-risk products हैं और ज़्यादातर retail traders पैसा गँवाते हैं। यह content educational और technical है, investment recommendation, offer या financial advice नहीं है। unofficial APIs broker की terms of use का उल्लंघन कर सकती हैं और बिना warning के काम करना बंद कर सकती हैं। real पैसे से trade करने से पहले हमेशा demo account पर test करें और कभी ऐसी रकम risk न करें जिसे आप खो नहीं सकते।

Similar Posts