All Projects → s4w3d0ff → Python Poloniex

s4w3d0ff / Python Poloniex

Licence: gpl-2.0
Poloniex API wrapper for Python 2.7 & 3

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Python Poloniex

Coinbase Pro Node
Coinbase Pro API written in TypeScript and covered by tests.
Stars: ✭ 116 (-79.17%)
Mutual labels:  api, bitcoin, cryptocurrency, trading-api, trading, exchange
Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-84.02%)
Mutual labels:  api, bitcoin, cryptocurrency, trading, exchange
Ccxt
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
Stars: ✭ 22,501 (+3939.68%)
Mutual labels:  api, bitcoin, cryptocurrency, trading, exchange
Uniswap Python
🦄 The unofficial Python client for the Uniswap exchange.
Stars: ✭ 191 (-65.71%)
Mutual labels:  api, wrapper, trading-api, trading, exchange
Poloniex
Poloniex python API client for humans
Stars: ✭ 71 (-87.25%)
Mutual labels:  api-wrapper, cryptocurrency, trading-api, poloniex, trading
Ccxt Rest
Open Source Unified REST API of 100+ Crypto Exchange Sites (18k+ docker pulls) - https://ccxt-rest.io/
Stars: ✭ 210 (-62.3%)
Mutual labels:  api, bitcoin, cryptocurrency, trading, exchange
Kupi Terminal
Ccxt based, open source, customized, extendable trading platform that supports 130+ crypto exchanges.
Stars: ✭ 104 (-81.33%)
Mutual labels:  bitcoin, cryptocurrency, trading-api, trading, exchange
Exchangesharp
ExchangeSharp is a powerful, fast and easy to use .NET/C# API for interfacing with many crypto currency exchanges. REST and web sockets are supported.
Stars: ✭ 489 (-12.21%)
Mutual labels:  api, bitcoin, cryptocurrency, poloniex, exchange
Coinnect
Coinnect is a Rust library aiming to provide a complete access to main crypto currencies exchanges via REST API.
Stars: ✭ 130 (-76.66%)
Mutual labels:  bitcoin, cryptocurrency, poloniex, trading, exchange
Stocklook
crypto currency library for trading & market making bots, account management, and data analysis
Stars: ✭ 119 (-78.64%)
Mutual labels:  wrapper, bitcoin, cryptocurrency, poloniex, trading
Pycoingecko
Python wrapper for the CoinGecko API
Stars: ✭ 270 (-51.53%)
Mutual labels:  api, wrapper, api-wrapper, cryptocurrency
Bittrex.net
A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable
Stars: ✭ 131 (-76.48%)
Mutual labels:  api, api-wrapper, cryptocurrency, exchange
Cryptocurrency Portfolio
Google Sheets automatic creation with Google Apps Script (GAS) for managing a cryptocurrency tracking spreadsheet with multi exchanges
Stars: ✭ 134 (-75.94%)
Mutual labels:  api, cryptocurrency, poloniex, exchange
Tribeca
A high frequency, market making cryptocurrency trading platform in node.js
Stars: ✭ 3,646 (+554.58%)
Mutual labels:  bitcoin, cryptocurrency, trading, exchange
Currencyviewer
Short python framework that dynamically displays and converts the cryptocurrencies in your Kraken wallet into equivalents fiat money.
Stars: ✭ 13 (-97.67%)
Mutual labels:  api, bitcoin, cryptocurrency, exchange
Crypto Exchanges Gateway
Your gateway to the world of crypto !
Stars: ✭ 343 (-38.42%)
Mutual labels:  api, cryptocurrency, poloniex, trading
Wolfbot
Crypto currency trading bot written in TypeScript for NodeJS
Stars: ✭ 335 (-39.86%)
Mutual labels:  bitcoin, cryptocurrency, trading, exchange
Coinapi Sdk
SDKs for CoinAPI
Stars: ✭ 238 (-57.27%)
Mutual labels:  api, bitcoin, trading-api, exchange
Algo Coin
Python library for algorithmic trading cryptocurrencies across multiple exchanges
Stars: ✭ 365 (-34.47%)
Mutual labels:  bitcoin, cryptocurrency, poloniex, exchange
Coinbasepro Python
The unofficial Python client for the Coinbase Pro API
Stars: ✭ 1,386 (+148.83%)
Mutual labels:  wrapper, bitcoin, trading, exchange

pythonlicence releaserelease build
mastermaster build devdev build

Inspired by this wrapper written by 'oipminer'

I (s4w3d0ff) am not affiliated with, nor paid by Poloniex. If you wish to contribute to the repository please read CONTRIBUTING.md. All and any help is appreciated.

