Lu-Yi-Hsun / iqoptionapi

IQ Option API
372 stars 288 forks source link

Sample buy #11

Open Aleandro21 opened 6 years ago

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun i have a error when

coding=utf-8

from iqoptionapi.stable_api import IQ_Option import logging import time logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s') I_want_money=IQ_Option("email","pass") goal="EURUSD" print("get candles") print(I_want_money.get_candles(goal,60,111,time.time())) Money=1 ACTIVES="EURUSD" ACTION="call" expirations_mode=1 force_buy= "True" I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode,force_buy)

Why ? TypeError: buy() takes exactly 4 arguments (6 given)

Aleandro21 commented 6 years ago

if i change I_want_money.buy(1,'EURUSD','call')

i have this error 2018-05-07 10:05:15,162 {"msg": {"direction": "call", "price": 1, "act": "1", "exp": 1525680360, "time": 1525680313, "type": "turbo"}, "name": "buyV2"} 2018-05-07 10:05:15,190 {"name":"buyComplete","request_id":"","msg":{"isSuccessful":false,"message":["Invalid request"],"result":{}}}

Lu-Yi-Hsun commented 6 years ago

update last version , i can work

i use yor code, i can work

from iqoptionapi.stable_api import IQ_Option
import logging
import time
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
I_want_money=IQ_Option("email","pass")
goal="EURUSD"
print("get candles")
print(I_want_money.get_candles(goal,60,111,time.time()))
Money=1
ACTIVES="EURUSD"
ACTION="call"
expirations_mode=1
force_buy= "True"
I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode,force_buy)

This api frequently adds new features, so you may encounter errors and can look at the latest README.md

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun thanks, work !! you have implemented a signal ?

Lu-Yi-Hsun commented 6 years ago

What signal?

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun same this code https://github.com/n1nj4z33/iqoptionbot for this code i have this error

if self.api.timesync.server_datetime.second == 0: File "/usr/local/lib/python2.7/dist-packages/iqoptionapi/ws/objects/timesync.py", line 37, in server_datetime return datetime.datetime.fromtimestamp(self.server_timestamp) File "/usr/local/lib/python2.7/dist-packages/iqoptionapi/ws/objects/timesync.py", line 24, in server_timestamp return self__server_timestamp / 1000 NameError: global name 'self__server_timestamp' is not defined

Lu-Yi-Hsun commented 6 years ago

@Aleandro21 you mean analysis signal when to buy?

win money signal?

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun sorry the correct link is https://github.com/n1nj4z33/iqoptionbot

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun yes tis code i use for signal of buy or sell

Lu-Yi-Hsun commented 6 years ago

@Aleandro21 is that n1nj4z33/iqoptionbot work well?

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun i have a error : f self.api.timesync.server_datetime.second == 0: File "/usr/local/lib/python2.7/dist-packages/iqoptionapi/ws/objects/timesync.py", line 37, in server_datetime return datetime.datetime.fromtimestamp(self.server_timestamp) File "/usr/local/lib/python2.7/dist-packages/iqoptionapi/ws/objects/timesync.py", line 24, in server_timestamp return self__server_timestamp / 1000 NameError: global name 'self__server_timestamp' is not defined

Aleandro21 commented 6 years ago

yes 1nj4z33/iqoptionbot analysis well , with some changes of mine

Lu-Yi-Hsun commented 6 years ago

ok i fork that try to fix

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun ok thanks , you are the best . i want to give you a gift

Lu-Yi-Hsun commented 6 years ago

@Aleandro21 i seem fix it , some thing working

it output newChartData loop

is that working?

2018-05-07 22:43:12,534 {"name":"newChartData","msg":{"active_id":1,"symbol":"EURUSD","bid":1.191305,"ask":1.191595,"value":1.19145,"volume":0,"time":1525704193,"closed":false,"show_value":1.19145,"buy":1.191595,"sell":1.191305}}
2018-05-07 22:43:12,537 {"name":"newChartData","msg":{"active_id":1,"symbol":"EURUSD","bid":1.191295,"ask":1.191595,"value":1.191445,"volume":0,"time":1525704193,"closed":false,"show_value":1.191445,"buy":1.191595,"sell":1.191295}}
2018-05-07 22:43:12,546 {"name":"newChartData","msg":{"active_id":1,"symbol":"EURUSD","bid":1.191295,"ask":1.191585,"value":1.19144,"volume":0,"time":1525704193,"closed":false,"show_value":1.19144,"buy":1.191585,"sell":1.191295}}
2018-05-07
Aleandro21 commented 6 years ago

@Lu-Yi-Hsun yes, but for me block first to generete a Chart. how did you do ? i receve always this error NameError: global name 'self__server_timestamp' is not defined

Lu-Yi-Hsun commented 6 years ago

@Aleandro21 you can install last version this api

sudo pip2 install -U git+git://github.com/Lu-Yi-Hsun/iqoptionapi.git

that robot work on python2

Aleandro21 commented 6 years ago

@Lu-Yi-Hsun thanks !!!!