Welcome to Coinigy V2 developer documentation. This document provides a detailed explanation of the authentication mechanism and the available endpoints.
You can generate an API (V2) key/secret combo on the website in your user settings.
BaseUrl : https://api.coinigy.com Endpoint : /api/v2/private/exchanges?pythagoreanTheorem=a%5E2%2Bb%5E2%3Dc%5E2 Key : keykeykeykeykeykeykeykeykeykeyke Secret : secretsecretsecretsecretsecretse Method : GET Timestamp : 1532718830 (which is 2018-07-27T19:13:50.6694555Z) Body : (empty string) Signature : B618C0B3C92632C701D7CEFC00AC9C8A0771989B21E00D61D4945F79239D2F87
import time import hmac import hashlib import requests import urllib.parse from datetime import datetime, timezone BASE_URL = 'https://api.coinigy.com' ENDPOINT = '/api/v2/private/exchanges/BINA/markets/BTC/USDT/ohlc/h' X_API_KEY = 'keykeykey' SECRET = 'secretsecretsecret' METHOD = 'GET' UNIXTIME = datetime.fromtimestamp(time.time(), timezone.utc) PARAMS = {'StartDate':'2019-01-01T00:00:00.000Z', 'EndDate':'2019-01-02T00:00:00.000Z'} BODY = '' X_API_TIMESTAMP = str(int(datetime.timestamp(UNIXTIME))) query_string = "?" + "&".join( [ key + '=' + urllib.parse.quote_plus(PARAMS[key]) for key in PARAMS.keys() ] ) msg = X_API_KEY + X_API_TIMESTAMP + METHOD + ENDPOINT + (query_string if len(query_string) > 1 else '') + 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(X_API_SIGN) headers = {'Accept': 'application/json', 'Content-Type': 'application/json', 'X-API-SIGN': X_API_SIGN, 'X-API-TIMESTAMP' : X_API_TIMESTAMP, 'X-API-KEY': X_API_KEY} r = requests.get(BASE_URL + ENDPOINT, headers=headers, params=PARAMS, data=BODY) print(r.status_code, r.reason, r.content, BASE_URL + ENDPOINT)
Coinigy's Websocket API provides real-time feeds for trade history, orderbook data, and blockchain alerts.
Our Websocket API is based on SocketCluster (https://socketcluster.io) which has several client libraries available in various languages.
As of 11/19/2018, the recommended client version is socketcluster-client@10 and Websocket connections are limited to 2 connection attempts per 10 seconds.
The Websocket API operates via a pub/sub (publish/subscribe) format. After successfully authenticating with our server, your client will then subscribe to specific channels and live data will stream in via those channels.
Channels are in the format: "METHOD-EXCHANGECODE--PRIMARYCURRENCY--SECONDARYCURRENCY"
Examples:
You may get a list of channels by using socketcluster.emit("channels"), or to see a list of channels for a particular exchange only, socketcluster.emit("channels", "OK"). You can also get a full list of exchanges by emitting "exchanges".
All data is returned as a json object, and the format depends on which channel you're subscribed to.