Code Monkey home page Code Monkey logo

pyexchange's Introduction

pyexchange - Consistent API wrapper for cryptocurrency exchanges.

Requirements

Installation

$ pip install -e git+https://github.com/coderiot/pyexchange.git#egg=pyexchange

Supported exchanges

Exchange Name Public Api Private Api
Bitcurex Yes No
Bitfinex Yes No
Bitstamp Yes No
BTCChina Yes No
BTC-e Yes No
CampBX Yes No
Crypto-Trade Yes Yes (not tested)
Cryptsy Yes Yes (not tested)
Intersango (removed) Yes No
Justcoin Yes No
localbitcions Yes No
mtgox (removed) Yes No
The Rock Trading Yes No
Bter Yes Yes (without tests)
Coins-e Yes Yes (not tested)
Vircurex Yes No
CoinEx Yes No

runnning tests

tested with python2.7 and python3

python -m pyexchange.tests -v

Usage

list supported exchanges

>>> import pyexchange
>>> pyexchange.exchanges()

example Result:

['bitcurex',
 'bitfinex',
 'bitstamp',
 'btcchina',
 'btce',
 'campbx',
 'cryptotrade',
 'cryptsy',
 'intersango',
 'justcoin',
 'localbitcoins',
 'mtgox',
 'rocktrading']

create exchange by name with default market

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')

create exchange by name and market

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox', 'btc_eur')

find available markets

>>> import pyexchange
>>> pyexchange.find_market('btc_usd')

list markets by exchange

>>> import pyexchange
>>> ex = pyexchange.new_exchange('bitfinex')
>>> ex.markets()

or

>>> pyexchange.exchange.bitfinex.markets()

Result:

['ltc_btc', 'ltc_usd', 'btc_usd']

set market for exchange

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> ex.market = 'btc_eur' # set market
>>> print ex.market # current market

get exchange ticker

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> print ex.ticker()

Result:

Ticker(avg=Decimal('157.19387'), high=Decimal('163.0'), low=Decimal('151.13324'), last=Decimal('160.0'), buy=Decimal('160.00001'), sell=Decimal('160.16'), vol=Decimal('22805.9081')

get exchange orderbook

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> asks, bids = ex.depth()
>>> print asks

Result:

[Order(price=Decimal('160.22457'), amount=Decimal('0.01')),
 Order(price=Decimal('160.22458'), amount=Decimal('0.12521962')),
 Order(price=Decimal('160.29347'), amount=Decimal('1')),
 Order(price=Decimal('160.36999'), amount=Decimal('2.56417803')),
 Order(price=Decimal('160.37'), amount=Decimal('7.98')),],
 ...
]

get exchange trades

>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> trades = ex.trades()
>>> print trades

Result:

[Order(price=Decimal('160.22457'), amount=Decimal('0.01')),
 Order(price=Decimal('160.22458'), amount=Decimal('0.12521962')),
 Order(price=Decimal('160.29347'), amount=Decimal('1')),
 Order(price=Decimal('160.36999'), amount=Decimal('2.56417803')),
 Order(price=Decimal('160.37'), amount=Decimal('7.98')),
 ...
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.