A Python wrapper for Mercado Bitcoin API.
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
Below you can see the available Mercado Bitcoin API methods you can use:
import mercadobitcoin
mbtc = mercadobitcoin.Api()
mbtc.ticker('BTC')
mbtc.orderbook('BTC')
mbtc.trades('BTC')
*note that this has been updated per v3: functions with litecoin in the name have been removed.
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(coin_pair="BRL", quantity="42", destiny="1", description="Trasfering Money.")
Install development dependencies:
brew install libyaml
pip install -r requirements-development.txt
Run tests:
tox