Skip to content

Commit

Permalink
Api 2.0 support (#62)
Browse files Browse the repository at this point in the history
* WIP - api 2.0

* WIP: update all 1.1 methods, and 2.0 methods with 1.1 overlap

* first crack at full 2.0

* update travis to run all tests under CI

* update the readme

* more documentation updates

* add get_candles method
  • Loading branch information
ericsomdahl authored Oct 7, 2017
1 parent 2650404 commit 0373363
Show file tree
Hide file tree
Showing 5 changed files with 724 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ python:
install:
- pip install -r requirements.txt
script:
- python -m unittest bittrex.test.bittrex_tests.TestBittrexPublicAPI
- python -m unittest bittrex.test.bittrex_tests
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python-bittrex
==============

[![Build Status](https://travis-ci.org/ericsomdahl/python-bittrex.svg?branch=travis-setup)](https://travis-ci.org/ericsomdahl/python-bittrex)
[![Build Status](https://travis-ci.org/ericsomdahl/python-bittrex.svg?branch=master)](https://travis-ci.org/ericsomdahl/python-bittrex)

Python bindings for bittrex. I am Not associated -- use at your own risk, etc.

Expand All @@ -10,17 +10,19 @@ Tips are appreciated:
* LTC: LaasG9TRa9p32noN2oKUVVqrDFp4Ja1NK3


Example Usage
Example Usage for Bittrex API
-------------

```python
from bittrex import Bittrex

my_bittrex = Bittrex(None, None)
my_bittrex = Bittrex(None, None, api_version=API_V2_0) # or defaulting to v1.1 as Bittrex(None, None)
my_bittrex.get_markets()
{'success': True, 'message': '', 'result': [{'MarketCurrency': 'LTC', ...
```

API_V2_0 and API_V1_1 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 `Settings` then `API Keys` page.
Make sure you save the secret, as it will not be visible
Expand All @@ -29,7 +31,7 @@ after navigating away from the page.
```python
from bittrex import Bittrex

my_bittrex = Bittrex("<my_api_key>", "<my_api_secret>")
my_bittrex = Bittrex("<my_api_key>", "<my_api_secret>", api_version="<API_V1_1> or <API_V2_0>")

my_bittrex.get_balance('ETH')
{'success': True,
Expand All @@ -39,6 +41,39 @@ my_bittrex.get_balance('ETH')
}
```

v1.1 constants of interest:
---
```
BUY_ORDERBOOK = 'buy'
SELL_ORDERBOOK = 'sell'
BOTH_ORDERBOOK = 'both'
```

v2.0 constants of interest
---
These are used by get_candles()
```
TICKINTERVAL_ONEMIN = 'oneMin'
TICKINTERVAL_FIVEMIN = 'fiveMin'
TICKINTERVAL_HOUR = 'hour'
TICKINTERVAL_THIRTYMIN = 'thirtyMin'
TICKINTERVAL_DAY = 'Day'
```
these are used by trade_sell() and trade_buy()
```
ORDERTYPE_LIMIT = 'LIMIT'
ORDERTYPE_MARKET = 'MARKET'

TIMEINEFFECT_GOOD_TIL_CANCELLED = 'GOOD_TIL_CANCELLED'
TIMEINEFFECT_IMMEDIATE_OR_CANCEL = 'IMMEDIATE_OR_CANCEL'
TIMEINEFFECT_FILL_OR_KILL = 'FILL_OR_KILL'

CONDITIONTYPE_NONE = 'NONE'
CONDITIONTYPE_GREATER_THAN = 'GREATER_THAN'
CONDITIONTYPE_LESS_THAN = 'LESS_THAN'
CONDITIONTYPE_STOP_LOSS_FIXED = 'STOP_LOSS_FIXED'
CONDITIONTYPE_STOP_LOSS_PERCENTAGE = 'STOP_LOSS_PERCENTAGE'
```

Testing
-------
Expand Down
Loading

0 comments on commit 0373363

Please sign in to comment.