Features:

  • [x] Python 2.7 and 3+
  • [x] Pypi
  • [x] Travis
  • [x] Websocket api support
  • [x] Minimal amount of dependencies
  • [x] Internal checks to reduce external api errors
  • [x] Rate limiter to keep from going over call limits
  • [x] Retries failed api calls during connection issues

Install:

pip install --upgrade poloniexapi

Usage:

See the wiki or help(poloniex) for more.

All api calls are done through an instance of poloniex.Poloniex. You can use the instance as follows:

# import this package
from poloniex import Poloniex

# make an instance of poloniex.Poloniex
polo = Poloniex()

# show the ticker
print(polo('returnTicker'))

Using the instances __call__ method (shown above) you can pass the command string as the first argument to make an api call. The poloniex.Poloniex class also has 'helper' methods for each command that will help 'sanitize' the commands arguments. For example, Poloniex.returnChartData('USDT_BTC', period=777) will raise PoloniexError("777 invalid candle period").

# using a 'helper' method
print(polo.returnChartData(currencyPair='BTC_LTC', period=900))
# bypassing 'helper'
print(polo(command='returnChartData', args={'currencyPair': 'BTC_LTC',
                                            'period': 900}))

Almost every api command can be called this way. This wrapper also checks that the command you pass to the command arg is a valid command to send to poloniex, this helps reduce api errors due to typos.

Private Commands:

To use the private api commands you first need an api key and secret (supplied by poloniex). When creating the instance of poloniex.Poloniex you can pass your api key and secret to the object like so:

import poloniex
polo = poloniex.Poloniex(key='your-Api-Key-Here-xxxx', secret='yourSecretKeyHere123456789')

# or this works
polo.key = 'your-Api-Key-Here-xxxx'
polo.secret = 'yourSecretKeyHere123456789'

# get your balances
balance = polo.returnBalances()
print("I have %s ETH!" % balance['ETH'])

# or use '__call__'
balance = polo('returnBalances')
print("I have %s BTC!" % balance['BTC'])

Trade History:

Poloniex has two api commands with the same name returnTradeHistory. To work around this without splitting up the commands or having to specify 'public' or 'private' we use the helper method Poloniex.marketTradeHist for public trade history and Poloniex.returnTradeHistory for private trades. If you try to bypass the helper method using Poloniex.__call__, it will call the private command.

Public trade history:

print(polo.marketTradeHist('BTC_ETH'))

Private trade history:

print(polo.returnTradeHistory('BTC_ETH'))

You can also not use the 'helper' methods at all and use poloniex.PoloniexBase which only has returnMarketHist and __call__ to make rest api calls.

Websocket Usage:

To connect to the websocket api use the PoloniexSocketed class like so:

import poloniex
import logging
from time import sleep

# helps show what is going on
logging.basicConfig()
poloniex.logger.setLevel(logging.DEBUG)

def on_volume(data):
    print(data)
# make instance
sock = poloniex.PoloniexSocketed()
# start the websocket thread and subscribe to '24hvolume' setting the callback to 'on_volume'
sock.startws(subscribe={'24hvolume': on_volume})
# give the socket some time to init
sleep(5)
# use the channel name str or id int to subscribe/unsubscribe
sock.subscribe(chan='ticker', callback=print)
sleep(1)
# unsub from ticker using id (str name can be use as well)
sock.unsubscribe(1002)
sleep(4)
# stop websocket
sock.stopws()

INFO:poloniex:Websocket thread started
DEBUG:poloniex:Subscribed to 24hvolume
[1010]
DEBUG:poloniex:Subscribed to ticker
[241, '86.59997298', '86.68262835', '85.69590501', '0.01882321', '22205.56419338', '258.30264061', 0, '87.31843098', '82.81638725']
...
...
[254, '5.89427014', '6.14542299', '5.92000026', '-0.03420118', '9978.11197201', '1649.83975863', 0, '6.19642428', '5.74631502']
DEBUG:poloniex:Unsubscribed to ticker
[1010]
[1010]
[1010]
['2019-06-07 04:16', 2331, {'BTC': '2182.115', 'ETH': '490.635', 'XMR': '368.983', 'USDT': '7751402.061', 'USDC': '5273463.730'}]
DEBUG:poloniex:Websocket Closed
INFO:poloniex:Websocket thread stopped/joined

You can also subscribe and start the websocket thread when creating an instance of PoloniexSocketed by using the subscribe and start args:

sock = poloniex.PoloniexSocketed(subscribe={'24hvolume': print}, start=True)

More examples of how to use websocket push API can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].