iqoptionapi icon indicating copy to clipboard operation
iqoptionapi copied to clipboard

buy_order() not working

Open Dawood-Siddique opened this issue 1 year ago • 3 comments

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:

  1. After login and connecting
  2. 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)
  3. after running the code which is copied from documentation
  4. Error

Thanks For you time

Dawood-Siddique avatar Jul 22 '23 22:07 Dawood-Siddique

The same error happens to me.

damianportillo avatar Aug 08 '23 05:08 damianportillo

@Lu-Yi-Hsun can you please help us with this matter? i have the same problem

FarnazAbdollahi avatar Aug 10 '23 14:08 FarnazAbdollahi

@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

Sekharonline4u avatar Aug 24 '23 08:08 Sekharonline4u