Skip to content

Commit 88d04cc

Browse files
authored
Merge pull request #16 from TheTallMan67/feature/public-get-symbols-details
Public Client: Get Symbol Details
2 parents 5dd11dd + d135767 commit 88d04cc

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ r = gemini.PublicClient(sandbox=True)
2121
```python
2222
r.symbols()
2323
```
24+
- [symbol_details](https://docs.gemini.com/rest-api/#symbol-details)
25+
```python
26+
r.symbol_details("BTCUSD")
27+
```
2428
- [get_ticker](https://docs.gemini.com/rest-api/#ticker)
2529
```python
2630
r.get_ticker("BTCUSD")

gemini/public_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ def symbols(self):
2929
r = requests.get(self.public_base_url + '/symbols')
3030
return r.json()
3131

32+
@typeassert(product_id=str)
33+
def symbol_details(self, product_id):
34+
"""
35+
This endpoint retrieves extra detail on supported symbols, such as
36+
minimum order size, tick size, quote increment and more.
37+
38+
Args:
39+
product_id(str): Can be any value in self.symbols()
40+
41+
Returns:
42+
dict:tick_size, quote_increment, min_order_size, status and wrap_enabled
43+
example: {
44+
"symbol":"BTCUSD",
45+
"base_currency":"BTC",
46+
"quote_currency":"USD",
47+
"tick_size":1e-08,
48+
"quote_increment":0.01,
49+
"min_order_size":"0.00001",
50+
"status":"open",
51+
"wrap_enabled":false
52+
}
53+
"""
54+
r = requests.get(self.public_base_url + '/symbols/details/' + product_id)
55+
return r.json()
56+
3257
@typeassert(product_id=str)
3358
def get_ticker(self, product_id):
3459
"""

tests/test_public_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,16 @@ def test_symbols(self):
4444
r = client()
4545
symbols = r.symbols()
4646
assert type(symbols) is list
47+
48+
def test_symbol_details(self):
49+
r = client()
50+
symbol_details = r.symbol_details("BTCUSD")
51+
assert type(symbol_details) is dict
52+
assert "symbol" in symbol_details
53+
assert "base_currency" in symbol_details
54+
assert "quote_currency" in symbol_details
55+
assert "tick_size" in symbol_details
56+
assert "quote_increment" in symbol_details
57+
assert "min_order_size" in symbol_details
58+
assert "status" in symbol_details
59+
assert "wrap_enabled" in symbol_details

0 commit comments

Comments
 (0)