bitvavo / python-bitvavo-api

Python wrapper for the Bitvavo API
https://pypi.org/project/python-bitvavo-api/
ISC License
38 stars 25 forks source link

309 error and takes from 1 to 2 positional arguments but 3 were given #31

Open Julicher opened 2 years ago

Julicher commented 2 years ago

When accessing the account: via this example https://docs.bitvavo.com/?_ga=2.52320942.665698512.1641382004-1137001316.1615803719#tag/Account

it gives me the "takes from 1 to 2 positional arguments but 3 were given" error when entering the API and secret API key any solutions?

when accessing it using the dictionary example: https://github.com/bitvavo/python-bitvavo-api (getting started section) it gives me an error that the signature is invalid.

it all worked a few weeks ago but it suddenly stopped working. how? created also a new API and uninstalled the package still nothing

thanks!

rroumenov commented 2 years ago

Could you please append an image/code/example of how are you using it or what are you trying to do?

Checking the last API version, Bitvavo object can be created without parameters, and account method does not expected any, so I cannot understand why are you getting that error.

Regards.

Julicher commented 2 years ago

Sorry for the confusion, I just can't seem to access the api at all: for instance when I use this,

# API setup
bitvavo = Bitvavo({
  'APIKEY': key,
  'APISECRET': secretkey,
  'RESTURL': 'https://api.bitvavo.com/v2',
  'WSURL': 'wss://ws.bitvavo.com/v2/',
  'ACCESSWINDOW': 10000,
  'DEBUGGING': True
})
balance = bitvavo.balance({})
print(balance)

i get:

16:01:19 DEBUG: REQUEST: https://api.bitvavo.com/v2/balance
{'errorCode': 309, 'error': 'The signature is invalid.'}

previously this was just working fine

Thanks

Julicher commented 2 years ago

and this method according to the docs, gives another error: see below

from python_bitvavo_api.bitvavo import Bitvavo

bitvavo = Bitvavo('<APIKEY>', '<APISECRET>')
response = bitvavo.account({})
print(response)
__init__() takes from 1 to 2 positional arguments but 3 were given
NostraDavid commented 2 years ago

Your first block of code works perfectly fine for me; perhaps your key and/or secret aren't quite up to snuff? Or perhaps you haven't installed the latest version of the Bitvavo API? Though they haven't changed much as of late.

About your second block of code: Bitvavo('<APIKEY>', '<APISECRET>') would never work, because the Bitvavo object only accepts a dict object (like your first block), and dicts need both a key and a value combination to work :)

Peccer commented 2 years ago

I am encountering kind of the same problem. In my google cloud function, the below code results in the 309 error. But when I run the code in deepnote (notebook cloud platform) it all works fine....

bitvavo = Bitvavo({ 'APIKEY': key, 'APISECRET': secretkey, 'RESTURL': 'https://api.bitvavo.com/v2', 'WSURL': 'wss://ws.bitvavo.com/v2/', 'ACCESSWINDOW': 10000, 'DEBUGGING': False }) response_asset = bitvavo.assets({'symbol': symbol}) print("respones_asset",response_asset)