Python bindings for bittrex
Python bindings for bittrex. I am Not associated -- use at your own risk, etc.
pip install python-bittrex
pip install git+https://github.com/ericsomdahl/python-bittrex.git
API 1.1 is considered stable
API 2.0 is BETA, use at your own risk
Unofficial 2.0 API Documentation - The golang guys have been diligently following the rapid changes to the 2.0 Beta, but use at your own risk.
from bittrex.bittrex import Bittrex, API_V2_0my_bittrex = Bittrex(None, None, api_version=API_V2_0) # or defaulting to v1.1 as Bittrex(None, None) my_bittrex.get_markets()
This call to get_markets returns an object such as the following:
{'success': True, 'message': '', 'result': [{'MarketCurrency': 'LTC', ...
APIV20 and APIV11 are constants that can be imported from Bittrex.
To access account methods, an API key for your account is required and can be generated on the
Settingsthen
API Keyspage. Make sure you save the secret, as it will not be visible after navigating away from the page.
from bittrex.bittrex import *my_bittrex = Bittrex("", "", api_version=" or ")
my_bittrex.get_balance('ETH')
This call to get_balance returns an object such as the following:
{'success': True, 'message': '', 'result': {'Currency': 'ETH', 'Balance': 0.0, 'Available': 0.0, 'Pending': 0.0, 'CryptoAddress': None} }
BUY_ORDERBOOK = 'buy' SELL_ORDERBOOK = 'sell' BOTH_ORDERBOOK = 'both'
These are used by getcandles() ``` TICKINTERVALONEMIN = 'oneMin' TICKINTERVALFIVEMIN = 'fiveMin' TICKINTERVALHOUR = 'hour' TICKINTERVALTHIRTYMIN = 'thirtyMin' TICKINTERVALDAY = 'Day'
these are used by trade_sell() and trade_buy()ORDERTYPELIMIT = 'LIMIT' ORDERTYPEMARKET = 'MARKET'
TIMEINEFFECTGOODTILCANCELLED = 'GOODTILCANCELLED' TIMEINEFFECTIMMEDIATEORCANCEL = 'IMMEDIATEORCANCEL' TIMEINEFFECTFILLORKILL = 'FILLOR_KILL'
CONDITIONTYPENONE = 'NONE' CONDITIONTYPEGREATERTHAN = 'GREATERTHAN' CONDITIONTYPELESSTHAN = 'LESSTHAN' CONDITIONTYPESTOPLOSSFIXED = 'STOPLOSSFIXED' CONDITIONTYPESTOPLOSSPERCENTAGE = 'STOPLOSS_PERCENTAGE' ```
In order to run the integration tests, a file called "secrets.json" must be added to the test folder. Structure it as follows, adding your API keys:
{ "key": "mykey", "secret": "mysecret" }