Created
July 28, 2018 15:20
-
-
Save phillijw/7483bd80050f0418bb258788fd60797b to your computer and use it in GitHub Desktop.
Coinigy API v2 Signature Example in Python 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import hmac | |
import hashlib | |
BASE_URL = 'https://api.coinigy.com' | |
ENDPOINT = '/api/v2/private/exchanges' | |
KEY = 'keykeykeykeykeykeykeykeykeykeyke' | |
SECRET = 'secretsecretsecretsecretsecretse' | |
METHOD = 'GET' | |
UNIXTIME = 1532718830.0 #time.time() | |
BODY = '' | |
X_API_TIMESTAMP = str(int(UNIXTIME)) | |
msg = KEY + X_API_TIMESTAMP + METHOD + ENDPOINT + BODY | |
signature_bytes = hmac.new(SECRET.encode("ascii"), msg.encode("ascii"), digestmod=hashlib.sha256).digest() | |
signature_hex = map("{:02X}".format, signature_bytes) | |
X_API_SIGN = ''.join(signature_hex) | |
print(BASE_URL) | |
print(ENDPOINT) | |
print(KEY) | |
print(SECRET) | |
print(METHOD) | |
print(X_API_TIMESTAMP) | |
print(BODY) | |
print(X_API_SIGN) | |
# BaseUrl : https://api.coinigy.com | |
# Endpoint : /api/v2/private/exchanges | |
# Key : keykeykeykeykeykeykeykeykeykeyke | |
# Secret : secretsecretsecretsecretsecretse | |
# Method : GET | |
# Timestamp : 1532718830 (2018-07-27T19:13:50.6694555Z) | |
# Body : (empty string) | |
# Signature : F9D2192675BA4D7BDB6D768DF077CEEF2A3FB72481B54E37E93CF750EF59892B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment