iqoptionapi icon indicating copy to clipboard operation
iqoptionapi copied to clipboard

buy is not work in PRACTICE

Open hadipirhadi opened this issue 3 years ago • 2 comments

from iqoptionapi.stable_api import IQ_Option
import logging
import random
import time
from datetime import datetime,timedelta
import logging
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')

I_want_money=IQ_Option("Email","Pass")
# MODE= "PRACTICE"
check, reason =I_want_money.connect()
print(check)
print(reason) 

I_want_money.change_balance("PRACTICE")
                        #MODE: "PRACTICE"/"REAL"
Money=10
ACTIVES="EURUSD"
ACTION="call"#or "put"
expirations_mode=1
print(I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode))

ERROR: Can not purchase an option (the asset is not available at the moment).

Is the initial setting before code needed?

hadipirhadi avatar May 13 '21 21:05 hadipirhadi

You need this command to execute your trade --Old Version I_want_money.buy_digital_spot(ACTIVES, Money,ACTION, expirations_mode) --New Version I_want_money.buy_digital_spot_v2(ACTIVES, Money,ACTION, expirations_mode)

z1perman avatar Jun 26 '21 15:06 z1perman

Thank you, I change the line to what you write to me and replace it with the code the error message changed to this: (False, {'code': 'error_place_digital_order', 'message': 'active_not_found'})

hadipirhadi avatar Jun 28 '21 07:06 hadipirhadi