mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
fetching new testing data for oneMin and fiveMin intervals
This commit is contained in:
parent
fb7ea169d4
commit
3475a07522
|
@ -0,0 +1,21 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
|
||||
def load_backtesting_data(ticker_interval: int = 5):
|
||||
path = os.path.abspath(os.path.dirname(__file__))
|
||||
result = {}
|
||||
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'
|
||||
]
|
||||
for pair in pairs:
|
||||
with open('{abspath}/testdata/{pair}-{ticker_interval}.json'.format(
|
||||
abspath=path,
|
||||
pair=pair,
|
||||
ticker_interval=ticker_interval,
|
||||
)) as fp:
|
||||
result[pair] = json.load(fp)
|
||||
return result
|
|
@ -1,9 +1,7 @@
|
|||
# pragma pylint: disable=missing-docstring
|
||||
import json
|
||||
from datetime import datetime
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import os
|
||||
import pytest
|
||||
from jsonschema import validate
|
||||
from telegram import Message, Chat, Update
|
||||
|
@ -68,17 +66,6 @@ def backtest_conf():
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def backdata():
|
||||
path = os.path.abspath(os.path.dirname(__file__))
|
||||
result = {}
|
||||
for pair in ['btc-neo', 'btc-eth', 'btc-omg', 'btc-edg', 'btc-pay',
|
||||
'btc-pivx', 'btc-qtum', 'btc-mtl', 'btc-etc', 'btc-ltc']:
|
||||
with open('{abspath}/testdata/{pair}.json'.format(abspath=path, pair=pair)) as fp:
|
||||
result[pair] = json.load(fp)
|
||||
return result
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def update():
|
||||
_update = Update(0)
|
||||
|
|
|
@ -17,6 +17,7 @@ from freqtrade.analyze import parse_ticker_dataframe, populate_indicators, \
|
|||
from freqtrade.exchange import Bittrex
|
||||
from freqtrade.main import min_roi_reached
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.tests import load_backtesting_data
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -115,7 +116,7 @@ def backtest(backtest_conf, processed, mocker):
|
|||
|
||||
|
||||
@pytest.mark.skipif(not os.environ.get('BACKTEST'), reason="BACKTEST not set")
|
||||
def test_backtest(backtest_conf, backdata, mocker):
|
||||
def test_backtest(backtest_conf, mocker):
|
||||
print('')
|
||||
|
||||
config = None
|
||||
|
@ -128,15 +129,17 @@ def test_backtest(backtest_conf, backdata, mocker):
|
|||
ticker_interval = int(os.environ.get('BACKTEST_TICKER_INTERVAL') or 5)
|
||||
print('Using ticker_interval: {} ...'.format(ticker_interval))
|
||||
|
||||
livedata = {}
|
||||
data = {}
|
||||
if os.environ.get('BACKTEST_LIVE'):
|
||||
print('Downloading data for all pairs in whitelist ...')
|
||||
exchange._API = Bittrex({'key': '', 'secret': ''})
|
||||
for pair in config['exchange']['pair_whitelist']:
|
||||
livedata[pair] = exchange.get_ticker_history(pair, ticker_interval)
|
||||
data[pair] = exchange.get_ticker_history(pair, ticker_interval)
|
||||
else:
|
||||
print('Using local backtesting data (ignoring whitelist in given config)...')
|
||||
data = load_backtesting_data(ticker_interval)
|
||||
|
||||
config = config or backtest_conf
|
||||
data = livedata or backdata
|
||||
|
||||
print('Using stake_currency: {} ...\nUsing stake_amount: {} ...'.format(
|
||||
config['stake_currency'], config['stake_amount']
|
||||
|
|
|
@ -9,7 +9,8 @@ import pytest
|
|||
from hyperopt import fmin, tpe, hp, Trials, STATUS_OK
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.tests.test_backtesting import backtest, format_results, preprocess
|
||||
from freqtrade.tests.test_backtesting import backtest, format_results
|
||||
from freqtrade.tests.test_backtesting import preprocess
|
||||
from freqtrade.vendor.qtpylib.indicators import crossed_above
|
||||
|
||||
logging.disable(logging.DEBUG) # disable debug logs that slow backtesting a lot
|
||||
|
@ -19,6 +20,7 @@ TARGET_TRADES = 1300
|
|||
TOTAL_TRIES = 4
|
||||
current_tries = 0
|
||||
|
||||
|
||||
def buy_strategy_generator(params):
|
||||
def populate_buy_trend(dataframe: DataFrame) -> DataFrame:
|
||||
conditions = []
|
||||
|
|
1
freqtrade/tests/testdata/BTC_BCC-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_BCC-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_BCC-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_BCC-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_DASH-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_DASH-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_DASH-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_DASH-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_EMC2-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_EMC2-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_EMC2-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_EMC2-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_ETC-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_ETC-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_ETC-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_ETC-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_ETH-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_ETH-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_ETH-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_ETH-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_LSK-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_LSK-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_LSK-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_LSK-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_LTC-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_LTC-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_LTC-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_LTC-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_MCO-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_MCO-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_MCO-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_MCO-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_MER-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_MER-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_MER-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_MER-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_NEO-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_NEO-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_NEO-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_NEO-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_OK-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_OK-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_OK-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_OK-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_OMG-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_OMG-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_OMG-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_OMG-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_POWR-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_POWR-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_POWR-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_POWR-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_QTUM-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_QTUM-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_QTUM-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_QTUM-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_STRAT-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_STRAT-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_STRAT-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_STRAT-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_VTC-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_VTC-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_VTC-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_VTC-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_WAVES-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_WAVES-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_WAVES-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_WAVES-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XLM-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XLM-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XLM-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XLM-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XRP-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XRP-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XRP-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XRP-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XZC-1.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XZC-1.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/BTC_XZC-5.json
vendored
Normal file
1
freqtrade/tests/testdata/BTC_XZC-5.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-edg.json
vendored
1
freqtrade/tests/testdata/btc-edg.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-etc.json
vendored
1
freqtrade/tests/testdata/btc-etc.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-eth.json
vendored
1
freqtrade/tests/testdata/btc-eth.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-ltc.json
vendored
1
freqtrade/tests/testdata/btc-ltc.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-mtl.json
vendored
1
freqtrade/tests/testdata/btc-mtl.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-neo.json
vendored
1
freqtrade/tests/testdata/btc-neo.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-omg.json
vendored
1
freqtrade/tests/testdata/btc-omg.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-pay.json
vendored
1
freqtrade/tests/testdata/btc-pay.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-pivx.json
vendored
1
freqtrade/tests/testdata/btc-pivx.json
vendored
File diff suppressed because one or more lines are too long
1
freqtrade/tests/testdata/btc-qtum.json
vendored
1
freqtrade/tests/testdata/btc-qtum.json
vendored
File diff suppressed because one or more lines are too long
|
@ -7,8 +7,13 @@ from os import path
|
|||
from freqtrade import exchange
|
||||
from freqtrade.exchange import Bittrex
|
||||
|
||||
PAIRS = ['BTC-OK', 'BTC-NEO', 'BTC-DASH', 'BTC-ETC', 'BTC-ETH', 'BTC-SNT']
|
||||
TICKER_INTERVAL = 1 # ticker interval in minutes (currently implemented: 1 and 5)
|
||||
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__))
|
||||
|
||||
# Init Bittrex exchange
|
||||
|
@ -16,8 +21,8 @@ exchange._API = Bittrex({'key': '', 'secret': ''})
|
|||
|
||||
for pair in PAIRS:
|
||||
data = exchange.get_ticker_history(pair, TICKER_INTERVAL)
|
||||
filename = path.join(OUTPUT_DIR, '{}-{}m.json'.format(
|
||||
pair.lower(),
|
||||
filename = path.join(OUTPUT_DIR, '{}-{}.json'.format(
|
||||
pair,
|
||||
TICKER_INTERVAL,
|
||||
))
|
||||
with open(filename, 'w') as fp:
|
||||
|
|
Loading…
Reference in New Issue
Block a user