Skip to content

Commit 72faf67

Browse files
committed
refactor: rename classes and files
1 parent 972976d commit 72faf67

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

cryptomarket/client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Ticker, Trade, Transaction)
1212
from cryptomarket.dataclasses.aclSettings import ACLSettings
1313
from cryptomarket.dataclasses.publicTrade import PublicTrade
14-
from cryptomarket.httpClient import HttpClient
14+
from cryptomarket.http_client import HttpClient
1515

1616

1717
class Client(object):
@@ -580,22 +580,19 @@ def create_spot_order_list(
580580
) -> List[Order]:
581581
"""creates a list of spot orders
582582
583-
Types or contingency:
584-
583+
Types or Contingency:
585584
- ContingencyType.ALL_OR_NONE (ContingencyType.AON)
586585
- ContingencyType.ONE_CANCEL_OTHER (ContingencyType.OCO)
587586
- ContingencyType.ONE_TRIGGER_OTHER (ContingencyType.OTO)
588587
- ContingencyType.ONE_TRIGGER_ONE_CANCEL_OTHER (ContingencyType.OTOCO)
589588
590589
Restriction in the number of orders:
591-
592590
- An AON list must have 2 or 3 orders
593591
- An OCO list must have 2 or 3 orders, and only one can be a limit order
594592
- An OTO list must have 2 or 3 orders
595593
- An OTOCO must have 3 or 4 orders, and for the secondary only one can be a limit order
596594
597595
Symbol restrictions:
598-
599596
- For an AON order list, the symbol code of orders must be unique for each order in the list.
600597
- For an OCO order list, there are no symbol code restrictions.
601598
- For an OTO order list, there are no symbol code restrictions.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from requests.auth import AuthBase
88

99

10-
class HS256(AuthBase):
10+
class HmacAuth(AuthBase):
1111
def __init__(self, api_key: str, secret_key: str, window: int = None):
1212
self.api_key = api_key
1313
self.secret_key = secret_key
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import requests
44

55
from cryptomarket.exceptions import CryptomarketAPIException
6-
from cryptomarket.hmac import HS256
6+
from cryptomarket.hmac_auth import HmacAuth
77

88
api_url = 'https://api.exchange.cryptomkt.com/api/3/'
99

1010

1111
class HttpClient:
1212

13-
def __init__(self, api_key, secret_key, window: int = None):
13+
def __init__(self, api_key: str, secret_key: str, window: int = None):
1414
self.api_key = api_key
1515
self.secret_key = secret_key
1616
self.window = window
@@ -31,7 +31,7 @@ def close_session(self):
3131

3232
def authorize(self):
3333
assert self.session_is_open == True
34-
self.session.auth = HS256(
34+
self.session.auth = HmacAuth(
3535
self.api_key, self.secret_key, window=self.window)
3636

3737
def get(self, endpoint, params=None):
@@ -40,8 +40,8 @@ def get(self, endpoint, params=None):
4040

4141
def post(self, endpoint, params=None):
4242
response = self.session.post(
43-
api_url + endpoint,
44-
data=json.dumps(params),
43+
api_url + endpoint,
44+
data=json.dumps(params),
4545
headers={'Content-Type': 'application/json'})
4646
return self._handle_response(response)
4747

cryptomarket/websockets/client_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from cryptomarket.exceptions import (CryptomarketAPIException,
66
CryptomarketSDKException)
7-
from cryptomarket.hmac import HS256
7+
from cryptomarket.hmac_auth import HmacAuth
88
from cryptomarket.websockets.client_base import ClientBase
99

1010

@@ -77,7 +77,7 @@ def authenticate(self, callback: callable = None):
7777
msg = str(timestamp)
7878
if self.window:
7979
msg += str(self.window)
80-
signature = HS256.get_signature(msg, self.api_secret)
80+
signature = HmacAuth.get_signature(msg, self.api_secret)
8181
params = {
8282
'type': 'HS256',
8383
'api_key': self.api_key,

0 commit comments

Comments
 (0)