diff --git a/README.md b/README.md index 5b9e06b..a0e73c1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ r = gemini.PublicClient(sandbox=True) ```python r.symbols() ``` +- [symbol_details](https://docs.gemini.com/rest-api/#symbol-details) +```python +r.symbol_details("BTCUSD") +``` - [get_ticker](https://docs.gemini.com/rest-api/#ticker) ```python r.get_ticker("BTCUSD") diff --git a/gemini/public_client.py b/gemini/public_client.py index 946f55b..1b61a6a 100644 --- a/gemini/public_client.py +++ b/gemini/public_client.py @@ -29,6 +29,31 @@ def symbols(self): r = requests.get(self.public_base_url + '/symbols') return r.json() + @typeassert(product_id=str) + def symbol_details(self, product_id): + """ + This endpoint retrieves extra detail on supported symbols, such as + minimum order size, tick size, quote increment and more. + + Args: + product_id(str): Can be any value in self.symbols() + + Returns: + dict:tick_size, quote_increment, min_order_size, status and wrap_enabled + example: { + "symbol":"BTCUSD", + "base_currency":"BTC", + "quote_currency":"USD", + "tick_size":1e-08, + "quote_increment":0.01, + "min_order_size":"0.00001", + "status":"open", + "wrap_enabled":false + } + """ + r = requests.get(self.public_base_url + '/symbols/details/' + product_id) + return r.json() + @typeassert(product_id=str) def get_ticker(self, product_id): """ diff --git a/tests/test_public_client.py b/tests/test_public_client.py index 6151a89..c81c248 100644 --- a/tests/test_public_client.py +++ b/tests/test_public_client.py @@ -44,3 +44,16 @@ def test_symbols(self): r = client() symbols = r.symbols() assert type(symbols) is list + + def test_symbol_details(self): + r = client() + symbol_details = r.symbol_details("BTCUSD") + assert type(symbol_details) is dict + assert "symbol" in symbol_details + assert "base_currency" in symbol_details + assert "quote_currency" in symbol_details + assert "tick_size" in symbol_details + assert "quote_increment" in symbol_details + assert "min_order_size" in symbol_details + assert "status" in symbol_details + assert "wrap_enabled" in symbol_details