Skip to content

Commit 1a00f43

Browse files
authored
Merge pull request #175 from s4w3d0ff/dev
0.4.7
2 parents ef1d89b + 5225076 commit 1a00f43

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
[![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)
1+
[![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)
22
[![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)
33
Inspired by [this](http://pastebin.com/8fBVpjaj) wrapper written by 'oipminer'
44
> 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.
55
## Install latest release:
66
Python 2:
77
```
8-
pip install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.6.zip
8+
pip install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip
99
```
1010

1111
Python 3:
1212
```
13-
pip3 install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.6.zip
13+
pip3 install https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip
1414
```
1515

1616
## Usage:

poloniex/__init__.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Poloniex(object):
108108

109109
def __init__(
110110
self, key=False, secret=False,
111-
timeout=None, coach=True, jsonNums=False):
111+
timeout=None, coach=True, jsonNums=False, proxies=None):
112112
"""
113113
key = str api key supplied by Poloniex
114114
secret = str secret hash supplied by Poloniex
@@ -120,9 +120,10 @@ def __init__(
120120
# Time Placeholders: (MONTH == 30*DAYS)
121121
self.MINUTE, self.HOUR, self.DAY, self.WEEK, self.MONTH, self.YEAR
122122
"""
123-
# set logger and coach
123+
# set logger, coach, and proxies
124124
self.logger = logger
125125
self.coach = coach
126+
self.proxies = proxies
126127
if self.coach is True:
127128
self.coach = Coach()
128129
# create nonce
@@ -201,7 +202,10 @@ def __call__(self, command, args={}):
201202
# add headers to payload
202203
payload['headers'] = {'Sign': sign.hexdigest(),
203204
'Key': self.key}
204-
205+
# add proxies if needed
206+
if self.proxies:
207+
payload['proxies'] = self.proxies
208+
205209
# send the call
206210
ret = _post(**payload)
207211

@@ -216,7 +220,9 @@ def __call__(self, command, args={}):
216220
# wait for coach
217221
if self.coach:
218222
self.coach.wait()
219-
223+
# add proxies if needed
224+
if self.proxies:
225+
payload['proxies'] = self.proxies
220226
# send the call
221227
ret = _get(**payload)
222228

@@ -387,18 +393,25 @@ def returnOpenOrders(self, currencyPair='all'):
387393
return self.__call__('returnOpenOrders', {
388394
'currencyPair': str(currencyPair).upper()})
389395

390-
def returnTradeHistory(self, currencyPair='all', start=False, end=False):
396+
def returnTradeHistory(
397+
self, currencyPair='all', start=False, end=False, limit=None
398+
):
391399
""" Returns your trade history for a given market, specified by the
392-
"currencyPair" parameter. You may specify "all" as the currencyPair to
393-
receive your trade history for all markets. You may optionally specify
394-
a range via "start" and/or "end" POST parameters, given in UNIX
395-
timestamp format; if you do not specify a range, it will be limited to
396-
one day. """
400+
"currencyPair" POST parameter. You may specify "all" as the
401+
currencyPair to receive your trade history for all markets. You may
402+
optionally specify a range via "start" and/or "end" POST parameters,
403+
given in UNIX timestamp format; if you do not specify a range, it will
404+
be limited to one day. You may optionally limit the number of entries
405+
returned using the "limit" parameter, up to a maximum of 10,000. If the
406+
"limit" parameter is not specified, no more than 500 entries will be
407+
returned. """
397408
args = {'currencyPair': str(currencyPair).upper()}
398409
if start:
399410
args['start'] = start
400411
if end:
401412
args['end'] = end
413+
if limit:
414+
args['limit'] = limit
402415
return self.__call__('returnTradeHistory', args)
403416

404417
def returnOrderTrades(self, orderNumber):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup
22
setup(name='poloniex',
3-
version='0.4.6',
3+
version='0.4.7',
44
description='Poloniex API wrapper for Python 2.7 and 3',
55
url='https://github.com/s4w3d0ff/python-poloniex',
66
author='s4w3d0ff',

0 commit comments

Comments
 (0)