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

New Liquid Exchange #5

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion quoine/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Quoine(object):
API_URL = 'https://api.quoine.com'
API_VERSION = '2'
VENDOR_ID = None
AMAZON_API_KEY = None
LANGUAGE = 'en'

SIDE_BUY = 'buy'
Expand All @@ -43,7 +44,7 @@ class Quoine(object):
MARGIN_ORDER_DIRECTION_TWO = 'two_direction'
MARGIN_ORDER_DIRECTION_NET = 'netout'

def __init__(self, api_token_id, api_secret, vendor_id=None, language=None):
def __init__(self, api_token_id, api_secret, vendor_id=None, language=None, amazon_api_key=None):
"""Quoine API Client constructor

:param api_token_id: Api Token Id
Expand All @@ -54,6 +55,8 @@ def __init__(self, api_token_id, api_secret, vendor_id=None, language=None):
:type vendor_id: str.
:param language: Langague optional
:type language: str.
:param amazon_api_key: Amazon api key optional
:type amazon_api_key: str.

"""

Expand All @@ -63,6 +66,8 @@ def __init__(self, api_token_id, api_secret, vendor_id=None, language=None):
self.VENDOR_ID = vendor_id
if language:
self.LANGUAGE = language
if amazon_api_key:
self.AMAZON_API_KEY = amazon_api_key
self.session = self._init_session()

def _init_session(self):
Expand All @@ -75,6 +80,8 @@ def _init_session(self):
'Accept-Language': self.LANGUAGE}
if self.VENDOR_ID:
headers['X-Quoine-Vendor-ID'] = self.VENDOR_ID
if self.AMAZON_API_KEY:
headers['x-api-key'] = self.AMAZON_API_KEY
session.headers.update(headers)
return session

Expand Down Expand Up @@ -1940,3 +1947,7 @@ class Quoinex(Quoine):

class Qryptos(Quoinex):
API_URL = 'https://api.qryptos.com'


class Liquid(Quoinex):
API_URL = 'https://api.liquid.com'