From 64b43a3f75cecab98f17792e4e507db7b04b2613 Mon Sep 17 00:00:00 2001 From: s4w3d0ff Date: Mon, 6 Nov 2017 10:46:41 -0800 Subject: [PATCH 1/5] Add proxy support #167 --- poloniex/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/poloniex/__init__.py b/poloniex/__init__.py index 2ed67663..e4ce09de 100644 --- a/poloniex/__init__.py +++ b/poloniex/__init__.py @@ -108,7 +108,7 @@ class Poloniex(object): def __init__( self, key=False, secret=False, - timeout=None, coach=True, jsonNums=False): + timeout=None, coach=True, jsonNums=False, proxies=None): """ key = str api key supplied by Poloniex secret = str secret hash supplied by Poloniex @@ -120,9 +120,10 @@ def __init__( # Time Placeholders: (MONTH == 30*DAYS) self.MINUTE, self.HOUR, self.DAY, self.WEEK, self.MONTH, self.YEAR """ - # set logger and coach + # set logger, coach, and proxies self.logger = logger self.coach = coach + self.proxies = proxies if self.coach is True: self.coach = Coach() # create nonce @@ -201,7 +202,10 @@ def __call__(self, command, args={}): # add headers to payload payload['headers'] = {'Sign': sign.hexdigest(), 'Key': self.key} - + # add proxies if needed + if self.proxies: + payload['proxies'] = self.proxies + # send the call ret = _post(**payload) @@ -216,7 +220,9 @@ def __call__(self, command, args={}): # wait for coach if self.coach: self.coach.wait() - + # add proxies if needed + if self.proxies: + payload['proxies'] = self.proxies # send the call ret = _get(**payload) From d750c419eb100ec471af9149f3bacf0cf99e2b48 Mon Sep 17 00:00:00 2001 From: Skylar Saveland Date: Sat, 25 Nov 2017 00:31:08 -0800 Subject: [PATCH 2/5] add limit parameter to returnTradeHistory --- poloniex/__init__.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/poloniex/__init__.py b/poloniex/__init__.py index 2ed67663..907d0c32 100644 --- a/poloniex/__init__.py +++ b/poloniex/__init__.py @@ -387,18 +387,25 @@ def returnOpenOrders(self, currencyPair='all'): return self.__call__('returnOpenOrders', { 'currencyPair': str(currencyPair).upper()}) - def returnTradeHistory(self, currencyPair='all', start=False, end=False): + def returnTradeHistory( + self, currencyPair='all', start=False, end=False, limit=10000 + ): """ Returns your trade history for a given market, specified by the - "currencyPair" parameter. You may specify "all" as the currencyPair to - receive your trade history for all markets. You may optionally specify - a range via "start" and/or "end" POST parameters, given in UNIX - timestamp format; if you do not specify a range, it will be limited to - one day. """ + "currencyPair" POST parameter. You may specify "all" as the + currencyPair to receive your trade history for all markets. You may + optionally specify a range via "start" and/or "end" POST parameters, + given in UNIX timestamp format; if you do not specify a range, it will + be limited to one day. You may optionally limit the number of entries + returned using the "limit" parameter, up to a maximum of 10,000. If the + "limit" parameter is not specified, no more than 500 entries will be + returned. """ args = {'currencyPair': str(currencyPair).upper()} if start: args['start'] = start if end: args['end'] = end + if limit: + args['limit'] = limit return self.__call__('returnTradeHistory', args) def returnOrderTrades(self, orderNumber): From 2284ce053f7e7eb9a0a4ae8889b6a9c648b57817 Mon Sep 17 00:00:00 2001 From: Skylar Saveland Date: Sat, 25 Nov 2017 16:30:22 -0800 Subject: [PATCH 3/5] #171, default limit in returnTradeHistory is None --- poloniex/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poloniex/__init__.py b/poloniex/__init__.py index 907d0c32..89063bf3 100644 --- a/poloniex/__init__.py +++ b/poloniex/__init__.py @@ -388,7 +388,7 @@ def returnOpenOrders(self, currencyPair='all'): 'currencyPair': str(currencyPair).upper()}) def returnTradeHistory( - self, currencyPair='all', start=False, end=False, limit=10000 + self, currencyPair='all', start=False, end=False, limit=None ): """ Returns your trade history for a given market, specified by the "currencyPair" POST parameter. You may specify "all" as the From 3e4175be6d25e6c6d667faccd7365c626a34b49a Mon Sep 17 00:00:00 2001 From: s4w3d0ff Date: Mon, 18 Dec 2017 17:06:16 -0800 Subject: [PATCH 4/5] version bump --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c8132cf8..4c52c6b6 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup setup(name='poloniex', - version='0.4.6', + version='0.4.7', description='Poloniex API wrapper for Python 2.7 and 3', url='https://github.com/s4w3d0ff/python-poloniex', author='s4w3d0ff', From 5225076a8a0de6d5027441dde6303b24994224fc Mon Sep 17 00:00:00 2001 From: s4w3d0ff Date: Tue, 19 Dec 2017 11:21:47 -0800 Subject: [PATCH 5/5] change readme versions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a86ef6ab..aa4fe3db 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -[![python](https://img.shields.io/badge/python-2.7%20%26%203-blue.svg)![licence](https://img.shields.io/badge/licence-GPL%20v2-blue.svg)](https://github.com/s4w3d0ff/python-poloniex/blob/master/LICENSE) [![release](https://img.shields.io/github/release/s4w3d0ff/python-poloniex.svg)![release build](https://travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=v0.4.6)](https://github.com/s4w3d0ff/python-poloniex/releases) +[![python](https://img.shields.io/badge/python-2.7%20%26%203-blue.svg)![licence](https://img.shields.io/badge/licence-GPL%20v2-blue.svg)](https://github.com/s4w3d0ff/python-poloniex/blob/master/LICENSE) [![release](https://img.shields.io/github/release/s4w3d0ff/python-poloniex.svg)![release build](https://travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=v0.4.7)](https://github.com/s4w3d0ff/python-poloniex/releases) [![master](https://img.shields.io/badge/branch-master-blue.svg)![master build](https://api.travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=master)](https://github.com/s4w3d0ff/python-poloniex/tree/master) [![dev](https://img.shields.io/badge/branch-dev-blue.svg)![dev build](https://api.travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=dev)](https://github.com/s4w3d0ff/python-poloniex/tree/dev) Inspired by [this](http://pastebin.com/8fBVpjaj) wrapper written by 'oipminer' > I (s4w3d0ff) am not affiliated with, nor paid by [Poloniex](https://poloniex.com). I have been an active trader there since 2014 and love python. I found the linked python wrapper on the poloniex support page to be incomplete and buggy so I decided to write this wrapper and create this git repository. If you wish to contribute to this repository please read [CONTRIBUTING.md](https://github.com/s4w3d0ff/python-poloniex/blob/master/CONTRIBUTING.md). All and any help is appreciated. ## Install latest release: Python 2: ``` -pip install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.6.zip +pip install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip ``` Python 3: ``` -pip3 install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.6.zip +pip3 install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip ``` ## Usage: