Skip to content

Commit

Permalink
Merge pull request #6 from uoshvis/codereview2020
Browse files Browse the repository at this point in the history
Codereview2020
  • Loading branch information
uoshvis committed Oct 8, 2020
2 parents f211b8d + 13fc3d2 commit 16e3619
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 7 deletions.
16 changes: 16 additions & 0 deletions README.rst
Expand Up @@ -26,5 +26,21 @@ Quick Start
# get markets which have btc as base or quote
assets_btc = client.get_assets('btc')
"""
Returns a market's OHLC candlestick data.
This represents a 1-hour candle starting at 1594087200 and ending at 1602179348.
"""
data = {
'exchange': 'gdax',
'pair': 'btcusd',
'route': 'ohlc',
'params': {
'before': 1602179348,
'after': 1594087200,
'periods': '3600'}
}
market = client.get_markets(data=data)
For more `check out the documentation <https://python-cryptowatch.readthedocs.io/en/latest/>`_.
4 changes: 2 additions & 2 deletions cryptowatch/api_client.py
Expand Up @@ -653,7 +653,7 @@ def get_markets(self, path=None, **kwargs):
'params': {
'before': 1481663244,
'after': 1481663244,
'periods': '60,120'
'periods': '60,180'
}
}
Expand All @@ -665,7 +665,7 @@ def get_markets(self, path=None, **kwargs):
.. code-block:: python
[ CloseTime, OpenPrice, HighPrice, LowPrice, ClosePrice, Volume ]
[ CloseTime, OpenPrice, HighPrice, LowPrice, ClosePrice, Volume, QuoteVolume]
"""

Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Expand Up @@ -2,4 +2,6 @@
test=pytest

[tool:pytest]
addopts=--pylint --ignore=docs
addopts=--ignore=docs


31 changes: 27 additions & 4 deletions tests/test_api_client.py
Expand Up @@ -21,6 +21,22 @@ def test_get_assets_symbol(assets_keys, symbol='btc'):
response = client.get_assets(symbol)
assert isinstance(response, dict)
assert set(assets_keys).issubset(response.keys())
assert symbol == response['result']['symbol']


def test_get_pairs(assets_keys, pair=None):
"""Test an API call to get pairs info """
response = client.get_pairs(pair)
assert isinstance(response, dict)
assert set(assets_keys).issubset(response.keys())


def test_get_pairs_details(assets_keys, pair='btceur'):
"""Test an API call to get pair info """
response = client.get_pairs(pair)
assert isinstance(response, dict)
assert set(assets_keys).issubset(response.keys())
assert pair == response['result']['symbol']


def test_api_exception(symbol='invalid'):
Expand All @@ -38,15 +54,22 @@ def test_invalid_json(symbol='btc'):
client.get_assets(symbol)


def test_get_single_exchange_market(assets_keys, symbol='kraken'):
"""Test an API call to get assets' info """
response = client.get_markets(symbol)
def test_get_markets(assets_keys):
"""Test an API call to get markets' info """
response = client.get_markets()
assert isinstance(response, dict)
assert set(assets_keys).issubset(response.keys())


def test_get_single_exchange_market(assets_keys, exchange='gdax'):
"""Test an API call to get single exchange info """
response = client.get_markets(exchange)
assert isinstance(response, dict)
assert set(assets_keys).issubset(response.keys())


def test_get_single_market(assets_keys):
"""Test an API call to get assets' info """
"""Test an API call to get market detail """
data = {
'exchange': 'gdax',
'pair': 'btcusd'
Expand Down

0 comments on commit 16e3619

Please sign in to comment.