Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error code 304 - Python API #29

Open
WesleyK01 opened this issue Oct 27, 2021 · 3 comments
Open

Error code 304 - Python API #29

WesleyK01 opened this issue Oct 27, 2021 · 3 comments

Comments

@WesleyK01
Copy link

Hello,

I am new to Python and I am following the guide. However, when I want to see my account with Python I get the error 304 ?

The code as of now is:
"from python_bitvavo_api.bitvavo import Bitvavo
bitvavo = Bitvavo({
'APIKEY': '',
'APISECRET': '',
'RESTURL': 'https://api.bitvavo.com/v2',
'WSURL': 'wss://ws.bitvavo.com/v2/',
'TIME': 'bitvavo.time()',
'ACCESSWINDOW': 10000,
'DEBUGGING': False
})

response = bitvavo.account()
print(response)"

@NostraDavid
Copy link

Have you tried settings 'DEBUGGING' to True and see what it produces? I have no idea what 304 means (I'm just a user too) - can you provide the error text that comes with the number?

PS: I don't think 'TIME' does anything :)

@NostraDavid
Copy link

Found something about error codes: https://github.com/ccxt/ccxt/blob/6afab37de15feb9c44d82505adf375fc03e2108b/python/ccxt/bitvavo.py

It's probably AuthenticationError - did you set the correct API key and Secret? If I set my own the code works just fine.

@NostraDavid
Copy link

OK, since the time I commented on this, I've had a LOT more experience with the API and have gotten a ton of 304 errors. Turns out it's NOT an AuthenticationError. It's a mismatch between your local clock and the server's clock

You can run this bit to see the difference - it's 5000ms for me (quite a bit, I know!)

from time import time
from urllib.request import urlopen
import json

def time_ms() -> int:
    return int(time() * 1000)


def calculate_lag():
    url = "https://api.bitvavo.com/v2/time"
    result = json.loads(urlopen(url).read())
    server_time = result["time"]
    local_time = time_ms()
    time_delta_ms = result["time"] - local_time
    print(f"server_time: {server_time}")
    print(f"local_time: {local_time}")
    print(f"difference: {time_delta_ms}")

So yeah, it's not you - it's your system clock.

PS: Make sure your Windows clock is synced in your date and time settings
Note: mine is synced, yet the diff is still 5000ms, so don't freak out too much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants