Currently cexiopy supports the following currencies:
'BTC' 'GHS' 'LTC' 'NMC'
You may want to avoid the hassle with hardcoded strings, mostly because of their error-prone nature, and use the following helper class instead:
>>> from cexio.helpers import Currency
>>> Currency.bitcoin # 'BTC'
>>> Currency.gigahash # 'GHS'
>>> Currency.litecoin # 'LTC'
>>> Currency.namecoin # 'NMC'
Note
This type of fucntions does not require authentication (HTTP GET method).
- def order_book(pair):
Gets the ‘bids’ and ‘asks’ for the currrencies pair
Parameters:
- pair is a list containing two currencies
Returns a Python dictionary of recent ‘bids’ and ‘asks’ for the given currencies along with the timestamp:
- ask a list containing the asked sell price and the amount
- bid a list containing the asked buy price and the amount
- timestamp UNIX timestamp
>>> cexio.order_book(['BTC', 'NMC'])
- def ticker(pair):
Gets the ‘ticker’ values for the past 24 hours
Parameters:
- pair is a list containing two currencies
Returns a Python dictionary of ‘ticker’ values for the past 24 hours:
- ask value
- bid value
- high value
- last value
- low value
- timestamp value
- volume value
>>> cexio.ticker(['BTC', 'GHS'])
- def trade_history(pair):
Gets the recent trade history for the currrencies pair
Parameters:
- pair is a list containing two currencies
Returns a Python list of recent trades, where each trade is a Python dictionary:
>>> cexio.trade_history(['BTC', 'NMC'])
Attention
cexiopy still does not support the optional since parameter (TBA).
Note
This type of fucntions requires authentication.
- def login(username, api_key, api_secret):
Performs a ‘lazy’ login
Parameters:
- username (required) your CEX.IO username
- api_key (required) your CEX.IO API key
- api_secret (required) your CEX.IO API secret
Returns None
Attention
The login function is required once – before the execution of any private function.
- def open_orders(pair)
Gets current orders
Parameters:
- pair (required) the currencies pair
Returns an empty Python list if no orders, otherwise a Python list where each element contains the following information:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> from cexio.helpers import Currency
>>> pair = [Currency.gigahash, Currency.namecoin]
>>> cexio.open_orders(pair)
- def cancel_order(id=order_id)
Cancel the given order
Parameters:
- id (required, named argument) the order id
Returns True upon success, otherwise a Python dictionary with the CEX.IO error
>>> pair = [Currency.gigahash, Currency.namecoin]
>>> cexio.open_orders(id=1235813)
True
- def buy_gigahash_with_bitcoin(amount, price):
Buy Gigahashes with Bitcoins
Parameters:
- amount (required) the amount of asked Gigahashes
- price (required) the price per Gigahash in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.buy_gigahash_with_bitcoin(amount=1, price=0.001) # highly unlikly
- def sell_gigahash_for_bitcoin(amount, price):
Sell Gigahashes for Bitcoins
Parameters:
- amount (required) the amount of asked Bitcoins
- price (required) the price per Gigahash in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.sell_gigahash_with_bitcoin(amount=1, price=100) # highly unlikly
- def buy_gigahash_with_namecoin(amount, price):
Buy Gigahashes with Namecoins
Parameters:
- amount (required) the amount of asked Gigahashes
- price (required) the price per Gigahash in Namecoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.buy_gigahash_with_namecoin(amount=1, price=0.001) # highly unlikly
- def sell_gigahash_for_namecoin(amount, price):
Sell Gigahashes for Namecoins
Parameters:
- amount (required) the amount of asked Namecoins
- price (required) the price per Gigahash in Namecoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.sell_gigahash_for_namecoin(amount=1, price=100) # highly unlikly
- def buy_litecoin_with_bitcoin(amount, price):
Buys Litecoins with Bitcoins
Parameters:
- amount (required) the amount of asked Namecoins
- price (required) the price per Namecoin in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.buy_litecoin_with_bitcoin(amount=1, price=0.001) # highly unlikly
- def sell_litecoin_for_bitcoin(amount, price)
Sells Litecoins for Bitcoins
Parameters:
- amount (required) the amount of asked Bitcoins
- price (required) the price per Namecoin in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.sell_litecoin_for_bitcoin(amount=1, price=100) # highly unlikly
- def buy_namecoin_with_bitcoin(amount, price):
Buys Namecoins with Bitcoins
Parameters:
- amount (required) the amount of asked Namecoins
- price (required) the price per Namecoin in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.buy_namecoin_with_bitcoin(amount=1, price=0.001) # highly unlikly
- def sell_namecoin_for_bitcoin(amount, price)
Sells Namecoins for Bitcoins
Parameters:
- amount (required) the amount of asked Bitcoins
- price (required) the price per Namecoin in Bitcoins
Returns a Python dictionary with the order details:
- amount the asked amount
- id the order ID
- pending the pending amount (if partially executed)
- price the asked price
- time UNIX timestamp
- type the order type, could be either ‘buy’ or ‘sell’
>>> cexio.sell_namecoin_for_bitcoin(amount=1, price=100) # highly unlikly