-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
coinbase: n = string[0] if isinstance(string[0], int) else ord(string[0]), IndexError: index out of range #22256
Comments
Hello @yz26cn, |
I was working on this piece of code. Conda virtual environment, Python=3.12, ccxi=4.3.5
|
@yz26cn Locally that works fine for me 🤔 |
Operating System
MacOS
Programming Languages
Python
CCXT Version
4.3.5
Description
For folks who got the issue
n = string[0] if isinstance(string[0], int) else ord(string[0]) IndexError: index out of range
, it is because the@staticmethod def encode(string): return string.encode('latin-1')
in exchange.py will only encode the part of the string before its first\n
line seperater. So the first step is to remove the '\n' line seperate in your secret.Then input your secret in the format of this:
'''-----BEGIN EC PRIVATE KEY-----
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxx
-----END EC PRIVATE KEY-----'''
You don't need to change the original key or password, here's an example:
exchange = ccxt.coinbase({
'apiKey': api_key,
'secret': '''-----BEGIN EC PRIVATE KEY-----
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxx
-----END EC PRIVATE KEY-----''',
'password': api_passphrase,
})
Hope this issue could be solved soon, since I would not want to store my api secret in my code. Thanks
Code
The text was updated successfully, but these errors were encountered: