Skip to content

Consistent API wrapper for cryptocurrency exchanges.

License

Notifications You must be signed in to change notification settings

bobofzhang/pyexchange

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyexchange - Consistent API wrapper for cryptocurrency exchanges.

Requirements

Installation

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

Supported exchanges

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')),
 ...
]

About

Consistent API wrapper for cryptocurrency exchanges.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published