From f64ed5e620f03b0d7338c88cfce3bbffba0ad38b Mon Sep 17 00:00:00 2001 From: cabral450 Date: Fri, 29 Apr 2022 23:32:20 -0400 Subject: [PATCH 1/4] Added the option to specify a timestamp since argument for get_past_trades --- gemini/private_client.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gemini/private_client.py b/gemini/private_client.py index 690d049..f9f1cd8 100644 --- a/gemini/private_client.py +++ b/gemini/private_client.py @@ -236,8 +236,8 @@ def active_orders(self): """ return self.api_query('/v1/orders') - @typeassert(symbol=str, limit_trades=int) - def get_past_trades(self, symbol, limit_trades=None): + @typeassert(symbol=str, limit_trades=int, since=float) + def get_past_trades(self, symbol, limit_trades=None, since=0): """ Returns all the past trades associated with the API. Providing a limit_trade is optional. @@ -249,11 +249,18 @@ def get_past_trades(self, symbol, limit_trades=None): Results: array: An array of of dicts of the past trades """ - payload = { + payload1 = { + "symbol": symbol, + "limit_trades": 500 if limit_trades is None else limit_trades, + "timestamp": int(since) + } + payload2 = { "symbol": symbol, "limit_trades": 500 if limit_trades is None else limit_trades } - return self.api_query('/v1/mytrades', payload) + if since != 0: + return self.api_query('/v1/mytrades', payload1) + return self.api_query('/v1/mytrades', payload2) def get_trade_volume(self): """ From 969821876e697b47fff675f24f27e4d02c11b068 Mon Sep 17 00:00:00 2001 From: cabral450 Date: Mon, 2 May 2022 12:56:07 -0400 Subject: [PATCH 2/4] Updated get trades since --- gemini/private_client.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gemini/private_client.py b/gemini/private_client.py index f9f1cd8..366d8af 100644 --- a/gemini/private_client.py +++ b/gemini/private_client.py @@ -236,7 +236,7 @@ def active_orders(self): """ return self.api_query('/v1/orders') - @typeassert(symbol=str, limit_trades=int, since=float) + @typeassert(symbol=str, limit_trades=int, since=int) def get_past_trades(self, symbol, limit_trades=None, since=0): """ Returns all the past trades associated with the API. @@ -249,18 +249,15 @@ def get_past_trades(self, symbol, limit_trades=None, since=0): Results: array: An array of of dicts of the past trades """ - payload1 = { - "symbol": symbol, - "limit_trades": 500 if limit_trades is None else limit_trades, - "timestamp": int(since) - } - payload2 = { + payload = { "symbol": symbol, "limit_trades": 500 if limit_trades is None else limit_trades } + if since != 0: - return self.api_query('/v1/mytrades', payload1) - return self.api_query('/v1/mytrades', payload2) + payload["timestamp"]=since + + return self.api_query('/v1/mytrades', payload) def get_trade_volume(self): """ From 78d2cf408ebedb4d3141b821da1883fb476695f9 Mon Sep 17 00:00:00 2001 From: cabral450 Date: Wed, 25 May 2022 15:39:35 -0400 Subject: [PATCH 3/4] Updated the readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00cb15a..560778d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ A python client for the Gemini API and Websocket ### Installation ```python pip install gemini_python +pip uninstall websocket +pip install websocket-client + ``` ### PublicClient This endpoint doesn't require an api-key and can @@ -244,4 +247,4 @@ r.export_to_xml(r'/c/Users/user/Documents', 'accepted') - Added support for sandbox urls *0.0.1* -- Original release \ No newline at end of file +- Original release From efd0780a750b788286041a438e04232f6f03a812 Mon Sep 17 00:00:00 2001 From: cabral450 Date: Tue, 12 Jul 2022 21:24:34 +0100 Subject: [PATCH 4/4] README update --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 399703f..a78f065 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,19 @@ A python client for the Gemini API and Websocket ## Getting Started ### Installation +From Package ```python -pip install gemini_python -pip uninstall websocket -pip install websocket-client +pip3 install gemini_python +``` +From Source +```python +pip3 install . +``` +Then: +```python +pip3 uninstall websocket +pip3 uninstall websocket-client +pip3 install websocket-client ``` Possibly: `pip install websocket-client==0.44.0`