Skip to content

alfakini/python-mercadobitcoin

Repository files navigation

mercadobitcoin

Join the chat at https://gitter.im/python-mercadobitcoin/Lobby Build Status PyPI

DESPITE THIS PROJECT STILL BEING MAINTAINED, WE HIGHLY RECOMMEND THE CCXT LIBRARY.

A Python wrapper for Mercado Bitcoin API. Currently supports: BTC, LTC, BCH, XRP and ETH.

Installation

Directly from PyPI:

pip install mercadobitcoin

You can also install directly from the GitHub repository to have the newest features by running:

git clone https://github.com/alfakini/python-mercadobitcoin.git
cd python-mercadobitcoin
python setup.py install

Basic Usage

Below you can see the available Mercado Bitcoin API methods you can use:

import mercadobitcoin
mbtc = mercadobitcoin.Api()
mbtc.ticker()
mbtc.orderbook()
mbtc.trades()
mbtc.ticker_litecoin()
mbtc.orderbook_litecoin()
mbtc.trades_litecoin()

And the private Trade API:

from mercadobitcoin import TradeApi

mbtc = TradeApi(<API_ID>, <API_SECRET>)

mbtc.list_system_messages()
mbtc.get_account_info()
mbtc.get_order(coin_pair="BRLBTC", order_id=1)
mbtc.list_orders(coin_pair="BRLBTC")
mbtc.list_orderbook(coin_pair="BRLBTC")
mbtc.place_buy_order(coin_pair="BRLBTC", quantity="42.00", limit_price="5000")
mbtc.place_sell_order(coin_pair="BRLBTC", quantity="42.00", limit_price="5000")
mbtc.cancel_order(coin_pair="BRLBTC", order_id=1)
mbtc.get_withdrawal(coin="BRL", withdrawal_id=1)
mbtc.withdraw_coin_brl(coin="BRL", quantity="42", account_ref="1", description="Trasfering Money.")
mbtc.withdraw_coin_xrp(coin="XRP", quantity="42", address="[address_dest]", tx_fee="[tx_fee_amount]", destination_tag="[tag_dest]", description="Trasfering XRP.")
mbtc.withdraw_coin(coin="BTC", quantity="42", address="[address_dest]", tx_fee="[tx_fee_amount]", description="Trasfering Crypto.")

Development

Install development dependencies:

brew install libyaml
pip install -r requirements-development.txt

Run tests:

tox

References