Fix Data Retrieval Error in IQOption API
Budget: $10 – $30 CAD
I'm experiencing a data retrieval error with my current integration of the IQOption API. Specifically, the issue arises when attempting to fetch open trades. The code is written in Python, so proficiency in this language is crucial.
Ideal Skills:
- Expert in Python
- Experienced with IQOption API
- Skilled in debugging data retrieval errors
Below are the details of issue and coming only with binary-option
Python code (this is not full code, part of it):
instrument_type = "binary-option"
trades_history = Iq.get_positions(instrument_type)
print("Trade History:")
for trade in trades_history:
print(trade)
Below is the error after executing python code-
2024-10-18 15:35:13,130 {"request_id":"","name":"positions","msg":{"message":"Failed on command execution [4000] Can not parse body command trading.get-positions({\"user_id\":58,\"user_group_id\":18,\"group_id\":18,\"is_regulated\":false,\"brand_id\":1,\"country_id\":225,\"company_id\":2,\"trading_group_id\":\"18_0\",\"digital_option_trading_group_id\":\"18_0\",\"turbo_option_trading_group_id\":\"18_0\",\"binary_option_trading_group_id\":\"18_0\",\"blitz_option_trading_group_id\":\"18_0\",\"fx_option_trading_group_id\":\"18_0\",\"forex_trading_group_id\":\"18_0\",\"cfd_trading_group_id\":\"18_0\",\"crypto_trading_group_id\":\"18_0\",\"brand_host\":\"iqoption.com\",\"platform_id\":82,\"connection_hash\":\"605916550041829018\",\"la":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_timestamp\":1729276512942})({\"instrument_type\":\"Binary\",\"user_balance_id\":489375233})"},"status":4000}
":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_timestamp\":1729276512942})({\"instrument_type\":\"Binary\",\"user_balance_id\":489375233})"},"status":4000}
Trade History:
False
None
when using digital-option as below in code, I am getting the output of placed trade:
instrument_type = "digital-option"
trades_history = Iq.get_positions(instrument_type)
print("Trade History:")
for trade in trades_history:
print(trade)
output :
2024-10-19 13:06:35,114 {"request_id":"","name":"positions","msg":{"total":1,"positions":[{"index":15862294839,"last_index":15862294839,"user_id":98927158,"user_group_id":18,"instrument_type":"digital-option","id":18493631013,"user_balance_id":489375233,"user_balance_type":4,"instrument_id":"do77A20241019D161500T15MPSPT","instrument_id_escape":"do77A20241019D161500T15MPSPT","instrument_underlying":"EURGBP-OTC","instrument_active_id":77,"status":"open","type":"long","currency":"USD","currency_rate":1,"currency_unit":1,"count":0.264056,"count_realized":0,"leverage":1,"buy_amount":15,"sell_amount":0,"buy_amount_enrolled":15,"sell_amount_enrolled":0,"commission":0,"commission_enrolled":0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.836235,"open_client_platform_id":9,"buy_avg_price":56.806129,"buy_avg_price_enrolled":56.806129,"sell_avg_price":0,"sell_avg_price_enrolled":0,"pnl_realized":0,"pnl_realized_enrolled":0,"create_at":1729353943947,"update_at":1729353943966,"close_at":null,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"swap":0,"swap_enrolled":0,"instrument_strike":0.836235,"instrument_strike_value":836235,"instrument_expiration":1729354500000,"instrument_dir":"put","instrument_period":900,"extra_data":{"amount":15000000,"version":"4.0","use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false,"spot_option":true,"lower_instrument_id":"do77A20241019D161500T15MP0F83618","lower_instrument_strike":836180,"upper_instrument_id":"do77A20241019D161500T15MP0F83624","upper_instrument_strike":836240,"open_received_time":1729353943889},"order_ids":[19382506987],"orders":[{"index":9377781200,"client_platform_id":9,"id":19382506987,"user_id":98927158,"user_group_id":18,"user_balance_id":489375233,"user_balance_type":4,"side":"buy","type":"market","status":"filled","execute_status":"trade","position_id":18493631013,"instrument_id":"do77A20241019D161500T15MPSPT","instrument_id_escape":"do77A20241019D161500T15MPSPT","instrument_type":"digital-option","instrument_underlying":"EURGBP-OTC","instrument_active_id":77,"instrument_strike":0.836235,"instrument_strike_value":836235,"instrument_expiration":1729354500000,"instrument_dir":"put","instrument_period":900,"currency":"USD","create_at":1729353943947,"update_at":1729353943966,"execute_at":1729353943966,"count":0.264056,"basic_stoplimit_amount":15,"leverage":1,"underlying_price":0.836235,"avg_price":56.806129,"avg_price_enrolled":56.806129,"commission_amount":0,"commission_amount_enrolled":0,"margin":15,"reject_status":null,"tpsl_extra":null,"take_profit_price":null,"stop_lose_price":null,"extra_data":{"amount":15000000,"version":"4.0","use_trail_stop":false,"auto_margin_call":false,"use_token_for_commission":false,"paid_for_commission":0,"paid_for_commission_enrolled":0,"spot_option":true,"lower_instrument_id":"do77A20241019D161500T15MP0F83618","lower_instrument_strike":836180,"upper_instrument_id":"do77A20241019D161500T15MP0F83624","upper_instrument_strike":836240}}],"open_quote_time_ms":1729353943000,"instrument_index":2713234,"pipeline":"TRADING_SETTINGS_30"}]},"status":2000}
Trade History:
True
I want same output for "binary-option" trades as well.
Ideal Skills:
- Expert in Python
- Experienced with IQOption API
- Skilled in debugging data retrieval errors
Below are the details of issue and coming only with binary-option
Python code (this is not full code, part of it):
instrument_type = "binary-option"
trades_history = Iq.get_positions(instrument_type)
print("Trade History:")
for trade in trades_history:
print(trade)
Below is the error after executing python code-
2024-10-18 15:35:13,130 {"request_id":"","name":"positions","msg":{"message":"Failed on command execution [4000] Can not parse body command trading.get-positions({\"user_id\":58,\"user_group_id\":18,\"group_id\":18,\"is_regulated\":false,\"brand_id\":1,\"country_id\":225,\"company_id\":2,\"trading_group_id\":\"18_0\",\"digital_option_trading_group_id\":\"18_0\",\"turbo_option_trading_group_id\":\"18_0\",\"binary_option_trading_group_id\":\"18_0\",\"blitz_option_trading_group_id\":\"18_0\",\"fx_option_trading_group_id\":\"18_0\",\"forex_trading_group_id\":\"18_0\",\"cfd_trading_group_id\":\"18_0\",\"crypto_trading_group_id\":\"18_0\",\"brand_host\":\"iqoption.com\",\"platform_id\":82,\"connection_hash\":\"605916550041829018\",\"la":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_timestamp\":1729276512942})({\"instrument_type\":\"Binary\",\"user_balance_id\":489375233})"},"status":4000}
":\"24.224.220.250\",\"x_geoip_country_code\":\"CA\",\"user_agent\":\"\",\"ws_message_received_timestamp\":1729276512942})({\"instrument_type\":\"Binary\",\"user_balance_id\":489375233})"},"status":4000}
Trade History:
False
None
when using digital-option as below in code, I am getting the output of placed trade:
instrument_type = "digital-option"
trades_history = Iq.get_positions(instrument_type)
print("Trade History:")
for trade in trades_history:
print(trade)
output :
2024-10-19 13:06:35,114 {"request_id":"","name":"positions","msg":{"total":1,"positions":[{"index":15862294839,"last_index":15862294839,"user_id":98927158,"user_group_id":18,"instrument_type":"digital-option","id":18493631013,"user_balance_id":489375233,"user_balance_type":4,"instrument_id":"do77A20241019D161500T15MPSPT","instrument_id_escape":"do77A20241019D161500T15MPSPT","instrument_underlying":"EURGBP-OTC","instrument_active_id":77,"status":"open","type":"long","currency":"USD","currency_rate":1,"currency_unit":1,"count":0.264056,"count_realized":0,"leverage":1,"buy_amount":15,"sell_amount":0,"buy_amount_enrolled":15,"sell_amount_enrolled":0,"commission":0,"commission_enrolled":0,"close_effect_amount":null,"close_effect_amount_enrolled":null,"close_reason":null,"close_underlying_price":null,"open_underlying_price":0.836235,"open_client_platform_id":9,"buy_avg_price":56.806129,"buy_avg_price_enrolled":56.806129,"sell_avg_price":0,"sell_avg_price_enrolled":0,"pnl_realized":0,"pnl_realized_enrolled":0,"create_at":1729353943947,"update_at":1729353943966,"close_at":null,"stop_lose_order_id":null,"take_profit_order_id":null,"tpsl_extra":null,"swap":0,"swap_enrolled":0,"instrument_strike":0.836235,"instrument_strike_value":836235,"instrument_expiration":1729354500000,"instrument_dir":"put","instrument_period":900,"extra_data":{"amount":15000000,"version":"4.0","use_trail_stop":false,"auto_margin_call":false,"last_change_reason":"market_order","use_token_for_commission":false,"spot_option":true,"lower_instrument_id":"do77A20241019D161500T15MP0F83618","lower_instrument_strike":836180,"upper_instrument_id":"do77A20241019D161500T15MP0F83624","upper_instrument_strike":836240,"open_received_time":1729353943889},"order_ids":[19382506987],"orders":[{"index":9377781200,"client_platform_id":9,"id":19382506987,"user_id":98927158,"user_group_id":18,"user_balance_id":489375233,"user_balance_type":4,"side":"buy","type":"market","status":"filled","execute_status":"trade","position_id":18493631013,"instrument_id":"do77A20241019D161500T15MPSPT","instrument_id_escape":"do77A20241019D161500T15MPSPT","instrument_type":"digital-option","instrument_underlying":"EURGBP-OTC","instrument_active_id":77,"instrument_strike":0.836235,"instrument_strike_value":836235,"instrument_expiration":1729354500000,"instrument_dir":"put","instrument_period":900,"currency":"USD","create_at":1729353943947,"update_at":1729353943966,"execute_at":1729353943966,"count":0.264056,"basic_stoplimit_amount":15,"leverage":1,"underlying_price":0.836235,"avg_price":56.806129,"avg_price_enrolled":56.806129,"commission_amount":0,"commission_amount_enrolled":0,"margin":15,"reject_status":null,"tpsl_extra":null,"take_profit_price":null,"stop_lose_price":null,"extra_data":{"amount":15000000,"version":"4.0","use_trail_stop":false,"auto_margin_call":false,"use_token_for_commission":false,"paid_for_commission":0,"paid_for_commission_enrolled":0,"spot_option":true,"lower_instrument_id":"do77A20241019D161500T15MP0F83618","lower_instrument_strike":836180,"upper_instrument_id":"do77A20241019D161500T15MP0F83624","upper_instrument_strike":836240}}],"open_quote_time_ms":1729353943000,"instrument_index":2713234,"pipeline":"TRADING_SETTINGS_30"}]},"status":2000}
Trade History:
True
I want same output for "binary-option" trades as well.