Skip to content

Commit

Permalink
Merge pull request #175 from s4w3d0ff/dev
Browse files Browse the repository at this point in the history
0.4.7
  • Loading branch information
s4w3d0ff committed Dec 19, 2017
2 parents ef1d89b + 5225076 commit 1a00f43
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
33 changes: 23 additions & 10 deletions poloniex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -387,18 +393,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=None
):
""" 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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit 1a00f43

Please sign in to comment.