Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added support for public endpoint https://docs.gemini.com/rest-api/#s…
  • Loading branch information
TheTallMan67 committed Dec 22, 2021
commit c839a0e129f6e445cf676bafd8d3ebe82187b736
25 changes: 25 additions & 0 deletions gemini/public_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
13 changes: 13 additions & 0 deletions tests/test_public_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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