Replace 'BTC_XXX' with 'XXX/BTC' for pairs and 'XXX_BTC' for files

This commit is contained in:
enenn 2018-02-03 17:15:40 +01:00
parent ebd49cade5
commit f913b57bbe
20 changed files with 170 additions and 171 deletions

View File

@ -1,4 +0,0 @@
#!/usr/bin/env python3
from freqtrade.main import main
main()

View File

@ -13,19 +13,19 @@
"key": "your_echange_key", "key": "your_echange_key",
"secret": "your_echange_secret", "secret": "your_echange_secret",
"pair_whitelist": [ "pair_whitelist": [
"BTC_ETH", "ETH/BTC",
"BTC_LTC", "LTC/BTC",
"BTC_ETC", "ETC/BTC",
"BTC_DASH", "DASH/BTC",
"BTC_ZEC", "ZEC/BTC",
"BTC_XLM", "XLM/BTC",
"BTC_NXT", "NXT/BTC",
"BTC_POWR", "POWR/BTC",
"BTC_ADA", "ADA/BTC",
"BTC_XMR" "XMR/BTC"
], ],
"pair_blacklist": [ "pair_blacklist": [
"BTC_DOGE" "DOGE/BTC"
] ]
}, },
"experimental": { "experimental": {

View File

@ -117,7 +117,7 @@ A backtesting result will look like that:
====================== BACKTESTING REPORT ================================ ====================== BACKTESTING REPORT ================================
pair buy count avg profit % total profit BTC avg duration pair buy count avg profit % total profit BTC avg duration
-------- ----------- -------------- ------------------ -------------- -------- ----------- -------------- ------------------ --------------
BTC_ETH 56 -0.67 -0.00075455 62.3 ETH/BTC 56 -0.67 -0.00075455 62.3
BTC_LTC 38 -0.48 -0.00036315 57.9 BTC_LTC 38 -0.48 -0.00036315 57.9
BTC_ETC 42 -1.15 -0.00096469 67.0 BTC_ETC 42 -1.15 -0.00096469 67.0
BTC_DASH 72 -0.62 -0.00089368 39.9 BTC_DASH 72 -0.62 -0.00089368 39.9

View File

@ -87,7 +87,7 @@ def analyze_ticker(ticker_history: List[Dict]) -> DataFrame:
def get_signal(pair: str, interval: int) -> (bool, bool): def get_signal(pair: str, interval: int) -> (bool, bool):
""" """
Calculates current signal based several technical analysis indicators Calculates current signal based several technical analysis indicators
:param pair: pair in format BTC_ANT or BTC-ANT :param pair: pair in format ANT/BTC
:return: (Buy, Sell) A bool-tuple indicating buy/sell signal :return: (Buy, Sell) A bool-tuple indicating buy/sell signal
""" """
ticker_hist = get_ticker_history(pair, interval) ticker_hist = get_ticker_history(pair, interval)

View File

@ -45,6 +45,9 @@ def init(config: dict) -> None:
# TODO add check for a list of supported exchanges # TODO add check for a list of supported exchanges
if name not in ccxt.exchanges:
raise OperationalException('Exchange {} is not supported'.format(name))
try: try:
# exchange_class = Exchanges[name.upper()].value # exchange_class = Exchanges[name.upper()].value
_API = getattr(ccxt, name.lower())({ _API = getattr(ccxt, name.lower())({
@ -81,7 +84,7 @@ def validate_pairs(pairs: List[str]) -> None:
stake_cur = _CONF['stake_currency'] stake_cur = _CONF['stake_currency']
for pair in pairs: for pair in pairs:
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs # Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
pair = pair.replace('_', '/') # pair = pair.replace('_', '/')
# TODO: add a support for having coins in BTC/USDT format # TODO: add a support for having coins in BTC/USDT format
if not pair.endswith(stake_cur): if not pair.endswith(stake_cur):

View File

@ -22,7 +22,7 @@ class Exchange(ABC):
def buy(self, pair: str, rate: float, amount: float) -> str: def buy(self, pair: str, rate: float, amount: float) -> str:
""" """
Places a limit buy order. Places a limit buy order.
:param pair: Pair as str, format: BTC_ETH :param pair: Pair as str, format: ETH/BTC
:param rate: Rate limit for order :param rate: Rate limit for order
:param amount: The amount to purchase :param amount: The amount to purchase
:return: order_id of the placed buy order :return: order_id of the placed buy order
@ -32,7 +32,7 @@ class Exchange(ABC):
def sell(self, pair: str, rate: float, amount: float) -> str: def sell(self, pair: str, rate: float, amount: float) -> str:
""" """
Places a limit sell order. Places a limit sell order.
:param pair: Pair as str, format: BTC_ETH :param pair: Pair as str, format: ETH/BTC
:param rate: Rate limit for order :param rate: Rate limit for order
:param amount: The amount to sell :param amount: The amount to sell
:return: order_id of the placed sell order :return: order_id of the placed sell order
@ -65,7 +65,7 @@ class Exchange(ABC):
def get_ticker(self, pair: str, refresh: Optional[bool] = True) -> dict: def get_ticker(self, pair: str, refresh: Optional[bool] = True) -> dict:
""" """
Gets ticker for given pair. Gets ticker for given pair.
:param pair: Pair as str, format: BTC_ETC :param pair: Pair as str, format: ETC/BTC
:param refresh: Shall we query a new value or a cached value is enough :param refresh: Shall we query a new value or a cached value is enough
:return: dict, format: { :return: dict, format: {
'bid': float, 'bid': float,
@ -78,7 +78,7 @@ class Exchange(ABC):
def get_ticker_history(self, pair: str, tick_interval: int) -> List[Dict]: def get_ticker_history(self, pair: str, tick_interval: int) -> List[Dict]:
""" """
Gets ticker history for given pair. Gets ticker history for given pair.
:param pair: Pair as str, format: BTC_ETC :param pair: Pair as str, format: ETC/BTC
:param tick_interval: ticker interval in minutes :param tick_interval: ticker interval in minutes
:return: list, format: [ :return: list, format: [
{ {
@ -122,7 +122,7 @@ class Exchange(ABC):
def get_pair_detail_url(self, pair: str) -> str: def get_pair_detail_url(self, pair: str) -> str:
""" """
Returns the market detail url for the given pair. Returns the market detail url for the given pair.
:param pair: Pair as str, format: BTC_ETC :param pair: Pair as str, format: ETC/BTC
:return: URL as str :return: URL as str
""" """

View File

@ -400,9 +400,9 @@ def _balance(bot: Bot, update: Update) -> None:
currency["Rate"] = 1.0 currency["Rate"] = 1.0
else: else:
if coin == 'USDT': if coin == 'USDT':
currency["Rate"] = 1.0 / exchange.get_ticker('USDT_BTC', False)['bid'] currency["Rate"] = 1.0 / exchange.get_ticker('BTC/USDT', False)['bid']
else: else:
currency["Rate"] = exchange.get_ticker('BTC_' + coin, False)['bid'] currency["Rate"] = exchange.get_ticker(coin + '/BTC', False)['bid']
currency['BTC'] = currency["Rate"] * currency["Balance"] currency['BTC'] = currency["Rate"] * currency["Balance"]
total = total + currency['BTC'] total = total + currency['BTC']
output += """*Currency*: {Currency} output += """*Currency*: {Currency}

View File

@ -49,11 +49,11 @@ def default_conf():
"key": "key", "key": "key",
"secret": "secret", "secret": "secret",
"pair_whitelist": [ "pair_whitelist": [
"BTC_ETH", "ETH/BTC",
"BTC_TKN", "TKN/BTC",
"BTC_TRST", "TRST/BTC",
"BTC_SWT", "SWT/BTC",
"BTC_BCC" "BCC/BTC"
] ]
}, },
"telegram": { "telegram": {
@ -150,7 +150,7 @@ def limit_buy_order_old():
return { return {
'id': 'mocked_limit_buy_old', 'id': 'mocked_limit_buy_old',
'type': 'LIMIT_BUY', 'type': 'LIMIT_BUY',
'pair': 'BTC_ETH', 'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime), 'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'rate': 0.00001099, 'rate': 0.00001099,
'amount': 90.99181073, 'amount': 90.99181073,
@ -163,7 +163,7 @@ def limit_sell_order_old():
return { return {
'id': 'mocked_limit_sell_old', 'id': 'mocked_limit_sell_old',
'type': 'LIMIT_SELL', 'type': 'LIMIT_SELL',
'pair': 'BTC_ETH', 'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime), 'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'rate': 0.00001099, 'rate': 0.00001099,
'amount': 90.99181073, 'amount': 90.99181073,
@ -176,7 +176,7 @@ def limit_buy_order_old_partial():
return { return {
'id': 'mocked_limit_buy_old_partial', 'id': 'mocked_limit_buy_old_partial',
'type': 'LIMIT_BUY', 'type': 'LIMIT_BUY',
'pair': 'BTC_ETH', 'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime), 'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'rate': 0.00001099, 'rate': 0.00001099,
'amount': 90.99181073, 'amount': 90.99181073,
@ -263,7 +263,7 @@ def ticker_history_without_bv():
@pytest.fixture @pytest.fixture
def result(): def result():
with open('freqtrade/tests/testdata/BTC_ETH-1.json') as data_file: with open('freqtrade/tests/testdata/ETH_BTC-1.json') as data_file:
return parse_ticker_dataframe(json.load(data_file)) return parse_ticker_dataframe(json.load(data_file))

View File

@ -42,8 +42,8 @@ def test_init_exception(default_conf):
def test_validate_pairs(default_conf, mocker): def test_validate_pairs(default_conf, mocker):
api_mock = MagicMock() api_mock = MagicMock()
api_mock.get_markets = MagicMock(return_value=[ api_mock.load_markets = MagicMock(return_value=[
'BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT', 'BTC_BCC', 'ETH/BTC', 'TKN/BTC', 'TRST/BTC', 'SWT/BTC', 'BCC/BTC',
]) ])
mocker.patch('freqtrade.exchange._API', api_mock) mocker.patch('freqtrade.exchange._API', api_mock)
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
@ -62,7 +62,7 @@ def test_validate_pairs_not_available(default_conf, mocker):
def test_validate_pairs_not_compatible(default_conf, mocker): def test_validate_pairs_not_compatible(default_conf, mocker):
api_mock = MagicMock() api_mock = MagicMock()
api_mock.get_markets = MagicMock( api_mock.get_markets = MagicMock(
return_value=['BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT']) return_value=['ETH/BTC', 'TKN/BTC', 'TRST/BTC', 'SWT/BTC'])
default_conf['stake_currency'] = 'ETH' default_conf['stake_currency'] = 'ETH'
mocker.patch('freqtrade.exchange._API', api_mock) mocker.patch('freqtrade.exchange._API', api_mock)
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
@ -87,7 +87,7 @@ def test_buy_dry_run(default_conf, mocker):
default_conf['dry_run'] = True default_conf['dry_run'] = True
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
assert 'dry_run_buy_' in buy(pair='BTC_ETH', rate=200, amount=1) assert 'dry_run_buy_' in buy(pair='ETH/BTC', rate=200, amount=1)
def test_buy_prod(default_conf, mocker): def test_buy_prod(default_conf, mocker):
@ -99,14 +99,14 @@ def test_buy_prod(default_conf, mocker):
default_conf['dry_run'] = False default_conf['dry_run'] = False
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
assert 'dry_run_buy_' in buy(pair='BTC_ETH', rate=200, amount=1) assert 'dry_run_buy_' in buy(pair='ETH/BTC', rate=200, amount=1)
def test_sell_dry_run(default_conf, mocker): def test_sell_dry_run(default_conf, mocker):
default_conf['dry_run'] = True default_conf['dry_run'] = True
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
assert 'dry_run_sell_' in sell(pair='BTC_ETH', rate=200, amount=1) assert 'dry_run_sell_' in sell(pair='ETH/BTC', rate=200, amount=1)
def test_sell_prod(default_conf, mocker): def test_sell_prod(default_conf, mocker):
@ -118,7 +118,7 @@ def test_sell_prod(default_conf, mocker):
default_conf['dry_run'] = False default_conf['dry_run'] = False
mocker.patch.dict('freqtrade.exchange._CONF', default_conf) mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
assert 'dry_run_sell_' in sell(pair='BTC_ETH', rate=200, amount=1) assert 'dry_run_sell_' in sell(pair='ETH/BTC', rate=200, amount=1)
def test_get_balance_dry_run(default_conf, mocker): def test_get_balance_dry_run(default_conf, mocker):
@ -180,7 +180,7 @@ def test_get_ticker(default_conf, mocker):
mocker.patch('freqtrade.exchange.bittrex._API', api_mock) mocker.patch('freqtrade.exchange.bittrex._API', api_mock)
# retrieve original ticker # retrieve original ticker
ticker = get_ticker(pair='BTC_ETH') ticker = get_ticker(pair='ETH/BTC')
assert ticker['bid'] == 0.00001098 assert ticker['bid'] == 0.00001098
assert ticker['ask'] == 0.00001099 assert ticker['ask'] == 0.00001099
@ -191,12 +191,12 @@ def test_get_ticker(default_conf, mocker):
# if not caching the result we should get the same ticker # if not caching the result we should get the same ticker
# if not fetching a new result we should get the cached ticker # if not fetching a new result we should get the cached ticker
ticker = get_ticker(pair='BTC_ETH', refresh=False) ticker = get_ticker(pair='ETH/BTC', refresh=False)
assert ticker['bid'] == 0.00001098 assert ticker['bid'] == 0.00001098
assert ticker['ask'] == 0.00001099 assert ticker['ask'] == 0.00001099
# force ticker refresh # force ticker refresh
ticker = get_ticker(pair='BTC_ETH', refresh=True) ticker = get_ticker(pair='ETH/BTC', refresh=True)
assert ticker['bid'] == 0.5 assert ticker['bid'] == 0.5
assert ticker['ask'] == 1 assert ticker['ask'] == 1
@ -208,7 +208,7 @@ def test_get_ticker_history(default_conf, mocker):
mocker.patch('freqtrade.exchange._API', api_mock) mocker.patch('freqtrade.exchange._API', api_mock)
# retrieve original ticker # retrieve original ticker
ticks = get_ticker_history('BTC_ETH', int(default_conf['ticker_interval'])) ticks = get_ticker_history('ETH/BTC', int(default_conf['ticker_interval']))
assert ticks == 123 assert ticks == 123
# change the ticker # change the ticker
@ -217,7 +217,7 @@ def test_get_ticker_history(default_conf, mocker):
mocker.patch('freqtrade.exchange._API', api_mock) mocker.patch('freqtrade.exchange._API', api_mock)
# ensure caching will still return the original ticker # ensure caching will still return the original ticker
ticks = get_ticker_history('BTC_ETH', int(default_conf['ticker_interval'])) ticks = get_ticker_history('ETH/BTC', int(default_conf['ticker_interval']))
assert ticks == 123 assert ticks == 123

View File

@ -21,7 +21,7 @@ def trim_dictlist(dict_list, num):
def test_generate_text_table(): def test_generate_text_table():
results = pd.DataFrame( results = pd.DataFrame(
{ {
'currency': ['BTC_ETH', 'BTC_ETH'], 'currency': ['ETH/BTC', 'ETH/BTC'],
'profit_percent': [0.1, 0.2], 'profit_percent': [0.1, 0.2],
'profit_BTC': [0.2, 0.4], 'profit_BTC': [0.2, 0.4],
'duration': [10, 30], 'duration': [10, 30],
@ -29,17 +29,17 @@ def test_generate_text_table():
'loss': [0, 0] 'loss': [0, 0]
} }
) )
print(generate_text_table({'BTC_ETH': {}}, results, 'BTC', 5)) print(generate_text_table({'ETH/BTC': {}}, results, 'BTC', 5))
assert generate_text_table({'BTC_ETH': {}}, results, 'BTC', 5) == ( assert generate_text_table({'ETH/BTC': {}}, results, 'BTC', 5) == (
'pair buy count avg profit % total profit BTC avg duration profit loss\n' # noqa 'pair buy count avg profit % total profit BTC avg duration profit loss\n' # noqa
'------- ----------- -------------- ------------------ -------------- -------- ------\n' # noqa '------- ----------- -------------- ------------------ -------------- -------- ------\n' # noqa
'BTC_ETH 2 15.00 0.60000000 100.0 2 0\n' # noqa 'ETH/BTC 2 15.00 0.60000000 100.0 2 0\n' # noqa
'TOTAL 2 15.00 0.60000000 100.0 2 0') # noqa 'TOTAL 2 15.00 0.60000000 100.0 2 0') # noqa
def test_get_timeframe(default_strategy): def test_get_timeframe(default_strategy):
data = preprocess(optimize.load_data( data = preprocess(optimize.load_data(
None, ticker_interval=1, pairs=['BTC_UNITEST'])) None, ticker_interval=1, pairs=['UNITTEST/BTC']))
min_date, max_date = get_timeframe(data) min_date, max_date = get_timeframe(data)
assert min_date.isoformat() == '2017-11-04T23:02:00+00:00' assert min_date.isoformat() == '2017-11-04T23:02:00+00:00'
assert max_date.isoformat() == '2017-11-14T22:59:00+00:00' assert max_date.isoformat() == '2017-11-14T22:59:00+00:00'
@ -49,7 +49,7 @@ def test_backtest(default_strategy, default_conf, mocker):
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
data = optimize.load_data(None, ticker_interval=5, pairs=['BTC_ETH']) data = optimize.load_data(None, ticker_interval=5, pairs=['ETH/BTC'])
data = trim_dictlist(data, -200) data = trim_dictlist(data, -200)
results = backtest({'stake_amount': default_conf['stake_amount'], results = backtest({'stake_amount': default_conf['stake_amount'],
'processed': optimize.preprocess(data), 'processed': optimize.preprocess(data),
@ -63,7 +63,7 @@ def test_backtest_1min_ticker_interval(default_strategy, default_conf, mocker):
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
# Run a backtesting for an exiting 5min ticker_interval # Run a backtesting for an exiting 5min ticker_interval
data = optimize.load_data(None, ticker_interval=1, pairs=['BTC_UNITEST']) data = optimize.load_data(None, ticker_interval=1, pairs=['UNITTEST/BTC'])
data = trim_dictlist(data, -200) data = trim_dictlist(data, -200)
results = backtest({'stake_amount': default_conf['stake_amount'], results = backtest({'stake_amount': default_conf['stake_amount'],
'processed': optimize.preprocess(data), 'processed': optimize.preprocess(data),
@ -74,8 +74,8 @@ def test_backtest_1min_ticker_interval(default_strategy, default_conf, mocker):
def load_data_test(what): def load_data_test(what):
timerange = ((None, 'line'), None, -100) timerange = ((None, 'line'), None, -100)
data = optimize.load_data(None, ticker_interval=1, pairs=['BTC_UNITEST'], timerange=timerange) data = optimize.load_data(None, ticker_interval=1, pairs=['UNITTEST/BTC'], timerange=timerange)
pair = data['BTC_UNITEST'] pair = data['UNITTEST/BTC']
datalen = len(pair) datalen = len(pair)
# Depending on the what parameter we now adjust the # Depending on the what parameter we now adjust the
# loaded data looks: # loaded data looks:
@ -84,7 +84,7 @@ def load_data_test(what):
# 'T': '2017-11-04T23:02:00', 'BV': 0.123}] # 'T': '2017-11-04T23:02:00', 'BV': 0.123}]
base = 0.001 base = 0.001
if what == 'raise': if what == 'raise':
return {'BTC_UNITEST': return {'UNITTEST/BTC':
[{'T': pair[x]['T'], # Keep old dates [{'T': pair[x]['T'], # Keep old dates
'V': pair[x]['V'], # Keep old volume 'V': pair[x]['V'], # Keep old volume
'BV': pair[x]['BV'], # keep too 'BV': pair[x]['BV'], # keep too
@ -93,7 +93,7 @@ def load_data_test(what):
'L': x * base - 0.0001, 'L': x * base - 0.0001,
'C': x * base} for x in range(0, datalen)]} 'C': x * base} for x in range(0, datalen)]}
if what == 'lower': if what == 'lower':
return {'BTC_UNITEST': return {'UNITTEST/BTC':
[{'T': pair[x]['T'], # Keep old dates [{'T': pair[x]['T'], # Keep old dates
'V': pair[x]['V'], # Keep old volume 'V': pair[x]['V'], # Keep old volume
'BV': pair[x]['BV'], # keep too 'BV': pair[x]['BV'], # keep too
@ -103,7 +103,7 @@ def load_data_test(what):
'C': 1 - x * base} for x in range(0, datalen)]} 'C': 1 - x * base} for x in range(0, datalen)]}
if what == 'sine': if what == 'sine':
hz = 0.1 # frequency hz = 0.1 # frequency
return {'BTC_UNITEST': return {'UNITTEST/BTC':
[{'T': pair[x]['T'], # Keep old dates [{'T': pair[x]['T'], # Keep old dates
'V': pair[x]['V'], # Keep old volume 'V': pair[x]['V'], # Keep old volume
'BV': pair[x]['BV'], # keep too 'BV': pair[x]['BV'], # keep too
@ -133,7 +133,7 @@ def simple_backtest(config, contour, num_results):
def test_backtest2(default_conf, mocker, default_strategy): def test_backtest2(default_conf, mocker, default_strategy):
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
data = optimize.load_data(None, ticker_interval=5, pairs=['BTC_ETH']) data = optimize.load_data(None, ticker_interval=5, pairs=['ETH/BTC'])
data = trim_dictlist(data, -200) data = trim_dictlist(data, -200)
results = backtest({'stake_amount': default_conf['stake_amount'], results = backtest({'stake_amount': default_conf['stake_amount'],
'processed': optimize.preprocess(data), 'processed': optimize.preprocess(data),
@ -146,7 +146,7 @@ def test_processed(default_conf, mocker, default_strategy):
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
dict_of_tickerrows = load_data_test('raise') dict_of_tickerrows = load_data_test('raise')
dataframes = optimize.preprocess(dict_of_tickerrows) dataframes = optimize.preprocess(dict_of_tickerrows)
dataframe = dataframes['BTC_UNITEST'] dataframe = dataframes['UNITTEST/BTC']
cols = dataframe.columns cols = dataframe.columns
# assert the dataframe got some of the indicator columns # assert the dataframe got some of the indicator columns
for col in ['close', 'high', 'low', 'open', 'date', for col in ['close', 'high', 'low', 'open', 'date',
@ -162,13 +162,13 @@ def test_backtest_pricecontours(default_conf, mocker, default_strategy):
def mocked_load_data(datadir, pairs=[], ticker_interval=0, refresh_pairs=False, timerange=None): def mocked_load_data(datadir, pairs=[], ticker_interval=0, refresh_pairs=False, timerange=None):
tickerdata = optimize.load_tickerdata_file(datadir, 'BTC_UNITEST', 1, timerange=timerange) tickerdata = optimize.load_tickerdata_file(datadir, 'UNITTEST/BTC', 1, timerange=timerange)
pairdata = {'BTC_UNITEST': tickerdata} pairdata = {'UNITTEST/BTC': tickerdata}
return pairdata return pairdata
def test_backtest_start(default_conf, mocker, caplog): def test_backtest_start(default_conf, mocker, caplog):
default_conf['exchange']['pair_whitelist'] = ['BTC_UNITEST'] default_conf['exchange']['pair_whitelist'] = ['UNITTEST/BTC']
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
mocker.patch('freqtrade.misc.load_config', new=lambda s: default_conf) mocker.patch('freqtrade.misc.load_config', new=lambda s: default_conf)
mocker.patch.multiple('freqtrade.optimize', mocker.patch.multiple('freqtrade.optimize',

View File

@ -10,7 +10,7 @@ from freqtrade.exchange import Bittrex
from freqtrade.optimize.__init__ import make_testdata_path, download_pairs,\ from freqtrade.optimize.__init__ import make_testdata_path, download_pairs,\
download_backtesting_testdata, load_tickerdata_file, trim_tickerlist, file_dump_json download_backtesting_testdata, load_tickerdata_file, trim_tickerlist, file_dump_json
# Change this if modifying BTC_UNITEST testdatafile # Change this if modifying UNITTEST/BTC testdatafile
_BTC_UNITTEST_LENGTH = 13681 _BTC_UNITTEST_LENGTH = 13681
@ -51,13 +51,13 @@ def test_load_data_30min_ticker(default_conf, ticker_history, mocker, caplog):
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file = 'freqtrade/tests/testdata/BTC_UNITTEST-30.json' file = 'freqtrade/tests/testdata/UNITTEST_BTC-30.json'
_backup_file(file, copy_file=True) _backup_file(file, copy_file=True)
optimize.load_data(None, pairs=['BTC_UNITTEST'], ticker_interval=30) optimize.load_data(None, pairs=['UNITTEST/BTC'], ticker_interval=30)
assert os.path.isfile(file) is True assert os.path.isfile(file) is True
assert ('freqtrade.optimize', assert ('freqtrade.optimize',
logging.INFO, logging.INFO,
'Download the pair: "BTC_ETH", Interval: 30 min') not in caplog.record_tuples 'Download the pair: "ETH/BTC", Interval: 30 min') not in caplog.record_tuples
_clean_test_file(file) _clean_test_file(file)
@ -67,13 +67,13 @@ def test_load_data_5min_ticker(default_conf, ticker_history, mocker, caplog):
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file = 'freqtrade/tests/testdata/BTC_ETH-5.json' file = 'freqtrade/tests/testdata/ETH_BTC-5.json'
_backup_file(file, copy_file=True) _backup_file(file, copy_file=True)
optimize.load_data(None, pairs=['BTC_ETH'], ticker_interval=5) optimize.load_data(None, pairs=['ETH/BTC'], ticker_interval=5)
assert os.path.isfile(file) is True assert os.path.isfile(file) is True
assert ('freqtrade.optimize', assert ('freqtrade.optimize',
logging.INFO, logging.INFO,
'Download the pair: "BTC_ETH", Interval: 5 min') not in caplog.record_tuples 'Download the pair: "ETH/BTC", Interval: 5 min') not in caplog.record_tuples
_clean_test_file(file) _clean_test_file(file)
@ -83,13 +83,13 @@ def test_load_data_1min_ticker(default_conf, ticker_history, mocker, caplog):
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file = 'freqtrade/tests/testdata/BTC_ETH-1.json' file = 'freqtrade/tests/testdata/ETH_BTC-1.json'
_backup_file(file, copy_file=True) _backup_file(file, copy_file=True)
optimize.load_data(None, ticker_interval=1, pairs=['BTC_ETH']) optimize.load_data(None, ticker_interval=1, pairs=['ETH/BTC'])
assert os.path.isfile(file) is True assert os.path.isfile(file) is True
assert ('freqtrade.optimize', assert ('freqtrade.optimize',
logging.INFO, logging.INFO,
'Download the pair: "BTC_ETH", Interval: 1 min') not in caplog.record_tuples 'Download the pair: "ETH/BTC", Interval: 1 min') not in caplog.record_tuples
_clean_test_file(file) _clean_test_file(file)
@ -99,13 +99,13 @@ def test_load_data_with_new_pair_1min(default_conf, ticker_history, mocker, capl
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file = 'freqtrade/tests/testdata/BTC_MEME-1.json' file = 'freqtrade/tests/testdata/MEME/BTC-1.json'
_backup_file(file) _backup_file(file)
optimize.load_data(None, ticker_interval=1, pairs=['BTC_MEME']) optimize.load_data(None, ticker_interval=1, pairs=['MEME/BTC'])
assert os.path.isfile(file) is True assert os.path.isfile(file) is True
assert ('freqtrade.optimize', assert ('freqtrade.optimize',
logging.INFO, logging.INFO,
'Download the pair: "BTC_MEME", Interval: 1 min') in caplog.record_tuples 'Download the pair: "MEME/BTC", Interval: 1 min') in caplog.record_tuples
_clean_test_file(file) _clean_test_file(file)
@ -118,10 +118,10 @@ def test_download_pairs(default_conf, ticker_history, mocker):
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_1 = 'freqtrade/tests/testdata/MEME_BTC-1.json'
file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' file1_5 = 'freqtrade/tests/testdata/MEME_BTC-5.json'
file2_1 = 'freqtrade/tests/testdata/BTC_CFI-1.json' file2_1 = 'freqtrade/tests/testdata/CFI_BTC-1.json'
file2_5 = 'freqtrade/tests/testdata/BTC_CFI-5.json' file2_5 = 'freqtrade/tests/testdata/CFI_BTC-5.json'
_backup_file(file1_1) _backup_file(file1_1)
_backup_file(file1_5) _backup_file(file1_5)
@ -160,8 +160,8 @@ def test_download_pairs_exception(default_conf, ticker_history, mocker, caplog):
mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.dict('freqtrade.main._CONF', default_conf)
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_1 = 'freqtrade/tests/testdata/MEME_BTC-1.json'
file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' file1_5 = 'freqtrade/tests/testdata/MEME_BTC-5.json'
_backup_file(file1_1) _backup_file(file1_1)
_backup_file(file1_5) _backup_file(file1_5)
@ -180,7 +180,7 @@ def test_download_backtesting_testdata(default_conf, ticker_history, mocker):
exchange._API = Bittrex({'key': '', 'secret': ''}) exchange._API = Bittrex({'key': '', 'secret': ''})
# Download a 1 min ticker file # Download a 1 min ticker file
file1 = 'freqtrade/tests/testdata/BTC_XEL-1.json' file1 = 'freqtrade/tests/testdata/XEL_BTC-1.json'
_backup_file(file1) _backup_file(file1)
download_backtesting_testdata(None, pair="BTC-XEL", interval=1) download_backtesting_testdata(None, pair="BTC-XEL", interval=1)
assert os.path.isfile(file1) is True assert os.path.isfile(file1) is True
@ -205,12 +205,12 @@ def test_download_backtesting_testdata2(mocker):
def test_load_tickerdata_file(): def test_load_tickerdata_file():
# 7 does not exist in either format. # 7 does not exist in either format.
assert not load_tickerdata_file(None, 'BTC_UNITEST', 7) assert not load_tickerdata_file(None, 'UNITTEST/BTC', 7)
# 1 exists only as a .json # 1 exists only as a .json
tickerdata = load_tickerdata_file(None, 'BTC_UNITEST', 1) tickerdata = load_tickerdata_file(None, 'UNITTEST/BTC', 1)
assert _BTC_UNITTEST_LENGTH == len(tickerdata) assert _BTC_UNITTEST_LENGTH == len(tickerdata)
# 8 .json is empty and will fail if it's loaded. .json.gz is a copy of 1.json # 8 .json is empty and will fail if it's loaded. .json.gz is a copy of 1.json
tickerdata = load_tickerdata_file(None, 'BTC_UNITEST', 8) tickerdata = load_tickerdata_file(None, 'UNITTEST/BTC', 8)
assert _BTC_UNITTEST_LENGTH == len(tickerdata) assert _BTC_UNITTEST_LENGTH == len(tickerdata)
@ -223,14 +223,14 @@ def test_init(default_conf, mocker):
def test_tickerdata_to_dataframe(): def test_tickerdata_to_dataframe():
timerange = ((None, 'line'), None, -100) timerange = ((None, 'line'), None, -100)
tick = load_tickerdata_file(None, 'BTC_UNITEST', 1, timerange=timerange) tick = load_tickerdata_file(None, 'UNITTEST/BTC', 1, timerange=timerange)
tickerlist = {'BTC_UNITEST': tick} tickerlist = {'UNITTEST/BTC': tick}
data = optimize.tickerdata_to_dataframe(tickerlist) data = optimize.tickerdata_to_dataframe(tickerlist)
assert len(data['BTC_UNITEST']) == 100 assert len(data['UNITTEST/BTC']) == 100
def test_trim_tickerlist(): def test_trim_tickerlist():
with open('freqtrade/tests/testdata/BTC_ETH-1.json') as data_file: with open('freqtrade/tests/testdata/ETH_BTC-1.json') as data_file:
ticker_list = json.load(data_file) ticker_list = json.load(data_file)
ticker_list_len = len(ticker_list) ticker_list_len = len(ticker_list)

View File

@ -108,7 +108,7 @@ def test_status_handle(default_conf, update, ticker, mocker):
_status(bot=MagicMock(), update=update) _status(bot=MagicMock(), update=update)
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert '[BTC_ETH]' in msg_mock.call_args_list[0][0][0] assert '[ETH/BTC]' in msg_mock.call_args_list[0][0][0]
def test_status_table_handle(default_conf, update, ticker, mocker): def test_status_table_handle(default_conf, update, ticker, mocker):
@ -148,7 +148,7 @@ def test_status_table_handle(default_conf, update, ticker, mocker):
fields = re.sub('[ ]+', ' ', line[2].strip()).split(' ') fields = re.sub('[ ]+', ' ', line[2].strip()).split(' ')
assert int(fields[0]) == 1 assert int(fields[0]) == 1
assert fields[1] == 'BTC_ETH' assert fields[1] == 'ETH/BTC'
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
@ -206,7 +206,7 @@ def test_profit_handle(
assert '∙ `0.00006217 BTC (6.20%)`' in msg_mock.call_args_list[-1][0][0] assert '∙ `0.00006217 BTC (6.20%)`' in msg_mock.call_args_list[-1][0][0]
assert '∙ `0.933 USD`' in msg_mock.call_args_list[-1][0][0] assert '∙ `0.933 USD`' in msg_mock.call_args_list[-1][0][0]
assert '*Best Performing:* `BTC_ETH: 6.20%`' in msg_mock.call_args_list[-1][0][0] assert '*Best Performing:* `ETH/BTC: 6.20%`' in msg_mock.call_args_list[-1][0][0]
def test_forcesell_handle(default_conf, update, ticker, ticker_sell_up, mocker): def test_forcesell_handle(default_conf, update, ticker, ticker_sell_up, mocker):
@ -239,7 +239,7 @@ def test_forcesell_handle(default_conf, update, ticker, ticker_sell_up, mocker):
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert 'Amount' in rpc_mock.call_args_list[-1][0][0] assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0] assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
assert 'profit: 6.11%, 0.00006126' in rpc_mock.call_args_list[-1][0][0] assert 'profit: 6.11%, 0.00006126' in rpc_mock.call_args_list[-1][0][0]
@ -276,7 +276,7 @@ def test_forcesell_down_handle(default_conf, update, ticker, ticker_sell_down, m
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert 'Amount' in rpc_mock.call_args_list[-1][0][0] assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0] assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0] assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
@ -294,7 +294,7 @@ def test_exec_forcesell_open_orders(default_conf, ticker, mocker):
}), }),
cancel_order=cancel_order_mock) cancel_order=cancel_order_mock)
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
open_rate=1, open_rate=1,
exchange='BITTREX', exchange='BITTREX',
open_order_id='123456789', open_order_id='123456789',
@ -403,7 +403,7 @@ def test_performance_handle(
_performance(bot=MagicMock(), update=update) _performance(bot=MagicMock(), update=update)
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert 'Performance' in msg_mock.call_args_list[0][0][0] assert 'Performance' in msg_mock.call_args_list[0][0][0]
assert '<code>BTC_ETH\t6.20% (1)</code>' in msg_mock.call_args_list[0][0][0] assert '<code>ETH/BTC\t6.20% (1)</code>' in msg_mock.call_args_list[0][0][0]
def test_daily_handle(default_conf, update, ticker, limit_buy_order, limit_sell_order, mocker): def test_daily_handle(default_conf, update, ticker, limit_buy_order, limit_sell_order, mocker):

View File

@ -7,7 +7,7 @@ from freqtrade.analyze import parse_ticker_dataframe
@pytest.fixture @pytest.fixture
def result(): def result():
with open('freqtrade/tests/testdata/BTC_ETH-1.json') as data_file: with open('freqtrade/tests/testdata/ETH_BTC-1.json') as data_file:
return parse_ticker_dataframe(json.load(data_file)) return parse_ticker_dataframe(json.load(data_file))

View File

@ -12,14 +12,14 @@ def whitelist_conf():
'stake_currency': 'BTC', 'stake_currency': 'BTC',
'exchange': { 'exchange': {
'pair_whitelist': [ 'pair_whitelist': [
'BTC_ETH', 'ETH/BTC',
'BTC_TKN', 'TKN/BTC',
'BTC_TRST', 'TRST/BTC',
'BTC_SWT', 'SWT/BTC',
'BTC_BCC' 'BCC/BTC'
], ],
'pair_blacklist': [ 'pair_blacklist': [
'BTC_BLK' 'BLK/BTC'
], ],
}, },
} }
@ -90,9 +90,9 @@ def test_refresh_market_pair_not_in_whitelist(mocker):
mocker.patch.multiple('freqtrade.main.exchange', mocker.patch.multiple('freqtrade.main.exchange',
get_wallet_health=get_health) get_wallet_health=get_health)
refreshedwhitelist = refresh_whitelist( refreshedwhitelist = refresh_whitelist(
conf['exchange']['pair_whitelist'] + ['BTC_XXX']) conf['exchange']['pair_whitelist'] + ['XXX/BTC'])
# List ordered by BaseVolume # List ordered by BaseVolume
whitelist = ['BTC_ETH', 'BTC_TKN'] whitelist = ['ETH/BTC', 'TKN/BTC']
# Ensure all except those in whitelist are removed # Ensure all except those in whitelist are removed
assert whitelist == refreshedwhitelist assert whitelist == refreshedwhitelist
@ -104,7 +104,7 @@ def test_refresh_whitelist(mocker):
get_wallet_health=get_health) get_wallet_health=get_health)
refreshedwhitelist = refresh_whitelist(conf['exchange']['pair_whitelist']) refreshedwhitelist = refresh_whitelist(conf['exchange']['pair_whitelist'])
# List ordered by BaseVolume # List ordered by BaseVolume
whitelist = ['BTC_ETH', 'BTC_TKN'] whitelist = ['ETH/BTC', 'TKN/BTC']
# Ensure all except those in whitelist are removed # Ensure all except those in whitelist are removed
assert whitelist == refreshedwhitelist assert whitelist == refreshedwhitelist
@ -117,7 +117,7 @@ def test_refresh_whitelist_dynamic(mocker):
mocker.patch.multiple('freqtrade.main.exchange', mocker.patch.multiple('freqtrade.main.exchange',
get_market_summaries=get_market_summaries) get_market_summaries=get_market_summaries)
# argument: use the whitelist dynamically by exchange-volume # argument: use the whitelist dynamically by exchange-volume
whitelist = ['BTC_TKN', 'BTC_ETH'] whitelist = ['TKN/BTC', 'ETH/BTC']
refreshedwhitelist = refresh_whitelist( refreshedwhitelist = refresh_whitelist(
gen_pair_whitelist(conf['stake_currency'])) gen_pair_whitelist(conf['stake_currency']))
assert whitelist == refreshedwhitelist assert whitelist == refreshedwhitelist

View File

@ -4,7 +4,7 @@ import pandas
import freqtrade.optimize import freqtrade.optimize
from freqtrade import analyze from freqtrade import analyze
_pairs = ['BTC_ETH'] _pairs = ['ETH/BTC']
def load_dataframe_pair(pairs): def load_dataframe_pair(pairs):

View File

@ -11,7 +11,6 @@ from sqlalchemy import create_engine
import freqtrade.main as main import freqtrade.main as main
import freqtrade.tests.conftest as tt # test tools import freqtrade.tests.conftest as tt # test tools
from freqtrade import DependencyException, OperationalException from freqtrade import DependencyException, OperationalException
from freqtrade.exchange import Exchanges
from freqtrade.main import (_process, check_handle_timedout, create_trade, from freqtrade.main import (_process, check_handle_timedout, create_trade,
execute_sell, get_target_bid, handle_trade, init) execute_sell, get_target_bid, handle_trade, init)
from freqtrade.misc import State, get_state from freqtrade.misc import State, get_state
@ -250,8 +249,8 @@ def test_create_trade_no_pairs_after_blacklist(default_conf, ticker, mocker):
with pytest.raises(DependencyException, match=r'.*No pair in whitelist.*'): with pytest.raises(DependencyException, match=r'.*No pair in whitelist.*'):
conf = copy.deepcopy(default_conf) conf = copy.deepcopy(default_conf)
conf['exchange']['pair_whitelist'] = ["BTC_ETH"] conf['exchange']['pair_whitelist'] = ["ETH/BTC"]
conf['exchange']['pair_blacklist'] = ["BTC_ETH"] conf['exchange']['pair_blacklist'] = ["ETH/BTC"]
mocker.patch.dict('freqtrade.main._CONF', conf) mocker.patch.dict('freqtrade.main._CONF', conf)
create_trade(default_conf['stake_amount'], int(default_conf['ticker_interval'])) create_trade(default_conf['stake_amount'], int(default_conf['ticker_interval']))
@ -454,7 +453,7 @@ def test_check_handle_timedout_buy(default_conf, ticker, limit_buy_order_old, mo
init(default_conf, create_engine('sqlite://')) init(default_conf, create_engine('sqlite://'))
trade_buy = Trade( trade_buy = Trade(
pair='BTC_ETH', pair='ETH/BTC',
open_rate=0.00001099, open_rate=0.00001099,
exchange='BITTREX', exchange='BITTREX',
open_order_id='123456789', open_order_id='123456789',
@ -503,7 +502,7 @@ def test_check_handle_timedout_sell(default_conf, ticker, limit_sell_order_old,
init(default_conf, create_engine('sqlite://')) init(default_conf, create_engine('sqlite://'))
trade_sell = Trade( trade_sell = Trade(
pair='BTC_ETH', pair='ETH/BTC',
open_rate=0.00001099, open_rate=0.00001099,
exchange='BITTREX', exchange='BITTREX',
open_order_id='123456789', open_order_id='123456789',
@ -552,7 +551,7 @@ def test_check_handle_timedout_partial(default_conf, ticker, limit_buy_order_old
init(default_conf, create_engine('sqlite://')) init(default_conf, create_engine('sqlite://'))
trade_buy = Trade( trade_buy = Trade(
pair='BTC_ETH', pair='ETH/BTC',
open_rate=0.00001099, open_rate=0.00001099,
exchange='BITTREX', exchange='BITTREX',
open_order_id='123456789', open_order_id='123456789',
@ -617,7 +616,7 @@ def test_execute_sell_up(default_conf, ticker, ticker_sell_up, mocker):
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert 'Amount' in rpc_mock.call_args_list[-1][0][0] assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
assert 'Profit' in rpc_mock.call_args_list[-1][0][0] assert 'Profit' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0] assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
@ -655,7 +654,7 @@ def test_execute_sell_down(default_conf, ticker, ticker_sell_down, mocker):
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert 'Amount' in rpc_mock.call_args_list[-1][0][0] assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0] assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0] assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
@ -688,7 +687,7 @@ def test_execute_sell_without_conf_sell_down(default_conf, ticker, ticker_sell_d
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0] assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0] assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
@ -719,7 +718,7 @@ def test_execute_sell_without_conf_sell_up(default_conf, ticker, ticker_sell_up,
assert rpc_mock.call_count == 2 assert rpc_mock.call_count == 2
assert 'Selling' in rpc_mock.call_args_list[-1][0][0] assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
assert '[BTC_ETH]' in rpc_mock.call_args_list[-1][0][0] assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
assert 'Amount' in rpc_mock.call_args_list[-1][0][0] assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0] assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
assert '(profit: 6.11%, 0.00006126)' in rpc_mock.call_args_list[-1][0][0] assert '(profit: 6.11%, 0.00006126)' in rpc_mock.call_args_list[-1][0][0]

View File

@ -117,7 +117,7 @@ def test_update_with_bittrex(limit_buy_order, limit_sell_order):
""" """
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -144,7 +144,7 @@ def test_update_with_bittrex(limit_buy_order, limit_sell_order):
def test_calc_open_close_trade_price(limit_buy_order, limit_sell_order): def test_calc_open_close_trade_price(limit_buy_order, limit_sell_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -166,7 +166,7 @@ def test_calc_open_close_trade_price(limit_buy_order, limit_sell_order):
def test_calc_close_trade_price_exception(limit_buy_order): def test_calc_close_trade_price_exception(limit_buy_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -179,7 +179,7 @@ def test_calc_close_trade_price_exception(limit_buy_order):
def test_update_open_order(limit_buy_order): def test_update_open_order(limit_buy_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=1.00, stake_amount=1.00,
fee=0.1, fee=0.1,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -201,7 +201,7 @@ def test_update_open_order(limit_buy_order):
def test_update_invalid_order(limit_buy_order): def test_update_invalid_order(limit_buy_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=1.00, stake_amount=1.00,
fee=0.1, fee=0.1,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -213,7 +213,7 @@ def test_update_invalid_order(limit_buy_order):
def test_calc_open_trade_price(limit_buy_order): def test_calc_open_trade_price(limit_buy_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -230,7 +230,7 @@ def test_calc_open_trade_price(limit_buy_order):
def test_calc_close_trade_price(limit_buy_order, limit_sell_order): def test_calc_close_trade_price(limit_buy_order, limit_sell_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -251,7 +251,7 @@ def test_calc_close_trade_price(limit_buy_order, limit_sell_order):
def test_calc_profit(limit_buy_order, limit_sell_order): def test_calc_profit(limit_buy_order, limit_sell_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -285,7 +285,7 @@ def test_calc_profit(limit_buy_order, limit_sell_order):
def test_calc_profit_percent(limit_buy_order, limit_sell_order): def test_calc_profit_percent(limit_buy_order, limit_sell_order):
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
fee=0.0025, fee=0.0025,
exchange=Exchanges.BITTREX, exchange=Exchanges.BITTREX,
@ -316,7 +316,7 @@ def test_clean_dry_run_db(default_conf):
# Simulate dry_run entries # Simulate dry_run entries
trade = Trade( trade = Trade(
pair='BTC_ETH', pair='ETH/BTC',
stake_amount=0.001, stake_amount=0.001,
amount=123.0, amount=123.0,
fee=0.0025, fee=0.0025,
@ -327,7 +327,7 @@ def test_clean_dry_run_db(default_conf):
Trade.session.add(trade) Trade.session.add(trade)
trade = Trade( trade = Trade(
pair='BTC_ETC', pair='ETC/BTC',
stake_amount=0.001, stake_amount=0.001,
amount=123.0, amount=123.0,
fee=0.0025, fee=0.0025,
@ -339,7 +339,7 @@ def test_clean_dry_run_db(default_conf):
# Simulate prod entry # Simulate prod entry
trade = Trade( trade = Trade(
pair='BTC_ETC', pair='ETC/BTC',
stake_amount=0.001, stake_amount=0.001,
amount=123.0, amount=123.0,
fee=0.0025, fee=0.0025,

View File

@ -34,5 +34,6 @@ for pair in PAIRS:
for tick_interval in TICKER_INTERVALS: for tick_interval in TICKER_INTERVALS:
print('downloading pair %s, interval %s' % (pair, tick_interval)) print('downloading pair %s, interval %s' % (pair, tick_interval))
data = exchange.get_ticker_history(pair, tick_interval) data = exchange.get_ticker_history(pair, tick_interval)
filename = '{}-{}.json'.format(pair, tick_interval) pair_print = pair.replace('/', '_')
filename = '{}-{}.json'.format(pair_print, tick_interval)
misc.file_dump_json(filename, data) misc.file_dump_json(filename, data)

View File

@ -1,26 +1,26 @@
[ [
"BTC_ADA", "ADA/BTC",
"BTC_BAT", "BAT/BTC",
"BTC_DASH", "DASH/BTC",
"BTC_ETC", "ETC/BTC",
"BTC_ETH", "ETH/BTC",
"BTC_GBYTE", "GBYTE/BTC",
"BTC_LSK", "LSK/BTC",
"BTC_LTC", "LTC/BTC",
"BTC_NEO", "NEO/BTC",
"BTC_NXT", "NXT/BTC",
"BTC_POWR", "POWR/BTC",
"BTC_STORJ", "STORJ/BTC",
"BTC_QTUM", "QTUM/BTC",
"BTC_WAVES", "WAVES/BTC",
"BTC_VTC", "VTC/BTC",
"BTC_XLM", "XLM/BTC",
"BTC_XMR", "XMR/BTC",
"BTC_XVG", "XVG/BTC",
"BTC_XRP", "XRP/BTC",
"BTC_ZEC", "ZEC/BTC",
"USDT_BTC", "BTC/USDT",
"USDT_LTC", "LTC/USDT",
"USDT_ETH" "ETH/USDT"
] ]

View File

@ -26,16 +26,16 @@ def hyperopt_optimize_conf() -> dict:
}, },
"exchange": { "exchange": {
"pair_whitelist": [ "pair_whitelist": [
"BTC_ETH", "ETH/BTC",
"BTC_LTC", "LTC/BTC",
"BTC_ETC", "ETC/BTC",
"BTC_DASH", "DASH/BTC",
"BTC_ZEC", "ZEC/BTC",
"BTC_XLM", "XLM/BTC",
"BTC_NXT", "NXT/BTC",
"BTC_POWR", "POWR/BTC",
"BTC_ADA", "ADA/BTC",
"BTC_XMR" "XMR/BTC"
] ]
} }
} }