Lu-Yi-Hsun / iqoptionapi

IQ Option API
373 stars 289 forks source link

Struggling with the buy_order_id for Buy_order #323

Open Arielnu opened 2 years ago

Arielnu commented 2 years ago

Hi there!

I have been trying to set up the code for the buy_order option in the IQOption API and find that I'm struggling at the buy_order_id= part.

I would like to know, how exactly do I write the code in order to accurately return the buy_order_id and what exactly do I put after the buy_order_id= part?

So far my code looks like this:

while True: for RTS in Realtime: print(Realtime[RTS]["open"]) print(Realtime[RTS]["close"]) time.sleep(0.1) if ["open"] == ["open"]: Buy = API.buy_order(instrument_type="crypto", instrument_id="BTCUSD",side="buy",amount=1,leverage=0,type="Market", limit_price=None,stop_price=None,stop_lose_kind=None,stop_lose_value=None,take_profit_kind="percent", take_profit_value=1,use_trail_stop=False,auto_margin_call=True,use_token_for_commission=False) id = API.get_async_order(buy_order_id= id()) print (id())

I just want to know, how do I get the correct order of functions here to get this buy_order code running?

Any help would be appreciated!

Thanks again for the amazing API! Keep up the great work! Great job!

TheHolsback commented 2 years ago

i use the .buy_digital_spot_v2(Active, amount, action, duration) function to start a negotiation. (for binary/turbo type, use .buy(amount, active, action, duration) This function return the status and ID