-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from delta575/develop
added CryptoMKT Public
- Loading branch information
Showing
9 changed files
with
211 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
coverage==4.4.1 | ||
pytest==3.2.2 | ||
pytest==3.2.3 | ||
python-decouple==3.1 | ||
requests==2.18.4 | ||
tox==2.8.2 | ||
tox==2.9.1 |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# local | ||
from . import constants as _c | ||
from . import models as _m | ||
from ..base import Client | ||
from .server import CryptoMKTServer | ||
|
||
_p = _c.Path | ||
|
||
|
||
class CryptoMKTPublic(Client): | ||
|
||
error_key = 'message' | ||
|
||
def __init__(self, timeout=30): | ||
Client.__init__(self, CryptoMKTServer(), timeout) | ||
|
||
def markets(self): | ||
url = self.url_for(_p.MARKETS) | ||
data = self.get(url)['data'] | ||
return data | ||
|
||
def ticker(self, market_id: _c.Market): | ||
url = self.url_for(_p.TICKER) | ||
params = { | ||
'market': _c.Market.check(market_id).value | ||
} | ||
data = self.get(url, params=params)['data'] | ||
return _m.Ticker.create_from_json(data) | ||
|
||
def order_book(self, | ||
market_id: _c.Market, | ||
book_side: _c.OrderBook, | ||
page: int=None, | ||
limit: int=None): | ||
params = { | ||
'market': _c.Market.check(market_id).value, | ||
'type': _c.OrderBook.check(book_side).value, | ||
'page': page, | ||
'limit': limit | ||
} | ||
url = self.url_for(_p.ORDER_BOOK) | ||
data = self.get(url, params=params) | ||
return _m.OrderBook.create_from_json(data['data'], data['pagination']) | ||
|
||
def trades(self, | ||
market_id: _c.Market, | ||
start: str=None, | ||
end: str=None, | ||
page: int=None, | ||
limit: int=None): | ||
params = { | ||
'market': _c.Market.check(market_id).value, | ||
'start': start, | ||
'end': end, | ||
'page': page, | ||
'limit': limit | ||
} | ||
url = self.url_for(_p.TRADES) | ||
data = self.get(url, params=params) | ||
return _m.Trades.create_from_json( | ||
data['data'], data.get('pagination')) |
This file contains 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
This file contains 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
This file contains 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