n1nj4z33 / iqoptionapi

IQ Option API 4.x (Python 2.7) The project is obsolete and is not supported because of problems with access to IQ Options in Russia
119 stars 542 forks source link

sample code something missing. #75

Open remarco opened 6 years ago

remarco commented 6 years ago

st = datetime.datetime.fromtimestamp(candles[0]+60).strftime('%Y-$ ^ SyntaxError: EOL while scanning string literal

what must be at end of line?

Aleandro21 commented 6 years ago

hello @remarco the complete script is: from iqoptionapi.api import IQOptionAPI import datetime import time import logging logging.basicConfig(format='%(asctime)s %(message)s')

api = IQOptionAPI("iqoption.com", "email", "Password")

api.connect() time.sleep(0.5) print 'Your current blance is: {:.2f}'.format(api.profile.balance)

How to get candles data: 1st param is the asset or so

second is the interval size of the candles (currently 60 secs)

and the third one is the amount of candles we would like to have

api.getcandles(1, 60, 25)

somehow we need that wait. Don't ask me why. Otherwise we have no data

time.sleep(0.25) data = api.candles.candles_data for candles in data: st = datetime.datetime.fromtimestamp(candles[0]+60).strftime('%Y-%m-%d %H:%M:%S') """ candles data 0th entry: timestamp of candle 1st entry: where candles starts in the interval 2nd entry: where candles finishes in the interval 3rd entry: upper wick 4th entry: lower wick """ print st, candles

let's do some buys :D

while api.timesync.server_datetime.second != 48: print api.timesync.server_datetime.second

The first one is the money you want to set

2nd is the asset. Check constants.ASSETS for the values

3rd is the which mode. Turbo is for binary. Don't ask me why

4th is either call or put

api.buy(1, 1, "turbo", "call") time.sleep(0.5)

work all but don't open a buy call position,i don't know

remarco commented 6 years ago

ty.

Aleandro21 commented 6 years ago

Your script work ? Please post your script

remarco commented 6 years ago

i not a programmer . i dont know if it work right now.

remarco commented 6 years ago

2018-02-14 01:46:43,888 {"msg": {"direction": "call", "price": 100, "act": 101, "exp": 1518565668.0, "time": 1518565608, "type": "turbo"}, "name": "buyV2"} 2018-02-14 01:46:43,947 {"name":"buyComplete","request_id":"","msg":{"isSuccessful":false,"message":["Invalid request"],"result":{}}} 2018-02-14 01:46:44,098 {"name":"timeSync","msg":1518565609114}

cant bay :(

gwdm commented 6 years ago

remove the .0 from the exp value

remarco commented 6 years ago

api.buy(100, 101, "turbo", "call") there is not exp value... this must be in api :( i think

remarco commented 6 years ago

`def call(self, price, active, option, direction): """Method to send message to buyv2 websocket chanel. :param price: The buying price. :param active: The buying active. :param option: The buying option. :param direction: The buying direction. """ exp = self.api.timesync.expiration_timestamp

Round to next full minute

    if datetime.datetime.now().second > 30:
        exp = exp - (exp % 60) + 60
    else:

exp = exp - (exp % 60)`

i dont know how to remove there .0

adamovivan commented 6 years ago

Hello, please help, here is my code:

import time from iqoptionapi.api import IQOptionAPI

if name == 'main':

api = IQOptionAPI("iqoption.com", "MyUsername", "MyPassword")
api.connect()
time.sleep(1)
api.setactives([1, 2])

api.getcandles(1, 60, 25)
time.sleep(1)
data = api.candles.candles_data
print(data)

But it prints "None". Where is my mistake?

remarco commented 6 years ago

somehow we need that wait. Don't ask me why. Otherwise we have no data

put time.sleep after api.getcandles. and if you iqoptionapi install like pip install iqoptionapi it work without 3 parameter. beter download manualy and reinstall...

MightyMaxSaviorOfTheUniverse commented 4 years ago

Did anyone find a solution to this problem?

MightyMaxSaviorOfTheUniverse commented 4 years ago

@remarco

Its been such a long time since anyone has used this program, I hope that only means you have 1 year of experience with using this program and can help share your experties :)