Skip to content

Commit 0373363

Browse files
authored
Api 2.0 support (#62)
* 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
1 parent 2650404 commit 0373363

File tree

5 files changed

+724
-123
lines changed

5 files changed

+724
-123
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ python:
55
install:
66
- pip install -r requirements.txt
77
script:
8-
- python -m unittest bittrex.test.bittrex_tests.TestBittrexPublicAPI
8+
- python -m unittest bittrex.test.bittrex_tests

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
python-bittrex
22
==============
33

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

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

@@ -10,17 +10,19 @@ Tips are appreciated:
1010
* LTC: LaasG9TRa9p32noN2oKUVVqrDFp4Ja1NK3
1111

1212

13-
Example Usage
13+
Example Usage for Bittrex API
1414
-------------
1515

1616
```python
1717
from bittrex import Bittrex
1818

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

24+
API_V2_0 and API_V1_1 are constants that can be imported from Bittrex.
25+
2426
To access account methods, an API key for your account is required and can be
2527
generated on the `Settings` then `API Keys` page.
2628
Make sure you save the secret, as it will not be visible
@@ -29,7 +31,7 @@ after navigating away from the page.
2931
```python
3032
from bittrex import Bittrex
3133

32-
my_bittrex = Bittrex("<my_api_key>", "<my_api_secret>")
34+
my_bittrex = Bittrex("<my_api_key>", "<my_api_secret>", api_version="<API_V1_1> or <API_V2_0>")
3335

3436
my_bittrex.get_balance('ETH')
3537
{'success': True,
@@ -39,6 +41,39 @@ my_bittrex.get_balance('ETH')
3941
}
4042
```
4143

44+
v1.1 constants of interest:
45+
---
46+
```
47+
BUY_ORDERBOOK = 'buy'
48+
SELL_ORDERBOOK = 'sell'
49+
BOTH_ORDERBOOK = 'both'
50+
```
51+
52+
v2.0 constants of interest
53+
---
54+
These are used by get_candles()
55+
```
56+
TICKINTERVAL_ONEMIN = 'oneMin'
57+
TICKINTERVAL_FIVEMIN = 'fiveMin'
58+
TICKINTERVAL_HOUR = 'hour'
59+
TICKINTERVAL_THIRTYMIN = 'thirtyMin'
60+
TICKINTERVAL_DAY = 'Day'
61+
```
62+
these are used by trade_sell() and trade_buy()
63+
```
64+
ORDERTYPE_LIMIT = 'LIMIT'
65+
ORDERTYPE_MARKET = 'MARKET'
66+
67+
TIMEINEFFECT_GOOD_TIL_CANCELLED = 'GOOD_TIL_CANCELLED'
68+
TIMEINEFFECT_IMMEDIATE_OR_CANCEL = 'IMMEDIATE_OR_CANCEL'
69+
TIMEINEFFECT_FILL_OR_KILL = 'FILL_OR_KILL'
70+
71+
CONDITIONTYPE_NONE = 'NONE'
72+
CONDITIONTYPE_GREATER_THAN = 'GREATER_THAN'
73+
CONDITIONTYPE_LESS_THAN = 'LESS_THAN'
74+
CONDITIONTYPE_STOP_LOSS_FIXED = 'STOP_LOSS_FIXED'
75+
CONDITIONTYPE_STOP_LOSS_PERCENTAGE = 'STOP_LOSS_PERCENTAGE'
76+
```
4277

4378
Testing
4479
-------

0 commit comments

Comments
 (0)