iqoptionapi
iqoptionapi copied to clipboard
buy_order() not working
Describe the bug When I try to buy forex or crypto using buy_order(), it goes into infinite loop and error given is:
**ERROR:websocket:error from callback <bound method WebsocketClient.on_message of <iqoptionapi.ws.client.WebsocketClient object at 0x7d4160ab1480>>: 'id'
File "/usr/local/lib/python3.10/dist-packages/websocket/_app.py", line 343, in _callback
callback(*args)
File "/usr/local/lib/python3.10/dist-packages/iqoptionapi/ws/client.py", line 139, in on_message
order_placed_temp(self.api, message)
File "/usr/local/lib/python3.10/dist-packages/iqoptionapi/ws/received/order_placed_temp.py", line 5, in order_placed_temp
api.buy_order_id = message["msg"]["id"]**
And when I stop the cell it then tells that it was stuck in
**1249 )
1250
-> 1251 while self.api.buy_order_id == None:
1252 pass
1253 check, data = self.get_order(self.api.buy_order_id)**
To Reproduce Steps to reproduce the behavior:
- After login and connecting
- check,order_id=Iq.buy_order(instrument_type=instrument_type, instrument_id=instrument_id, side=side, amount=amount,leverage=leverage, type=type,limit_price=limit_price, stop_price=stop_price, stop_lose_value=stop_lose_value, stop_lose_kind=stop_lose_kind, take_profit_value=take_profit_value, take_profit_kind=take_profit_kind, use_trail_stop=use_trail_stop, auto_margin_call=auto_margin_call, use_token_for_commission=use_token_for_commission)
- after running the code which is copied from documentation
- Error
Thanks For you time
The same error happens to me.
@Lu-Yi-Hsun can you please help us with this matter? i have the same problem
@Lu-Yi-Hsun help us please buy_order method is not working and showing the following error:
__For_Forex_Stock_Commodities_Crypto_ETFs File "/Users/sekharsrinivasan/Desktop/IQOptionForexBot/iqoptionenv/lib/python3.9/site-packages/websocket_client-0.56.0-py3.9.egg/websocket/_app.py", line 343, in _callback callback(*args) File "/Users/sekharsrinivasan/Desktop/IQOptionForexBot/iqoptionenv/lib/python3.9/site-packages/iqoptionapi-7.1.1-py3.9.egg/iqoptionapi/ws/client.py", line 139, in on_message order_placed_temp(self.api, message) File "/Users/sekharsrinivasan/Desktop/IQOptionForexBot/iqoptionenv/lib/python3.9/site-packages/iqoptionapi-7.1.1-py3.9.egg/iqoptionapi/ws/received/order_placed_temp.py", line 5, in order_placed_temp api.buy_order_id = message["msg"]["id"]
Please help us - Sekhar