Skip to content

Instantly share code, notes, and snippets.

@phillijw
Created July 28, 2018 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phillijw/7483bd80050f0418bb258788fd60797b to your computer and use it in GitHub Desktop.
Save phillijw/7483bd80050f0418bb258788fd60797b to your computer and use it in GitHub Desktop.
Coinigy API v2 Signature Example in Python 3
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