Issue
I am trying to run the repository of IqoptionAppi
While I am trying to run the command: api.getcandles(1,60,25)
the following error occured:
api.getcandles(1,60,25)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __call__() takes 3 positional arguments but 4 were given
I have seen the function and is something like this:
from iqoptionapi.ws.chanels.base import Base
class GetCandles(Base):
"""Class for IQ option candles websocket chanel."""
# pylint: disable=too-few-public-methods
name = "candles"
def __call__(self, active_id, duration, amount):
"""Method to send message to candles websocket chanel.
:param active_id: The active/asset identifier.
:param duration: The candle duration (timeframe for the candles).
:param amount: The number of candles you want to have
"""
data = {"active_id": active_id,
"duration": duration,
"chunk_size": 25,
"from": self.api.timesync.server_timestamp - (duration * amount),
"till": self.api.timesync.server_timestamp}
self.send_websocket_request(self.name, data)
The repository says it works in Python 2.7
but I tried installing it on Python 3.5
, it still worked except the above issue. Guide me where exactly I missed.
Solution
Problem here is that iqoptionapi/ws/chanels/candles.py module from latest PyPI version differs from Github's master
branch version and there is no amount
parameter (it seems to be equal to 2
).
In master
branch:
def __call__(self, active_id, duration, amount):
...
"from": self.api.timesync.server_timestamp - (duration * amount),
...
In 0.5
version:
def __call__(self, active_id, duration):
...
"from": self.api.timesync.server_timestamp - (duration * 2),
...
So we can ignore this parameter (do not pass it at all and use default value 2
) or install master
branch version using git
like
> pip install --upgrade git+https://github.com/n1nj4z33/iqoptionapi.git@master
Here we are using --upgrade
flag since version didn't change so we force to reinstall package.
Or another option: you can ask repo owner to release new version and publish it on PyPI.
Answered By - Azat Ibrakov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.