8000 Add ticker v2 and candles by devin-jiang · Pull Request #24 · geminipy/geminipy · GitHub
[go: up one dir, main page]

Skip to content
Closed
Changes from all commits
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
25 changes: 22 additions & 3 deletions geminipy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,28 @@ def symbols(self):

return requests.get(url)

def pubticker(self, symbol='btcusd'):
"""Send a request for latest ticker info, return the response."""
url = self.base_url + '/v1/pubticker/' + symbol
def pubticker(self, symbol='btcusd', version='v1'):
"""
Send a request for latest ticker info, return the response.

Arguments:
symbol -- currency symbol (default 'btcusd')
version -- ticker version (default 'v1')
"""
request = '/v1/pubticker/' if version == 'v1' else '/v2/ticker/'
url = self.base_url + request + symbol

return requests.get(url)

def candles(self, symbol='btcusd', time_frame='1m'):
"""
Send a request to get time intervaled data, return the response.

Arguments:
symbol -- currency symbol (default 'btcusd')
time_frame -- time range for each candle (default '1m')
"""
url = self.base_url + '/v2/candles/' + symbol + '/' + time_frame

return requests.get(url)

Expand Down
0