Merge branch 'develop' into timeperiod
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
""" FreqTrade bot """
|
||||
__version__ = '0.14.3'
|
||||
__version__ = '0.15.1'
|
||||
|
||||
|
||||
class DependencyException(BaseException):
|
||||
|
@@ -123,10 +123,8 @@ class Bittrex(Exchange):
|
||||
message=data['message'],
|
||||
pair=pair))
|
||||
|
||||
if not data.get('result') \
|
||||
or not data['result'].get('Bid') \
|
||||
or not data['result'].get('Ask') \
|
||||
or not data['result'].get('Last'):
|
||||
if not data.get('result') or\
|
||||
not all(key in data.get('result', {}) for key in ['Bid', 'Ask', 'Last']):
|
||||
raise ContentDecodingError('{message} params=({pair})'.format(
|
||||
message='Got invalid response from bittrex',
|
||||
pair=pair))
|
||||
|
@@ -15,6 +15,11 @@ from freqtrade import __version__
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def file_dump_json(filename, data):
|
||||
with open(filename, 'w') as fp:
|
||||
json.dump(data, fp)
|
||||
|
||||
|
||||
class State(enum.Enum):
|
||||
RUNNING = 0
|
||||
STOPPED = 1
|
||||
|
@@ -212,7 +212,18 @@ def test_exchange_bittrex_get_ticker_bad():
|
||||
wb = make_wrap_bittrex()
|
||||
fb = FakeBittrex()
|
||||
fb.result = {'success': True,
|
||||
'result': {'Bid': 1}} # incomplete result
|
||||
'result': {'Bid': 1, 'Ask': 0}} # incomplete result
|
||||
|
||||
with pytest.raises(ContentDecodingError, match=r'.*Got invalid response from bittrex params.*'):
|
||||
wb.get_ticker('BTC_ETH')
|
||||
fb.result = {'success': False,
|
||||
'message': 'gone bad'
|
||||
}
|
||||
with pytest.raises(btx.OperationalException, match=r'.*gone bad.*'):
|
||||
wb.get_ticker('BTC_ETH')
|
||||
|
||||
fb.result = {'success': True,
|
||||
'result': {}} # incomplete result
|
||||
with pytest.raises(ContentDecodingError, match=r'.*Got invalid response from bittrex params.*'):
|
||||
wb.get_ticker('BTC_ETH')
|
||||
fb.result = {'success': False,
|
||||
|
@@ -1,29 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""This script generate json data from bittrex"""
|
||||
import sys
|
||||
import json
|
||||
from os import path
|
||||
|
||||
from freqtrade import exchange
|
||||
from freqtrade.exchange import Bittrex
|
||||
from freqtrade import misc
|
||||
|
||||
PAIRS = [
|
||||
'BTC_BCC', 'BTC_ETH', 'BTC_MER', 'BTC_POWR', 'BTC_ETC',
|
||||
'BTC_OK', 'BTC_NEO', 'BTC_EMC2', 'BTC_DASH', 'BTC_LSK',
|
||||
'BTC_LTC', 'BTC_XZC', 'BTC_OMG', 'BTC_STRAT', 'BTC_XRP',
|
||||
'BTC_QTUM', 'BTC_WAVES', 'BTC_VTC', 'BTC_XLM', 'BTC_MCO'
|
||||
]
|
||||
TICKER_INTERVAL = 5 # ticker interval in minutes (currently implemented: 1 and 5)
|
||||
OUTPUT_DIR = path.dirname(path.realpath(__file__))
|
||||
parser = misc.common_args_parser('download utility')
|
||||
parser.add_argument(
|
||||
'-p', '--pair',
|
||||
help='JSON file containing pairs to download',
|
||||
dest='pair',
|
||||
default=None
|
||||
)
|
||||
args = parser.parse_args(sys.argv[1:])
|
||||
|
||||
TICKER_INTERVALS = [1, 5] # ticker interval in minutes (currently implemented: 1 and 5)
|
||||
PAIRS = []
|
||||
|
||||
if args.pair:
|
||||
with open(args.pair) as file:
|
||||
PAIRS = json.load(file)
|
||||
PAIRS = list(set(PAIRS))
|
||||
|
||||
print('About to download pairs:', PAIRS)
|
||||
|
||||
# Init Bittrex exchange
|
||||
exchange._API = Bittrex({'key': '', 'secret': ''})
|
||||
|
||||
for pair in PAIRS:
|
||||
data = exchange.get_ticker_history(pair, TICKER_INTERVAL)
|
||||
filename = path.join(OUTPUT_DIR, '{}-{}.json'.format(
|
||||
pair,
|
||||
TICKER_INTERVAL,
|
||||
))
|
||||
with open(filename, 'w') as fp:
|
||||
json.dump(data, fp)
|
||||
for tick_interval in TICKER_INTERVALS:
|
||||
print('downloading pair %s, interval %s' % (pair, tick_interval))
|
||||
data = exchange.get_ticker_history(pair, tick_interval)
|
||||
filename = '{}-{}.json'.format(pair, tick_interval)
|
||||
misc.file_dump_json(filename, data)
|
||||
|
23
freqtrade/tests/testdata/pairs.json
vendored
Normal file
23
freqtrade/tests/testdata/pairs.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
"BTC_ADA",
|
||||
"BTC_BAT",
|
||||
"BTC_DASH",
|
||||
"BTC_ETC",
|
||||
"BTC_ETH",
|
||||
"BTC_GBYTE",
|
||||
"BTC_LSK",
|
||||
"BTC_LTC",
|
||||
"BTC_NEO",
|
||||
"BTC_NXT",
|
||||
"BTC_POWR",
|
||||
"BTC_STORJ",
|
||||
"BTC_QTUM",
|
||||
"BTC_WAVES",
|
||||
"BTC_VTC",
|
||||
"BTC_XLM",
|
||||
"BTC_XMR",
|
||||
"BTC_XVG",
|
||||
"BTC_XRP",
|
||||
"BTC_ZEC"
|
||||
]
|
||||
|
Reference in New Issue
Block a user