| 1 | # pragma pylint: disable=missing-docstring |
| 2 | import json |
| 3 | import logging |
| 4 | import re |
| 5 | from copy import deepcopy |
| 6 | from datetime import datetime |
| 7 | from functools import reduce |
| 8 | from pathlib import Path |
| 9 | from unittest.mock import MagicMock, Mock, PropertyMock |
| 10 | |
| 11 | import arrow |
| 12 | import numpy as np |
| 13 | import pytest |
| 14 | from telegram import Chat, Message, Update |
| 15 | |
| 16 | from freqtrade import constants |
| 17 | from freqtrade.commands import Arguments |
| 18 | from freqtrade.data.converter import ohlcv_to_dataframe |
| 19 | from freqtrade.edge import Edge, PairInfo |
| 20 | from freqtrade.exchange import Exchange |
| 21 | from freqtrade.freqtradebot import FreqtradeBot |
| 22 | from freqtrade.persistence import LocalTrade, Trade, init_db |
| 23 | from freqtrade.resolvers import ExchangeResolver |
| 24 | from freqtrade.worker import Worker |
| 25 | from tests.conftest_trades import (mock_trade_1, mock_trade_2, mock_trade_3, mock_trade_4, |
| 26 | mock_trade_5, mock_trade_6) |
| 27 | |
| 28 | |
| 29 | logging.getLogger('').setLevel(logging.INFO) |
| 30 | |
| 31 | |
| 32 | # Do not mask numpy errors as warnings that no one read, raise the exсeption |
| 33 | np.seterr(all='raise') |
| 34 | |
| 35 | |
| 36 | def pytest_addoption(parser): |
| 37 | parser.addoption('--longrun', action='store_true', dest="longrun", |
| 38 | default=False, help="Enable long-run tests (ccxt compat)") |
| 39 | |
| 40 | |
| 41 | def pytest_configure(config): |
| 42 | config.addinivalue_line( |
| 43 | "markers", "longrun: mark test that is running slowly and should not be run regularily" |
| 44 | ) |
| 45 | if not config.option.longrun: |
| 46 | setattr(config.option, 'markexpr', 'not longrun') |
| 47 | |
| 48 | |
| 49 | def log_has(line, logs): |
| 50 | # caplog mocker returns log as a tuple: ('freqtrade.something', logging.WARNING, 'foobar') |
| 51 | # and we want to match line against foobar in the tuple |
| 52 | return reduce(lambda a, b: a or b, |
| 53 | filter(lambda x: x[2] == line, logs.record_tuples), |
| 54 | False) |
| 55 | |
| 56 | |
| 57 | def log_has_re(line, logs): |
| 58 | return reduce(lambda a, b: a or b, |
| 59 | filter(lambda x: re.match(line, x[2]), logs.record_tuples), |
| 60 | False) |
| 61 | |
| 62 | |
| 63 | def get_args(args): |
| 64 | return Arguments(args).get_parsed_arg() |
| 65 | |
| 66 | |
| 67 | # Source: https://stackoverflow.com/questions/29881236/how-to-mock-asyncio-coroutines |
| 68 | def get_mock_coro(return_value): |
| 69 | async def mock_coro(*args, **kwargs): |
| 70 | return return_value |
| 71 | |
| 72 | return Mock(wraps=mock_coro) |
| 73 | |
| 74 | |
| 75 | def patched_configuration_load_config_file(mocker, config) -> None: |
| 76 | mocker.patch( |
| 77 | 'freqtrade.configuration.configuration.load_config_file', |
| 78 | lambda *args, **kwargs: config |
| 79 | ) |
| 80 | |
| 81 | |
| 82 | def patch_exchange(mocker, api_mock=None, id='binance', mock_markets=True) -> None: |
| 83 | mocker.patch('freqtrade.exchange.Exchange._load_async_markets', MagicMock(return_value={})) |
| 84 | mocker.patch('freqtrade.exchange.Exchange.validate_pairs', MagicMock()) |
| 85 | mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock()) |
| 86 | mocker.patch('freqtrade.exchange.Exchange.validate_ordertypes', MagicMock()) |
| 87 | mocker.patch('freqtrade.exchange.Exchange.validate_stakecurrency', MagicMock()) |
| 88 | mocker.patch('freqtrade.exchange.Exchange.id', PropertyMock(return_value=id)) |
| 89 | mocker.patch('freqtrade.exchange.Exchange.name', PropertyMock(return_value=id.title())) |
| 90 | mocker.patch('freqtrade.exchange.Exchange.precisionMode', PropertyMock(return_value=2)) |
| 91 | if mock_markets: |
| 92 | mocker.patch('freqtrade.exchange.Exchange.markets', |
| 93 | PropertyMock(return_value=get_markets())) |
| 94 | |
| 95 | if api_mock: |
| 96 | mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock)) |
| 97 | else: |
| 98 | mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock()) |
| 99 | |
| 100 | |
| 101 | def get_patched_exchange(mocker, config, api_mock=None, id='binance', |
| 102 | mock_markets=True) -> Exchange: |
| 103 | patch_exchange(mocker, api_mock, id, mock_markets) |
| 104 | config['exchange']['name'] = id |
| 105 | try: |
| 106 | exchange = ExchangeResolver.load_exchange(id, config) |
| 107 | except ImportError: |
| 108 | exchange = Exchange(config) |
| 109 | return exchange |
| 110 | |
| 111 | |
| 112 | def patch_wallet(mocker, free=999.9) -> None: |
| 113 | mocker.patch('freqtrade.wallets.Wallets.get_free', MagicMock( |
| 114 | return_value=free |
| 115 | )) |
| 116 | |
| 117 | |
| 118 | def patch_whitelist(mocker, conf) -> None: |
| 119 | mocker.patch('freqtrade.freqtradebot.FreqtradeBot._refresh_active_whitelist', |
| 120 | MagicMock(return_value=conf['exchange']['pair_whitelist'])) |
| 121 | |
| 122 | |
| 123 | def patch_edge(mocker) -> None: |
| 124 | # "ETH/BTC", |
| 125 | # "LTC/BTC", |
| 126 | # "XRP/BTC", |
| 127 | # "NEO/BTC" |
| 128 | |
| 129 | mocker.patch('freqtrade.edge.Edge._cached_pairs', mocker.PropertyMock( |
| 130 | return_value={ |
| 131 | 'NEO/BTC': PairInfo(-0.20, 0.66, 3.71, 0.50, 1.71, 10, 25), |
| 132 | 'LTC/BTC': PairInfo(-0.21, 0.66, 3.71, 0.50, 1.71, 11, 20), |
| 133 | } |
| 134 | )) |
| 135 | mocker.patch('freqtrade.edge.Edge.calculate', MagicMock(return_value=True)) |
| 136 | |
| 137 | |
| 138 | def get_patched_edge(mocker, config) -> Edge: |
| 139 | patch_edge(mocker) |
| 140 | edge = Edge(config) |
| 141 | return edge |
| 142 | |
| 143 | # Functions for recurrent object patching |
| 144 | |
| 145 | |
| 146 | def patch_freqtradebot(mocker, config) -> None: |
| 147 | """ |
| 148 | This function patch _init_modules() to not call dependencies |
| 149 | :param mocker: a Mocker object to apply patches |
| 150 | :param config: Config to pass to the bot |
| 151 | :return: None |
| 152 | """ |
| 153 | mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock()) |
| 154 | init_db(config['db_url']) |
| 155 | patch_exchange(mocker) |
| 156 | mocker.patch('freqtrade.freqtradebot.RPCManager._init', MagicMock()) |
| 157 | mocker.patch('freqtrade.freqtradebot.RPCManager.send_msg', MagicMock()) |
| 158 | patch_whitelist(mocker, config) |
| 159 | |
| 160 | |
| 161 | def get_patched_freqtradebot(mocker, config) -> FreqtradeBot: |
| 162 | """ |
| 163 | This function patches _init_modules() to not call dependencies |
| 164 | :param mocker: a Mocker object to apply patches |
| 165 | :param config: Config to pass to the bot |
| 166 | :return: FreqtradeBot |
| 167 | """ |
| 168 | patch_freqtradebot(mocker, config) |
| 169 | config['datadir'] = Path(config['datadir']) |
| 170 | return FreqtradeBot(config) |
| 171 | |
| 172 | |
| 173 | def get_patched_worker(mocker, config) -> Worker: |
| 174 | """ |
| 175 | This function patches _init_modules() to not call dependencies |
| 176 | :param mocker: a Mocker object to apply patches |
| 177 | :param config: Config to pass to the bot |
| 178 | :return: Worker |
| 179 | """ |
| 180 | patch_freqtradebot(mocker, config) |
| 181 | return Worker(args=None, config=config) |
| 182 | |
| 183 | |
| 184 | def patch_get_signal(freqtrade: FreqtradeBot, value=(True, False)) -> None: |
| 185 | """ |
| 186 | :param mocker: mocker to patch IStrategy class |
| 187 | :param value: which value IStrategy.get_signal() must return |
| 188 | :return: None |
| 189 | """ |
| 190 | freqtrade.strategy.get_signal = lambda e, s, x: value |
| 191 | freqtrade.exchange.refresh_latest_ohlcv = lambda p: None |
| 192 | |
| 193 | |
| 194 | def create_mock_trades(fee, use_db: bool = True): |
| 195 | """ |
| 196 | Create some fake trades ... |
| 197 | """ |
| 198 | def add_trade(trade): |
| 199 | if use_db: |
| 200 | Trade.query.session.add(trade) |
| 201 | else: |
| 202 | LocalTrade.add_bt_trade(trade) |
| 203 | |
| 204 | # Simulate dry_run entries |
| 205 | trade = mock_trade_1(fee) |
| 206 | add_trade(trade) |
| 207 | |
| 208 | trade = mock_trade_2(fee) |
| 209 | add_trade(trade) |
| 210 | |
| 211 | trade = mock_trade_3(fee) |
| 212 | add_trade(trade) |
| 213 | |
| 214 | trade = mock_trade_4(fee) |
| 215 | add_trade(trade) |
| 216 | |
| 217 | trade = mock_trade_5(fee) |
| 218 | add_trade(trade) |
| 219 | |
| 220 | trade = mock_trade_6(fee) |
| 221 | add_trade(trade) |
| 222 | |
| 223 | if use_db: |
| 224 | Trade.query.session.flush() |
| 225 | |
| 226 | |
| 227 | @pytest.fixture(autouse=True) |
| 228 | def patch_coingekko(mocker) -> None: |
| 229 | """ |
| 230 | Mocker to coingekko to speed up tests |
| 231 | :param mocker: mocker to patch coingekko class |
| 232 | :return: None |
| 233 | """ |
| 234 | |
| 235 | tickermock = MagicMock(return_value={'bitcoin': {'usd': 12345.0}, 'ethereum': {'usd': 12345.0}}) |
| 236 | listmock = MagicMock(return_value=[{'id': 'bitcoin', 'name': 'Bitcoin', 'symbol': 'btc', |
| 237 | 'website_slug': 'bitcoin'}, |
| 238 | {'id': 'ethereum', 'name': 'Ethereum', 'symbol': 'eth', |
| 239 | 'website_slug': 'ethereum'} |
| 240 | ]) |
| 241 | mocker.patch.multiple( |
| 242 | 'freqtrade.rpc.fiat_convert.CoinGeckoAPI', |
| 243 | get_price=tickermock, |
| 244 | get_coins_list=listmock, |
| 245 | |
| 246 | ) |
| 247 | |
| 248 | |
| 249 | @pytest.fixture(scope='function') |
| 250 | def init_persistence(default_conf): |
| 251 | init_db(default_conf['db_url'], default_conf['dry_run']) |
| 252 | |
| 253 | |
| 254 | @pytest.fixture(scope="function") |
| 255 | def default_conf(testdatadir): |
| 256 | return get_default_conf(testdatadir) |
| 257 | |
| 258 | |
| 259 | def get_default_conf(testdatadir): |
| 260 | """ Returns validated configuration suitable for most tests """ |
| 261 | configuration = { |
| 262 | "max_open_trades": 1, |
| 263 | "stake_currency": "BTC", |
| 264 | "stake_amount": 0.001, |
| 265 | "fiat_display_currency": "USD", |
| 266 | "timeframe": '5m', |
| 267 | "dry_run": True, |
| 268 | "cancel_open_orders_on_exit": False, |
| 269 | "minimal_roi": { |
| 270 | "40": 0.0, |
| 271 | "30": 0.01, |
| 272 | "20": 0.02, |
| 273 | "0": 0.04 |
| 274 | }, |
| 275 | "dry_run_wallet": 1000, |
| 276 | "stoploss": -0.10, |
| 277 | "unfilledtimeout": { |
| 278 | "buy": 10, |
| 279 | "sell": 30 |
| 280 | }, |
| 281 | "bid_strategy": { |
| 282 | "ask_last_balance": 0.0, |
| 283 | "use_order_book": False, |
| 284 | "order_book_top": 1, |
| 285 | "check_depth_of_market": { |
| 286 | "enabled": False, |
| 287 | "bids_to_ask_delta": 1 |
| 288 | } |
| 289 | }, |
| 290 | "ask_strategy": { |
| 291 | "use_order_book": False, |
| 292 | "order_book_min": 1, |
| 293 | "order_book_max": 1 |
| 294 | }, |
| 295 | "exchange": { |
| 296 | "name": "binance", |
| 297 | "enabled": True, |
| 298 | "key": "key", |
| 299 | "secret": "secret", |
| 300 | "pair_whitelist": [ |
| 301 | "ETH/BTC", |
| 302 | "LTC/BTC", |
| 303 | "XRP/BTC", |
| 304 | "NEO/BTC" |
| 305 | ], |
| 306 | "pair_blacklist": [ |
| 307 | "DOGE/BTC", |
| 308 | "HOT/BTC", |
| 309 | ] |
| 310 | }, |
| 311 | "pairlists": [ |
| 312 | {"method": "StaticPairList"} |
| 313 | ], |
| 314 | "telegram": { |
| 315 | "enabled": True, |
| 316 | "token": "token", |
| 317 | "chat_id": "0", |
| 318 | "notification_settings": {}, |
| 319 | }, |
| 320 | "datadir": str(testdatadir), |
| 321 | "initial_state": "running", |
| 322 | "db_url": "sqlite://", |
| 323 | "user_data_dir": Path("user_data"), |
| 324 | "verbosity": 3, |
| 325 | "strategy_path": str(Path(__file__).parent / "strategy" / "strats"), |
| 326 | "strategy": "DefaultStrategy", |
| 327 | "internals": {}, |
| 328 | } |
| 329 | return configuration |
| 330 | |
| 331 | |
| 332 | @pytest.fixture |
| 333 | def update(): |
| 334 | _update = Update(0) |
| 335 | _update.message = Message(0, datetime.utcnow(), Chat(0, 0)) |
| 336 | return _update |
| 337 | |
| 338 | |
| 339 | @pytest.fixture |
| 340 | def fee(): |
| 341 | return MagicMock(return_value=0.0025) |
| 342 | |
| 343 | |
| 344 | @pytest.fixture |
| 345 | def ticker(): |
| 346 | return MagicMock(return_value={ |
| 347 | 'bid': 0.00001098, |
| 348 | 'ask': 0.00001099, |
| 349 | 'last': 0.00001098, |
| 350 | }) |
| 351 | |
| 352 | |
| 353 | @pytest.fixture |
| 354 | def ticker_sell_up(): |
| 355 | return MagicMock(return_value={ |
| 356 | 'bid': 0.00001172, |
| 357 | 'ask': 0.00001173, |
| 358 | 'last': 0.00001172, |
| 359 | }) |
| 360 | |
| 361 | |
| 362 | @pytest.fixture |
| 363 | def ticker_sell_down(): |
| 364 | return MagicMock(return_value={ |
| 365 | 'bid': 0.00001044, |
| 366 | 'ask': 0.00001043, |
| 367 | 'last': 0.00001044, |
| 368 | }) |
| 369 | |
| 370 | |
| 371 | @pytest.fixture |
| 372 | def markets(): |
| 373 | return get_markets() |
| 374 | |
| 375 | |
| 376 | def get_markets(): |
| 377 | return { |
| 378 | 'ETH/BTC': { |
| 379 | 'id': 'ethbtc', |
| 380 | 'symbol': 'ETH/BTC', |
| 381 | 'base': 'ETH', |
| 382 | 'quote': 'BTC', |
| 383 | 'active': True, |
| 384 | 'precision': { |
| 385 | 'price': 8, |
| 386 | 'amount': 8, |
| 387 | 'cost': 8, |
| 388 | }, |
| 389 | 'lot': 0.00000001, |
| 390 | 'limits': { |
| 391 | 'amount': { |
| 392 | 'min': 0.01, |
| 393 | 'max': 1000, |
| 394 | }, |
| 395 | 'price': 500000, |
| 396 | 'cost': { |
| 397 | 'min': 0.0001, |
| 398 | 'max': 500000, |
| 399 | }, |
| 400 | }, |
| 401 | 'info': {}, |
| 402 | }, |
| 403 | 'TKN/BTC': { |
| 404 | 'id': 'tknbtc', |
| 405 | 'symbol': 'TKN/BTC', |
| 406 | 'base': 'TKN', |
| 407 | 'quote': 'BTC', |
| 408 | # According to ccxt, markets without active item set are also active |
| 409 | # 'active': True, |
| 410 | 'precision': { |
| 411 | 'price': 8, |
| 412 | 'amount': 8, |
| 413 | 'cost': 8, |
| 414 | }, |
| 415 | 'lot': 0.00000001, |
| 416 | 'limits': { |
| 417 | 'amount': { |
| 418 | 'min': 0.01, |
| 419 | 'max': 1000, |
| 420 | }, |
| 421 | 'price': 500000, |
| 422 | 'cost': { |
| 423 | 'min': 0.0001, |
| 424 | 'max': 500000, |
| 425 | }, |
| 426 | }, |
| 427 | 'info': {}, |
| 428 | }, |
| 429 | 'BLK/BTC': { |
| 430 | 'id': 'blkbtc', |
| 431 | 'symbol': 'BLK/BTC', |
| 432 | 'base': 'BLK', |
| 433 | 'quote': 'BTC', |
| 434 | 'active': True, |
| 435 | 'precision': { |
| 436 | 'price': 8, |
| 437 | 'amount': 8, |
| 438 | 'cost': 8, |
| 439 | }, |
| 440 | 'lot': 0.00000001, |
| 441 | 'limits': { |
| 442 | 'amount': { |
| 443 | 'min': 0.01, |
| 444 | 'max': 1000, |
| 445 | }, |
| 446 | 'price': 500000, |
| 447 | 'cost': { |
| 448 | 'min': 0.0001, |
| 449 | 'max': 500000, |
| 450 | }, |
| 451 | }, |
| 452 | 'info': {}, |
| 453 | }, |
| 454 | 'LTC/BTC': { |
| 455 | 'id': 'ltcbtc', |
| 456 | 'symbol': 'LTC/BTC', |
| 457 | 'base': 'LTC', |
| 458 | 'quote': 'BTC', |
| 459 | 'active': True, |
| 460 | 'precision': { |
| 461 | 'price': 8, |
| 462 | 'amount': 8, |
| 463 | 'cost': 8, |
| 464 | }, |
| 465 | 'lot': 0.00000001, |
| 466 | 'limits': { |
| 467 | 'amount': { |
| 468 | 'min': 0.01, |
| 469 | 'max': 1000, |
| 470 | }, |
| 471 | 'price': 500000, |
| 472 | 'cost': { |
| 473 | 'min': 0.0001, |
| 474 | 'max': 500000, |
| 475 | }, |
| 476 | }, |
| 477 | 'info': {}, |
| 478 | }, |
| 479 | 'XRP/BTC': { |
| 480 | 'id': 'xrpbtc', |
| 481 | 'symbol': 'XRP/BTC', |
| 482 | 'base': 'XRP', |
| 483 | 'quote': 'BTC', |
| 484 | 'active': True, |
| 485 | 'precision': { |
| 486 | 'price': 8, |
| 487 | 'amount': 8, |
| 488 | 'cost': 8, |
| 489 | }, |
| 490 | 'lot': 0.00000001, |
| 491 | 'limits': { |
| 492 | 'amount': { |
| 493 | 'min': 0.01, |
| 494 | 'max': 1000, |
| 495 | }, |
| 496 | 'price': 500000, |
| 497 | 'cost': { |
| 498 | 'min': 0.0001, |
| 499 | 'max': 500000, |
| 500 | }, |
| 501 | }, |
| 502 | 'info': {}, |
| 503 | }, |
| 504 | 'NEO/BTC': { |
| 505 | 'id': 'neobtc', |
| 506 | 'symbol': 'NEO/BTC', |
| 507 | 'base': 'NEO', |
| 508 | 'quote': 'BTC', |
| 509 | 'active': True, |
| 510 | 'precision': { |
| 511 | 'price': 8, |
| 512 | 'amount': 8, |
| 513 | 'cost': 8, |
| 514 | }, |
| 515 | 'lot': 0.00000001, |
| 516 | 'limits': { |
| 517 | 'amount': { |
| 518 | 'min': 0.01, |
| 519 | 'max': 1000, |
| 520 | }, |
| 521 | 'price': 500000, |
| 522 | 'cost': { |
| 523 | 'min': 0.0001, |
| 524 | 'max': 500000, |
| 525 | }, |
| 526 | }, |
| 527 | 'info': {}, |
| 528 | }, |
| 529 | 'BTT/BTC': { |
| 530 | 'id': 'BTTBTC', |
| 531 | 'symbol': 'BTT/BTC', |
| 532 | 'base': 'BTT', |
| 533 | 'quote': 'BTC', |
| 534 | 'active': False, |
| 535 | 'precision': { |
| 536 | 'base': 8, |
| 537 | 'quote': 8, |
| 538 | 'amount': 0, |
| 539 | 'price': 8 |
| 540 | }, |
| 541 | 'limits': { |
| 542 | 'amount': { |
| 543 | 'min': 1.0, |
| 544 | 'max': 90000000.0 |
| 545 | }, |
| 546 | 'price': { |
| 547 | 'min': None, |
| 548 | 'max': None |
| 549 | }, |
| 550 | 'cost': { |
| 551 | 'min': 0.0001, |
| 552 | 'max': None |
| 553 | } |
| 554 | }, |
| 555 | 'info': {}, |
| 556 | }, |
| 557 | 'ETH/USDT': { |
| 558 | 'id': 'USDT-ETH', |
| 559 | 'symbol': 'ETH/USDT', |
| 560 | 'base': 'ETH', |
| 561 | 'quote': 'USDT', |
| 562 | 'precision': { |
| 563 | 'amount': 8, |
| 564 | 'price': 8 |
| 565 | }, |
| 566 | 'limits': { |
| 567 | 'amount': { |
| 568 | 'min': 0.02214286, |
| 569 | 'max': None |
| 570 | }, |
| 571 | 'price': { |
| 572 | 'min': 1e-08, |
| 573 | 'max': None |
| 574 | } |
| 575 | }, |
| 576 | 'active': True, |
| 577 | 'info': {}, |
| 578 | }, |
| 579 | 'LTC/USDT': { |
| 580 | 'id': 'USDT-LTC', |
| 581 | 'symbol': 'LTC/USDT', |
| 582 | 'base': 'LTC', |
| 583 | 'quote': 'USDT', |
| 584 | 'active': False, |
| 585 | 'precision': { |
| 586 | 'amount': 8, |
| 587 | 'price': 8 |
| 588 | }, |
| 589 | 'limits': { |
| 590 | 'amount': { |
| 591 | 'min': 0.06646786, |
| 592 | 'max': None |
| 593 | }, |
| 594 | 'price': { |
| 595 | 'min': 1e-08, |
| 596 | 'max': None |
| 597 | } |
| 598 | }, |
| 599 | 'info': {}, |
| 600 | }, |
| 601 | 'LTC/USD': { |
| 602 | 'id': 'USD-LTC', |
| 603 | 'symbol': 'LTC/USD', |
| 604 | 'base': 'LTC', |
| 605 | 'quote': 'USD', |
| 606 | 'active': True, |
| 607 | 'precision': { |
| 608 | 'amount': 8, |
| 609 | 'price': 8 |
| 610 | }, |
| 611 | 'limits': { |
| 612 | 'amount': { |
| 613 | 'min': 0.06646786, |
| 614 | 'max': None |
| 615 | }, |
| 616 | 'price': { |
| 617 | 'min': 1e-08, |
| 618 | 'max': None |
| 619 | } |
| 620 | }, |
| 621 | 'info': {}, |
| 622 | }, |
| 623 | 'XLTCUSDT': { |
| 624 | 'id': 'xLTCUSDT', |
| 625 | 'symbol': 'XLTCUSDT', |
| 626 | 'base': 'LTC', |
| 627 | 'quote': 'USDT', |
| 628 | 'active': True, |
| 629 | 'precision': { |
| 630 | 'amount': 8, |
| 631 | 'price': 8 |
| 632 | }, |
| 633 | 'limits': { |
| 634 | 'amount': { |
| 635 | 'min': 0.06646786, |
| 636 | 'max': None |
| 637 | }, |
| 638 | 'price': { |
| 639 | 'min': 1e-08, |
| 640 | 'max': None |
| 641 | } |
| 642 | }, |
| 643 | 'info': {}, |
| 644 | }, |
| 645 | 'LTC/ETH': { |
| 646 | 'id': 'LTCETH', |
| 647 | 'symbol': 'LTC/ETH', |
| 648 | 'base': 'LTC', |
| 649 | 'quote': 'ETH', |
| 650 | 'active': True, |
| 651 | 'precision': { |
| 652 | 'base': 8, |
| 653 | 'quote': 8, |
| 654 | 'amount': 3, |
| 655 | 'price': 5 |
| 656 | }, |
| 657 | 'limits': { |
| 658 | 'amount': { |
| 659 | 'min': 0.001, |
| 660 | 'max': 10000000.0 |
| 661 | }, |
| 662 | 'price': { |
| 663 | 'min': 1e-05, |
| 664 | 'max': 1000.0 |
| 665 | }, |
| 666 | 'cost': { |
| 667 | 'min': 0.01, |
| 668 | 'max': None |
| 669 | } |
| 670 | }, |
| 671 | }, |
| 672 | } |
| 673 | |
| 674 | |
| 675 | @pytest.fixture |
| 676 | def shitcoinmarkets(markets): |
| 677 | """ |
| 678 | Fixture with shitcoin markets - used to test filters in pairlists |
| 679 | """ |
| 680 | shitmarkets = deepcopy(markets) |
| 681 | shitmarkets.update({ |
| 682 | 'HOT/BTC': { |
| 683 | 'id': 'HOTBTC', |
| 684 | 'symbol': 'HOT/BTC', |
| 685 | 'base': 'HOT', |
| 686 | 'quote': 'BTC', |
| 687 | 'active': True, |
| 688 | 'precision': { |
| 689 | 'base': 8, |
| 690 | 'quote': 8, |
| 691 | 'amount': 0, |
| 692 | 'price': 8 |
| 693 | }, |
| 694 | 'limits': { |
| 695 | 'amount': { |
| 696 | 'min': 1.0, |
| 697 | 'max': 90000000.0 |
| 698 | }, |
| 699 | 'price': { |
| 700 | 'min': None, |
| 701 | 'max': None |
| 702 | }, |
| 703 | 'cost': { |
| 704 | 'min': 0.001, |
| 705 | 'max': None |
| 706 | } |
| 707 | }, |
| 708 | 'info': {}, |
| 709 | }, |
| 710 | 'FUEL/BTC': { |
| 711 | 'id': 'FUELBTC', |
| 712 | 'symbol': 'FUEL/BTC', |
| 713 | 'base': 'FUEL', |
| 714 | 'quote': 'BTC', |
| 715 | 'active': True, |
| 716 | 'precision': { |
| 717 | 'base': 8, |
| 718 | 'quote': 8, |
| 719 | 'amount': 0, |
| 720 | 'price': 8 |
| 721 | }, |
| 722 | 'limits': { |
| 723 | 'amount': { |
| 724 | 'min': 1.0, |
| 725 | 'max': 90000000.0 |
| 726 | }, |
| 727 | 'price': { |
| 728 | 'min': 1e-08, |
| 729 | 'max': 1000.0 |
| 730 | }, |
| 731 | 'cost': { |
| 732 | 'min': 0.001, |
| 733 | 'max': None |
| 734 | } |
| 735 | }, |
| 736 | 'info': {}, |
| 737 | }, |
| 738 | 'NANO/USDT': { |
| 739 | "percentage": True, |
| 740 | "tierBased": False, |
| 741 | "taker": 0.001, |
| 742 | "maker": 0.001, |
| 743 | "precision": { |
| 744 | "base": 8, |
| 745 | "quote": 8, |
| 746 | "amount": 2, |
| 747 | "price": 4 |
| 748 | }, |
| 749 | "limits": { |
| 750 | }, |
| 751 | "id": "NANOUSDT", |
| 752 | "symbol": "NANO/USDT", |
| 753 | "base": "NANO", |
| 754 | "quote": "USDT", |
| 755 | "baseId": "NANO", |
| 756 | "quoteId": "USDT", |
| 757 | "info": {}, |
| 758 | "type": "spot", |
| 759 | "spot": True, |
| 760 | "future": False, |
| 761 | "active": True |
| 762 | }, |
| 763 | 'ADAHALF/USDT': { |
| 764 | "percentage": True, |
| 765 | "tierBased": False, |
| 766 | "taker": 0.001, |
| 767 | "maker": 0.001, |
| 768 | "precision": { |
| 769 | "base": 8, |
| 770 | "quote": 8, |
| 771 | "amount": 2, |
| 772 | "price": 4 |
| 773 | }, |
| 774 | "limits": { |
| 775 | }, |
| 776 | "id": "ADAHALFUSDT", |
| 777 | "symbol": "ADAHALF/USDT", |
| 778 | "base": "ADAHALF", |
| 779 | "quote": "USDT", |
| 780 | "baseId": "ADAHALF", |
| 781 | "quoteId": "USDT", |
| 782 | "info": {}, |
| 783 | "type": "spot", |
| 784 | "spot": True, |
| 785 | "future": False, |
| 786 | "active": True |
| 787 | }, |
| 788 | 'ADADOUBLE/USDT': { |
| 789 | "percentage": True, |
| 790 | "tierBased": False, |
| 791 | "taker": 0.001, |
| 792 | "maker": 0.001, |
| 793 | "precision": { |
| 794 | "base": 8, |
| 795 | "quote": 8, |
| 796 | "amount": 2, |
| 797 | "price": 4 |
| 798 | }, |
| 799 | "limits": { |
| 800 | }, |
| 801 | "id": "ADADOUBLEUSDT", |
| 802 | "symbol": "ADADOUBLE/USDT", |
| 803 | "base": "ADADOUBLE", |
| 804 | "quote": "USDT", |
| 805 | "baseId": "ADADOUBLE", |
| 806 | "quoteId": "USDT", |
| 807 | "info": {}, |
| 808 | "type": "spot", |
| 809 | "spot": True, |
| 810 | "future": False, |
| 811 | "active": True |
| 812 | }, |
| 813 | }) |
| 814 | return shitmarkets |
| 815 | |
| 816 | |
| 817 | @pytest.fixture |
| 818 | def markets_empty(): |
| 819 | return MagicMock(return_value=[]) |
| 820 | |
| 821 | |
| 822 | @pytest.fixture(scope='function') |
| 823 | def limit_buy_order_open(): |
| 824 | return { |
| 825 | 'id': 'mocked_limit_buy', |
| 826 | 'type': 'limit', |
| 827 | 'side': 'buy', |
| 828 | 'symbol': 'mocked', |
| 829 | 'datetime': arrow.utcnow().isoformat(), |
| 830 | 'timestamp': arrow.utcnow().int_timestamp, |
| 831 | 'price': 0.00001099, |
| 832 | 'amount': 90.99181073, |
| 833 | 'filled': 0.0, |
| 834 | 'cost': 0.0009999, |
| 835 | 'remaining': 90.99181073, |
| 836 | 'status': 'open' |
| 837 | } |
| 838 | |
| 839 | |
| 840 | @pytest.fixture(scope='function') |
| 841 | def limit_buy_order(limit_buy_order_open): |
| 842 | order = deepcopy(limit_buy_order_open) |
| 843 | order['status'] = 'closed' |
| 844 | order['filled'] = order['amount'] |
| 845 | order['remaining'] = 0.0 |
| 846 | return order |
| 847 | |
| 848 | |
| 849 | @pytest.fixture(scope='function') |
| 850 | def market_buy_order(): |
| 851 | return { |
| 852 | 'id': 'mocked_market_buy', |
| 853 | 'type': 'market', |
| 854 | 'side': 'buy', |
| 855 | 'symbol': 'mocked', |
| 856 | 'datetime': arrow.utcnow().isoformat(), |
| 857 | 'price': 0.00004099, |
| 858 | 'amount': 91.99181073, |
| 859 | 'filled': 91.99181073, |
| 860 | 'remaining': 0.0, |
| 861 | 'status': 'closed' |
| 862 | } |
| 863 | |
| 864 | |
| 865 | @pytest.fixture |
| 866 | def market_sell_order(): |
| 867 | return { |
| 868 | 'id': 'mocked_limit_sell', |
| 869 | 'type': 'market', |
| 870 | 'side': 'sell', |
| 871 | 'symbol': 'mocked', |
| 872 | 'datetime': arrow.utcnow().isoformat(), |
| 873 | 'price': 0.00004173, |
| 874 | 'amount': 91.99181073, |
| 875 | 'filled': 91.99181073, |
| 876 | 'remaining': 0.0, |
| 877 | 'status': 'closed' |
| 878 | } |
| 879 | |
| 880 | |
| 881 | @pytest.fixture |
| 882 | def limit_buy_order_old(): |
| 883 | return { |
| 884 | 'id': 'mocked_limit_buy_old', |
| 885 | 'type': 'limit', |
| 886 | 'side': 'buy', |
| 887 | 'symbol': 'mocked', |
| 888 | 'datetime': str(arrow.utcnow().shift(minutes=-601).datetime), |
| 889 | 'price': 0.00001099, |
| 890 | 'amount': 90.99181073, |
| 891 | 'filled': 0.0, |
| 892 | 'remaining': 90.99181073, |
| 893 | 'status': 'open' |
| 894 | } |
| 895 | |
| 896 | |
| 897 | @pytest.fixture |
| 898 | def limit_sell_order_old(): |
| 899 | return { |
| 900 | 'id': 'mocked_limit_sell_old', |
| 901 | 'type': 'limit', |
| 902 | 'side': 'sell', |
| 903 | 'symbol': 'ETH/BTC', |
| 904 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 905 | 'price': 0.00001099, |
| 906 | 'amount': 90.99181073, |
| 907 | 'filled': 0.0, |
| 908 | 'remaining': 90.99181073, |
| 909 | 'status': 'open' |
| 910 | } |
| 911 | |
| 912 | |
| 913 | @pytest.fixture |
| 914 | def limit_buy_order_old_partial(): |
| 915 | return { |
| 916 | 'id': 'mocked_limit_buy_old_partial', |
| 917 | 'type': 'limit', |
| 918 | 'side': 'buy', |
| 919 | 'symbol': 'ETH/BTC', |
| 920 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 921 | 'price': 0.00001099, |
| 922 | 'amount': 90.99181073, |
| 923 | 'filled': 23.0, |
| 924 | 'remaining': 67.99181073, |
| 925 | 'status': 'open' |
| 926 | } |
| 927 | |
| 928 | |
| 929 | @pytest.fixture |
| 930 | def limit_buy_order_old_partial_canceled(limit_buy_order_old_partial): |
| 931 | res = deepcopy(limit_buy_order_old_partial) |
| 932 | res['status'] = 'canceled' |
| 933 | res['fee'] = {'cost': 0.023, 'currency': 'ETH'} |
| 934 | return res |
| 935 | |
| 936 | |
| 937 | @pytest.fixture(scope='function') |
| 938 | def limit_buy_order_canceled_empty(request): |
| 939 | # Indirect fixture |
| 940 | # Documentation: |
| 941 | # https://docs.pytest.org/en/latest/example/parametrize.html#apply-indirect-on-particular-arguments |
| 942 | |
| 943 | exchange_name = request.param |
| 944 | if exchange_name == 'ftx': |
| 945 | return { |
| 946 | 'info': {}, |
| 947 | 'id': '1234512345', |
| 948 | 'clientOrderId': None, |
| 949 | 'timestamp': arrow.utcnow().shift(minutes=-601).int_timestamp, |
| 950 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 951 | 'lastTradeTimestamp': None, |
| 952 | 'symbol': 'LTC/USDT', |
| 953 | 'type': 'limit', |
| 954 | 'side': 'buy', |
| 955 | 'price': 34.3225, |
| 956 | 'amount': 0.55, |
| 957 | 'cost': 0.0, |
| 958 | 'average': None, |
| 959 | 'filled': 0.0, |
| 960 | 'remaining': 0.0, |
| 961 | 'status': 'closed', |
| 962 | 'fee': None, |
| 963 | 'trades': None |
| 964 | } |
| 965 | elif exchange_name == 'kraken': |
| 966 | return { |
| 967 | 'info': {}, |
| 968 | 'id': 'AZNPFF-4AC4N-7MKTAT', |
| 969 | 'clientOrderId': None, |
| 970 | 'timestamp': arrow.utcnow().shift(minutes=-601).int_timestamp, |
| 971 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 972 | 'lastTradeTimestamp': None, |
| 973 | 'status': 'canceled', |
| 974 | 'symbol': 'LTC/USDT', |
| 975 | 'type': 'limit', |
| 976 | 'side': 'buy', |
| 977 | 'price': 34.3225, |
| 978 | 'cost': 0.0, |
| 979 | 'amount': 0.55, |
| 980 | 'filled': 0.0, |
| 981 | 'average': 0.0, |
| 982 | 'remaining': 0.55, |
| 983 | 'fee': {'cost': 0.0, 'rate': None, 'currency': 'USDT'}, |
| 984 | 'trades': [] |
| 985 | } |
| 986 | elif exchange_name == 'binance': |
| 987 | return { |
| 988 | 'info': {}, |
| 989 | 'id': '1234512345', |
| 990 | 'clientOrderId': 'alb1234123', |
| 991 | 'timestamp': arrow.utcnow().shift(minutes=-601).int_timestamp, |
| 992 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 993 | 'lastTradeTimestamp': None, |
| 994 | 'symbol': 'LTC/USDT', |
| 995 | 'type': 'limit', |
| 996 | 'side': 'buy', |
| 997 | 'price': 0.016804, |
| 998 | 'amount': 0.55, |
| 999 | 'cost': 0.0, |
| 1000 | 'average': None, |
| 1001 | 'filled': 0.0, |
| 1002 | 'remaining': 0.55, |
| 1003 | 'status': 'canceled', |
| 1004 | 'fee': None, |
| 1005 | 'trades': None |
| 1006 | } |
| 1007 | else: |
| 1008 | return { |
| 1009 | 'info': {}, |
| 1010 | 'id': '1234512345', |
| 1011 | 'clientOrderId': 'alb1234123', |
| 1012 | 'timestamp': arrow.utcnow().shift(minutes=-601).int_timestamp, |
| 1013 | 'datetime': arrow.utcnow().shift(minutes=-601).isoformat(), |
| 1014 | 'lastTradeTimestamp': None, |
| 1015 | 'symbol': 'LTC/USDT', |
| 1016 | 'type': 'limit', |
| 1017 | 'side': 'buy', |
| 1018 | 'price': 0.016804, |
| 1019 | 'amount': 0.55, |
| 1020 | 'cost': 0.0, |
| 1021 | 'average': None, |
| 1022 | 'filled': 0.0, |
| 1023 | 'remaining': 0.55, |
| 1024 | 'status': 'canceled', |
| 1025 | 'fee': None, |
| 1026 | 'trades': None |
| 1027 | } |
| 1028 | |
| 1029 | |
| 1030 | @pytest.fixture |
| 1031 | def limit_sell_order_open(): |
| 1032 | return { |
| 1033 | 'id': 'mocked_limit_sell', |
| 1034 | 'type': 'limit', |
| 1035 | 'side': 'sell', |
| 1036 | 'pair': 'mocked', |
| 1037 | 'datetime': arrow.utcnow().isoformat(), |
| 1038 | 'timestamp': arrow.utcnow().int_timestamp, |
| 1039 | 'price': 0.00001173, |
| 1040 | 'amount': 90.99181073, |
| 1041 | 'filled': 0.0, |
| 1042 | 'remaining': 90.99181073, |
| 1043 | 'status': 'open' |
| 1044 | } |
| 1045 | |
| 1046 | |
| 1047 | @pytest.fixture |
| 1048 | def limit_sell_order(limit_sell_order_open): |
| 1049 | order = deepcopy(limit_sell_order_open) |
| 1050 | order['remaining'] = 0.0 |
| 1051 | order['filled'] = order['amount'] |
| 1052 | order['status'] = 'closed' |
| 1053 | return order |
| 1054 | |
| 1055 | |
| 1056 | @pytest.fixture |
| 1057 | def order_book_l2(): |
| 1058 | return MagicMock(return_value={ |
| 1059 | 'bids': [ |
| 1060 | [0.043936, 10.442], |
| 1061 | [0.043935, 31.865], |
| 1062 | [0.043933, 11.212], |
| 1063 | [0.043928, 0.088], |
| 1064 | [0.043925, 10.0], |
| 1065 | [0.043921, 10.0], |
| 1066 | [0.04392, 37.64], |
| 1067 | [0.043899, 0.066], |
| 1068 | [0.043885, 0.676], |
| 1069 | [0.04387, 22.758] |
| 1070 | ], |
| 1071 | 'asks': [ |
| 1072 | [0.043949, 0.346], |
| 1073 | [0.04395, 0.608], |
| 1074 | [0.043951, 3.948], |
| 1075 | [0.043954, 0.288], |
| 1076 | [0.043958, 9.277], |
| 1077 | [0.043995, 1.566], |
| 1078 | [0.044, 0.588], |
| 1079 | [0.044002, 0.992], |
| 1080 | [0.044003, 0.095], |
| 1081 | [0.04402, 37.64] |
| 1082 | ], |
| 1083 | 'timestamp': None, |
| 1084 | 'datetime': None, |
| 1085 | 'nonce': 288004540 |
| 1086 | }) |
| 1087 | |
| 1088 | |
| 1089 | @pytest.fixture |
| 1090 | def ohlcv_history_list(): |
| 1091 | return [ |
| 1092 | [ |
| 1093 | 1511686200000, # unix timestamp ms |
| 1094 | 8.794e-05, # open |
| 1095 | 8.948e-05, # high |
| 1096 | 8.794e-05, # low |
| 1097 | 8.88e-05, # close |
| 1098 | 0.0877869, # volume (in quote currency) |
| 1099 | ], |
| 1100 | [ |
| 1101 | 1511686500000, |
| 1102 | 8.88e-05, |
| 1103 | 8.942e-05, |
| 1104 | 8.88e-05, |
| 1105 | 8.893e-05, |
| 1106 | 0.05874751, |
| 1107 | ], |
| 1108 | [ |
| 1109 | 1511686800000, |
| 1110 | 8.891e-05, |
| 1111 | 8.893e-05, |
| 1112 | 8.875e-05, |
| 1113 | 8.877e-05, |
| 1114 | 0.7039405 |
| 1115 | ] |
| 1116 | ] |
| 1117 | |
| 1118 | |
| 1119 | @pytest.fixture |
| 1120 | def ohlcv_history(ohlcv_history_list): |
| 1121 | return ohlcv_to_dataframe(ohlcv_history_list, "5m", pair="UNITTEST/BTC", |
| 1122 | fill_missing=True, drop_incomplete=False) |
| 1123 | |
| 1124 | |
| 1125 | @pytest.fixture |
| 1126 | def tickers(): |
| 1127 | return MagicMock(return_value={ |
| 1128 | 'ETH/BTC': { |
| 1129 | 'symbol': 'ETH/BTC', |
| 1130 | 'timestamp': 1522014806207, |
| 1131 | 'datetime': '2018-03-25T21:53:26.207Z', |
| 1132 | 'high': 0.061697, |
| 1133 | 'low': 0.060531, |
| 1134 | 'bid': 0.061588, |
| 1135 | 'bidVolume': 3.321, |
| 1136 | 'ask': 0.061655, |
| 1137 | 'askVolume': 0.212, |
| 1138 | 'vwap': 0.06105296, |
| 1139 | 'open': 0.060809, |
| 1140 | 'close': 0.060761, |
| 1141 | 'first': None, |
| 1142 | 'last': 0.061588, |
| 1143 | 'change': 1.281, |
| 1144 | 'percentage': None, |
| 1145 | 'average': None, |
| 1146 | 'baseVolume': 111649.001, |
| 1147 | 'quoteVolume': 6816.50176926, |
| 1148 | 'info': {} |
| 1149 | }, |
| 1150 | 'TKN/BTC': { |
| 1151 | 'symbol': 'TKN/BTC', |
| 1152 | 'timestamp': 1522014806169, |
| 1153 | 'datetime': '2018-03-25T21:53:26.169Z', |
| 1154 | 'high': 0.01885, |
| 1155 | 'low': 0.018497, |
| 1156 | 'bid': 0.018799, |
| 1157 | 'bidVolume': 8.38, |
| 1158 | 'ask': 0.018802, |
| 1159 | 'askVolume': 15.0, |
| 1160 | 'vwap': 0.01869197, |
| 1161 | 'open': 0.018585, |
| 1162 | 'close': 0.018573, |
| 1163 | 'last': 0.018799, |
| 1164 | 'baseVolume': 81058.66, |
| 1165 | 'quoteVolume': 2247.48374509, |
| 1166 | }, |
| 1167 | 'BLK/BTC': { |
| 1168 | 'symbol': 'BLK/BTC', |
| 1169 | 'timestamp': 1522014806072, |
| 1170 | 'datetime': '2018-03-25T21:53:26.720Z', |
| 1171 | 'high': 0.007745, |
| 1172 | 'low': 0.007512, |
| 1173 | 'bid': 0.007729, |
| 1174 | 'bidVolume': 0.01, |
| 1175 | 'ask': 0.007743, |
| 1176 | 'askVolume': 21.37, |
| 1177 | 'vwap': 0.00761466, |
| 1178 | 'open': 0.007653, |
| 1179 | 'close': 0.007652, |
| 1180 | 'first': None, |
| 1181 | 'last': 0.007743, |
| 1182 | 'change': 1.176, |
| 1183 | 'percentage': None, |
| 1184 | 'average': None, |
| 1185 | 'baseVolume': 295152.26, |
| 1186 | 'quoteVolume': 1515.14631229, |
| 1187 | 'info': {} |
| 1188 | }, |
| 1189 | 'LTC/BTC': { |
| 1190 | 'symbol': 'LTC/BTC', |
| 1191 | 'timestamp': 1523787258992, |
| 1192 | 'datetime': '2018-04-15T10:14:19.992Z', |
| 1193 | 'high': 0.015978, |
| 1194 | 'low': 0.0157, |
| 1195 | 'bid': 0.015954, |
| 1196 | 'bidVolume': 12.83, |
| 1197 | 'ask': 0.015957, |
| 1198 | 'askVolume': 0.49, |
| 1199 | 'vwap': 0.01581636, |
| 1200 | 'open': 0.015823, |
| 1201 | 'close': 0.01582, |
| 1202 | 'first': None, |
| 1203 | 'last': 0.015951, |
| 1204 | 'change': 0.809, |
| 1205 | 'percentage': None, |
| 1206 | 'average': None, |
| 1207 | 'baseVolume': 88620.68, |
| 1208 | 'quoteVolume': 1401.65697943, |
| 1209 | 'info': {} |
| 1210 | }, |
| 1211 | 'BTT/BTC': { |
| 1212 | 'symbol': 'BTT/BTC', |
| 1213 | 'timestamp': 1550936557206, |
| 1214 | 'datetime': '2019-02-23T15:42:37.206Z', |
| 1215 | 'high': 0.00000026, |
| 1216 | 'low': 0.00000024, |
| 1217 | 'bid': 0.00000024, |
| 1218 | 'bidVolume': 2446894197.0, |
| 1219 | 'ask': 0.00000025, |
| 1220 | 'askVolume': 2447913837.0, |
| 1221 | 'vwap': 0.00000025, |
| 1222 | 'open': 0.00000026, |
| 1223 | 'close': 0.00000024, |
| 1224 | 'last': 0.00000024, |
| 1225 | 'previousClose': 0.00000026, |
| 1226 | 'change': -0.00000002, |
| 1227 | 'percentage': -7.692, |
| 1228 | 'average': None, |
| 1229 | 'baseVolume': 4886464537.0, |
| 1230 | 'quoteVolume': 1215.14489611, |
| 1231 | 'info': {} |
| 1232 | }, |
| 1233 | 'HOT/BTC': { |
| 1234 | 'symbol': 'HOT/BTC', |
| 1235 | 'timestamp': 1572273518661, |
| 1236 | 'datetime': '2019-10-28T14:38:38.661Z', |
| 1237 | 'high': 0.00000011, |
| 1238 | 'low': 0.00000009, |
| 1239 | 'bid': 0.0000001, |
| 1240 | 'bidVolume': 1476027288.0, |
| 1241 | 'ask': 0.00000011, |
| 1242 | 'askVolume': 820153831.0, |
| 1243 | 'vwap': 0.0000001, |
| 1244 | 'open': 0.00000009, |
| 1245 | 'close': 0.00000011, |
| 1246 | 'last': 0.00000011, |
| 1247 | 'previousClose': 0.00000009, |
| 1248 | 'change': 0.00000002, |
| 1249 | 'percentage': 22.222, |
| 1250 | 'average': None, |
| 1251 | 'baseVolume': 1442290324.0, |
| 1252 | 'quoteVolume': 143.78311994, |
| 1253 | 'info': {} |
| 1254 | }, |
| 1255 | 'FUEL/BTC': { |
| 1256 | 'symbol': 'FUEL/BTC', |
| 1257 | 'timestamp': 1572340250771, |
| 1258 | 'datetime': '2019-10-29T09:10:50.771Z', |
| 1259 | 'high': 0.00000040, |
| 1260 | 'low': 0.00000035, |
| 1261 | 'bid': 0.00000036, |
| 1262 | 'bidVolume': 8932318.0, |
| 1263 | 'ask': 0.00000037, |
| 1264 | 'askVolume': 10140774.0, |
| 1265 | 'vwap': 0.00000037, |
| 1266 | 'open': 0.00000039, |
| 1267 | 'close': 0.00000037, |
| 1268 | 'last': 0.00000037, |
| 1269 | 'previousClose': 0.00000038, |
| 1270 | 'change': -0.00000002, |
| 1271 | 'percentage': -5.128, |
| 1272 | 'average': None, |
| 1273 | 'baseVolume': 168927742.0, |
| 1274 | 'quoteVolume': 62.68220262, |
| 1275 | 'info': {} |
| 1276 | }, |
| 1277 | 'BTC/USDT': { |
| 1278 | 'symbol': 'BTC/USDT', |
| 1279 | 'timestamp': 1573758371399, |
| 1280 | 'datetime': '2019-11-14T19:06:11.399Z', |
| 1281 | 'high': 8800.0, |
| 1282 | 'low': 8582.6, |
| 1283 | 'bid': 8648.16, |
| 1284 | 'bidVolume': 0.238771, |
| 1285 | 'ask': 8648.72, |
| 1286 | 'askVolume': 0.016253, |
| 1287 | 'vwap': 8683.13647806, |
| 1288 | 'open': 8759.7, |
| 1289 | 'close': 8648.72, |
| 1290 | 'last': 8648.72, |
| 1291 | 'previousClose': 8759.67, |
| 1292 | 'change': -110.98, |
| 1293 | 'percentage': -1.267, |
| 1294 | 'average': None, |
| 1295 | 'baseVolume': 35025.943355, |
| 1296 | 'quoteVolume': 304135046.4242901, |
| 1297 | 'info': {} |
| 1298 | }, |
| 1299 | 'ETH/USDT': { |
| 1300 | 'symbol': 'ETH/USDT', |
| 1301 | 'timestamp': 1522014804118, |
| 1302 | 'datetime': '2018-03-25T21:53:24.118Z', |
| 1303 | 'high': 530.88, |
| 1304 | 'low': 512.0, |
| 1305 | 'bid': 529.73, |
| 1306 | 'bidVolume': 0.2, |
| 1307 | 'ask': 530.21, |
| 1308 | 'askVolume': 0.2464, |
| 1309 | 'vwap': 521.02438405, |
| 1310 | 'open': 527.27, |
| 1311 | 'close': 528.42, |
| 1312 | 'first': None, |
| 1313 | 'last': 530.21, |
| 1314 | 'change': 0.558, |
| 1315 | 'percentage': None, |
| 1316 | 'average': None, |
| 1317 | 'baseVolume': 72300.0659, |
| 1318 | 'quoteVolume': 37670097.3022171, |
| 1319 | 'info': {} |
| 1320 | }, |
| 1321 | 'TKN/USDT': { |
| 1322 | 'symbol': 'TKN/USDT', |
| 1323 | 'timestamp': 1522014806198, |
| 1324 | 'datetime': '2018-03-25T21:53:26.198Z', |
| 1325 | 'high': 8718.0, |
| 1326 | 'low': 8365.77, |
| 1327 | 'bid': 8603.64, |
| 1328 | 'bidVolume': 0.15846, |
| 1329 | 'ask': 8603.67, |
| 1330 | 'askVolume': 0.069147, |
| 1331 | 'vwap': 8536.35621697, |
| 1332 | 'open': 8680.0, |
| 1333 | 'close': 8680.0, |
| 1334 | 'first': None, |
| 1335 | 'last': 8603.67, |
| 1336 | 'change': -0.879, |
| 1337 | 'percentage': None, |
| 1338 | 'average': None, |
| 1339 | 'baseVolume': 30414.604298, |
| 1340 | 'quoteVolume': 259629896.48584127, |
| 1341 | 'info': {} |
| 1342 | }, |
| 1343 | 'BLK/USDT': { |
| 1344 | 'symbol': 'BLK/USDT', |
| 1345 | 'timestamp': 1522014806145, |
| 1346 | 'datetime': '2018-03-25T21:53:26.145Z', |
| 1347 | 'high': 66.95, |
| 1348 | 'low': 63.38, |
| 1349 | 'bid': 66.473, |
| 1350 | 'bidVolume': 4.968, |
| 1351 | 'ask': 66.54, |
| 1352 | 'askVolume': 2.704, |
| 1353 | 'vwap': 65.0526901, |
| 1354 | 'open': 66.43, |
| 1355 | 'close': 66.383, |
| 1356 | 'first': None, |
| 1357 | 'last': 66.5, |
| 1358 | 'change': 0.105, |
| 1359 | 'percentage': None, |
| 1360 | 'average': None, |
| 1361 | 'baseVolume': 294106.204, |
| 1362 | 'quoteVolume': 19132399.743954, |
| 1363 | 'info': {} |
| 1364 | }, |
| 1365 | 'LTC/USDT': { |
| 1366 | 'symbol': 'LTC/USDT', |
| 1367 | 'timestamp': 1523787257812, |
| 1368 | 'datetime': '2018-04-15T10:14:18.812Z', |
| 1369 | 'high': 129.94, |
| 1370 | 'low': 124.0, |
| 1371 | 'bid': 129.28, |
| 1372 | 'bidVolume': 0.03201, |
| 1373 | 'ask': 129.52, |
| 1374 | 'askVolume': 0.14529, |
| 1375 | 'vwap': 126.92838682, |
| 1376 | 'open': 127.0, |
| 1377 | 'close': 127.1, |
| 1378 | 'first': None, |
| 1379 | 'last': 129.28, |
| 1380 | 'change': 1.795, |
| 1381 | 'percentage': None, |
| 1382 | 'average': None, |
| 1383 | 'baseVolume': 59698.79897, |
| 1384 | 'quoteVolume': 29132399.743954, |
| 1385 | 'info': {} |
| 1386 | }, |
| 1387 | 'XRP/BTC': { |
| 1388 | 'symbol': 'XRP/BTC', |
| 1389 | 'timestamp': 1573758257534, |
| 1390 | 'datetime': '2019-11-14T19:04:17.534Z', |
| 1391 | 'high': 3.126e-05, |
| 1392 | 'low': 3.061e-05, |
| 1393 | 'bid': 3.093e-05, |
| 1394 | 'bidVolume': 27901.0, |
| 1395 | 'ask': 3.095e-05, |
| 1396 | 'askVolume': 10551.0, |
| 1397 | 'vwap': 3.091e-05, |
| 1398 | 'open': 3.119e-05, |
| 1399 | 'close': 3.094e-05, |
| 1400 | 'last': 3.094e-05, |
| 1401 | 'previousClose': 3.117e-05, |
| 1402 | 'change': -2.5e-07, |
| 1403 | 'percentage': -0.802, |
| 1404 | 'average': None, |
| 1405 | 'baseVolume': 37334921.0, |
| 1406 | 'quoteVolume': 1154.19266394, |
| 1407 | 'info': {} |
| 1408 | }, |
| 1409 | "NANO/USDT": { |
| 1410 | "symbol": "NANO/USDT", |
| 1411 | "timestamp": 1580469388244, |
| 1412 | "datetime": "2020-01-31T11:16:28.244Z", |
| 1413 | "high": 0.7519, |
| 1414 | "low": 0.7154, |
| 1415 | "bid": 0.7305, |
| 1416 | "bidVolume": 300.3, |
| 1417 | "ask": 0.7342, |
| 1418 | "askVolume": 15.14, |
| 1419 | "vwap": 0.73645591, |
| 1420 | "open": 0.7154, |
| 1421 | "close": 0.7342, |
| 1422 | "last": 0.7342, |
| 1423 | "previousClose": 0.7189, |
| 1424 | "change": 0.0188, |
| 1425 | "percentage": 2.628, |
| 1426 | "average": None, |
| 1427 | "baseVolume": 439472.44, |
| 1428 | "quoteVolume": 323652.075405, |
| 1429 | "info": {} |
| 1430 | }, |
| 1431 | # Example of leveraged pair with incomplete info |
| 1432 | "ADAHALF/USDT": { |
| 1433 | "symbol": "ADAHALF/USDT", |
| 1434 | "timestamp": 1580469388244, |
| 1435 | "datetime": "2020-01-31T11:16:28.244Z", |
| 1436 | "high": None, |
| 1437 | "low": None, |
| 1438 | "bid": 0.7305, |
| 1439 | "bidVolume": None, |
| 1440 | "ask": 0.7342, |
| 1441 | "askVolume": None, |
| 1442 | "vwap": None, |
| 1443 | "open": None, |
| 1444 | "close": None, |
| 1445 | "last": None, |
| 1446 | "previousClose": None, |
| 1447 | "change": None, |
| 1448 | "percentage": 2.628, |
| 1449 | "average": None, |
| 1450 | "baseVolume": 0.0, |
| 1451 | "quoteVolume": 0.0, |
| 1452 | "info": {} |
| 1453 | }, |
| 1454 | "ADADOUBLE/USDT": { |
| 1455 | "symbol": "ADADOUBLE/USDT", |
| 1456 | "timestamp": 1580469388244, |
| 1457 | "datetime": "2020-01-31T11:16:28.244Z", |
| 1458 | "high": None, |
| 1459 | "low": None, |
| 1460 | "bid": 0.7305, |
| 1461 | "bidVolume": None, |
| 1462 | "ask": 0.7342, |
| 1463 | "askVolume": None, |
| 1464 | "vwap": None, |
| 1465 | "open": None, |
| 1466 | "close": None, |
| 1467 | "last": 0, |
| 1468 | "previousClose": None, |
| 1469 | "change": None, |
| 1470 | "percentage": 2.628, |
| 1471 | "average": None, |
| 1472 | "baseVolume": 0.0, |
| 1473 | "quoteVolume": 0.0, |
| 1474 | "info": {} |
| 1475 | }, |
| 1476 | }) |
| 1477 | |
| 1478 | |
| 1479 | @pytest.fixture |
| 1480 | def result(testdatadir): |
| 1481 | with (testdatadir / 'UNITTEST_BTC-1m.json').open('r') as data_file: |
| 1482 | return ohlcv_to_dataframe(json.load(data_file), '1m', pair="UNITTEST/BTC", |
| 1483 | fill_missing=True) |
| 1484 | |
| 1485 | |
| 1486 | @pytest.fixture(scope="function") |
| 1487 | def trades_for_order(): |
| 1488 | return [{'info': {'id': 34567, |
| 1489 | 'orderId': 123456, |
| 1490 | 'price': '0.24544100', |
| 1491 | 'qty': '8.00000000', |
| 1492 | 'commission': '0.00800000', |
| 1493 | 'commissionAsset': 'LTC', |
| 1494 | 'time': 1521663363189, |
| 1495 | 'isBuyer': True, |
| 1496 | 'isMaker': False, |
| 1497 | 'isBestMatch': True}, |
| 1498 | 'timestamp': 1521663363189, |
| 1499 | 'datetime': '2018-03-21T20:16:03.189Z', |
| 1500 | 'symbol': 'LTC/ETH', |
| 1501 | 'id': '34567', |
| 1502 | 'order': '123456', |
| 1503 | 'type': None, |
| 1504 | 'side': 'buy', |
| 1505 | 'price': 0.245441, |
| 1506 | 'cost': 1.963528, |
| 1507 | 'amount': 8.0, |
| 1508 | 'fee': {'cost': 0.008, 'currency': 'LTC'}}] |
| 1509 | |
| 1510 | |
| 1511 | @pytest.fixture(scope="function") |
| 1512 | def trades_history(): |
| 1513 | return [[1565798389463, '12618132aa9', None, 'buy', 0.019627, 0.04, 0.00078508], |
| 1514 | [1565798399629, '1261813bb30', None, 'buy', 0.019627, 0.244, 0.004788987999999999], |
| 1515 | [1565798399752, '1261813cc31', None, 'sell', 0.019626, 0.011, 0.00021588599999999999], |
| 1516 | [1565798399862, '126181cc332', None, 'sell', 0.019626, 0.011, 0.00021588599999999999], |
| 1517 | [1565798399872, '1261aa81333', None, 'sell', 0.019626, 0.011, 0.00021588599999999999]] |
| 1518 | |
| 1519 | |
| 1520 | @pytest.fixture(scope="function") |
| 1521 | def fetch_trades_result(): |
| 1522 | return [{'info': {'a': 126181329, |
| 1523 | 'p': '0.01962700', |
| 1524 | 'q': '0.04000000', |
| 1525 | 'f': 138604155, |
| 1526 | 'l': 138604155, |
| 1527 | 'T': 1565798399463, |
| 1528 | 'm': False, |
| 1529 | 'M': True}, |
| 1530 | 'timestamp': 1565798399463, |
| 1531 | 'datetime': '2019-08-14T15:59:59.463Z', |
| 1532 | 'symbol': 'ETH/BTC', |
| 1533 | 'id': '126181329', |
| 1534 | 'order': None, |
| 1535 | 'type': None, |
| 1536 | 'takerOrMaker': None, |
| 1537 | 'side': 'buy', |
| 1538 | 'price': 0.019627, |
| 1539 | 'amount': 0.04, |
| 1540 | 'cost': 0.00078508, |
| 1541 | 'fee': None}, |
| 1542 | {'info': {'a': 126181330, |
| 1543 | 'p': '0.01962700', |
| 1544 | 'q': '0.24400000', |
| 1545 | 'f': 138604156, |
| 1546 | 'l': 138604156, |
| 1547 | 'T': 1565798399629, |
| 1548 | 'm': False, |
| 1549 | 'M': True}, |
| 1550 | 'timestamp': 1565798399629, |
| 1551 | 'datetime': '2019-08-14T15:59:59.629Z', |
| 1552 | 'symbol': 'ETH/BTC', |
| 1553 | 'id': '126181330', |
| 1554 | 'order': None, |
| 1555 | 'type': None, |
| 1556 | 'takerOrMaker': None, |
| 1557 | 'side': 'buy', |
| 1558 | 'price': 0.019627, |
| 1559 | 'amount': 0.244, |
| 1560 | 'cost': 0.004788987999999999, |
| 1561 | 'fee': None}, |
| 1562 | {'info': {'a': 126181331, |
| 1563 | 'p': '0.01962600', |
| 1564 | 'q': '0.01100000', |
| 1565 | 'f': 138604157, |
| 1566 | 'l': 138604157, |
| 1567 | 'T': 1565798399752, |
| 1568 | 'm': True, |
| 1569 | 'M': True}, |
| 1570 | 'timestamp': 1565798399752, |
| 1571 | 'datetime': '2019-08-14T15:59:59.752Z', |
| 1572 | 'symbol': 'ETH/BTC', |
| 1573 | 'id': '126181331', |
| 1574 | 'order': None, |
| 1575 | 'type': None, |
| 1576 | 'takerOrMaker': None, |
| 1577 | 'side': 'sell', |
| 1578 | 'price': 0.019626, |
| 1579 | 'amount': 0.011, |
| 1580 | 'cost': 0.00021588599999999999, |
| 1581 | 'fee': None}, |
| 1582 | {'info': {'a': 126181332, |
| 1583 | 'p': '0.01962600', |
| 1584 | 'q': '0.01100000', |
| 1585 | 'f': 138604158, |
| 1586 | 'l': 138604158, |
| 1587 | 'T': 1565798399862, |
| 1588 | 'm': True, |
| 1589 | 'M': True}, |
| 1590 | 'timestamp': 1565798399862, |
| 1591 | 'datetime': '2019-08-14T15:59:59.862Z', |
| 1592 | 'symbol': 'ETH/BTC', |
| 1593 | 'id': '126181332', |
| 1594 | 'order': None, |
| 1595 | 'type': None, |
| 1596 | 'takerOrMaker': None, |
| 1597 | 'side': 'sell', |
| 1598 | 'price': 0.019626, |
| 1599 | 'amount': 0.011, |
| 1600 | 'cost': 0.00021588599999999999, |
| 1601 | 'fee': None}, |
| 1602 | {'info': {'a': 126181333, |
| 1603 | 'p': '0.01952600', |
| 1604 | 'q': '0.01200000', |
| 1605 | 'f': 138604158, |
| 1606 | 'l': 138604158, |
| 1607 | 'T': 1565798399872, |
| 1608 | 'm': True, |
| 1609 | 'M': True}, |
| 1610 | 'timestamp': 1565798399872, |
| 1611 | 'datetime': '2019-08-14T15:59:59.872Z', |
| 1612 | 'symbol': 'ETH/BTC', |
| 1613 | 'id': '126181333', |
| 1614 | 'order': None, |
| 1615 | 'type': None, |
| 1616 | 'takerOrMaker': None, |
| 1617 | 'side': 'sell', |
| 1618 | 'price': 0.019626, |
| 1619 | 'amount': 0.011, |
| 1620 | 'cost': 0.00021588599999999999, |
| 1621 | 'fee': None}] |
| 1622 | |
| 1623 | |
| 1624 | @pytest.fixture(scope="function") |
| 1625 | def trades_for_order2(): |
| 1626 | return [{'info': {}, |
| 1627 | 'timestamp': 1521663363189, |
| 1628 | 'datetime': '2018-03-21T20:16:03.189Z', |
| 1629 | 'symbol': 'LTC/ETH', |
| 1630 | 'id': '34567', |
| 1631 | 'order': '123456', |
| 1632 | 'type': None, |
| 1633 | 'side': 'buy', |
| 1634 | 'price': 0.245441, |
| 1635 | 'cost': 1.963528, |
| 1636 | 'amount': 4.0, |
| 1637 | 'fee': {'cost': 0.004, 'currency': 'LTC'}}, |
| 1638 | {'info': {}, |
| 1639 | 'timestamp': 1521663363189, |
| 1640 | 'datetime': '2018-03-21T20:16:03.189Z', |
| 1641 | 'symbol': 'LTC/ETH', |
| 1642 | 'id': '34567', |
| 1643 | 'order': '123456', |
| 1644 | 'type': None, |
| 1645 | 'side': 'buy', |
| 1646 | 'price': 0.245441, |
| 1647 | 'cost': 1.963528, |
| 1648 | 'amount': 4.0, |
| 1649 | 'fee': {'cost': 0.004, 'currency': 'LTC'}}] |
| 1650 | |
| 1651 | |
| 1652 | @pytest.fixture(scope="function") |
| 1653 | def trades_for_order3(trades_for_order2): |
| 1654 | # Different fee currencies for each trade |
| 1655 | trades_for_order = deepcopy(trades_for_order2) |
| 1656 | trades_for_order[0]['fee'] = {'cost': 0.02, 'currency': 'BNB'} |
| 1657 | return trades_for_order |
| 1658 | |
| 1659 | |
| 1660 | @pytest.fixture |
| 1661 | def buy_order_fee(): |
| 1662 | return { |
| 1663 | 'id': 'mocked_limit_buy_old', |
| 1664 | 'type': 'limit', |
| 1665 | 'side': 'buy', |
| 1666 | 'symbol': 'mocked', |
| 1667 | 'datetime': str(arrow.utcnow().shift(minutes=-601).datetime), |
| 1668 | 'price': 0.245441, |
| 1669 | 'amount': 8.0, |
| 1670 | 'cost': 1.963528, |
| 1671 | 'remaining': 90.99181073, |
| 1672 | 'status': 'closed', |
| 1673 | 'fee': None |
| 1674 | } |
| 1675 | |
| 1676 | |
| 1677 | @pytest.fixture(scope="function") |
| 1678 | def edge_conf(default_conf): |
| 1679 | conf = deepcopy(default_conf) |
| 1680 | conf['max_open_trades'] = -1 |
| 1681 | conf['tradable_balance_ratio'] = 0.5 |
| 1682 | conf['stake_amount'] = constants.UNLIMITED_STAKE_AMOUNT |
| 1683 | conf['edge'] = { |
| 1684 | "enabled": True, |
| 1685 | "process_throttle_secs": 1800, |
| 1686 | "calculate_since_number_of_days": 14, |
| 1687 | "allowed_risk": 0.01, |
| 1688 | "stoploss_range_min": -0.01, |
| 1689 | "stoploss_range_max": -0.1, |
| 1690 | "stoploss_range_step": -0.01, |
| 1691 | "maximum_winrate": 0.80, |
| 1692 | "minimum_expectancy": 0.20, |
| 1693 | "min_trade_number": 15, |
| 1694 | "max_trade_duration_minute": 1440, |
| 1695 | "remove_pumps": False |
| 1696 | } |
| 1697 | |
| 1698 | return conf |
| 1699 | |
| 1700 | |
| 1701 | @pytest.fixture |
| 1702 | def rpc_balance(): |
| 1703 | return { |
| 1704 | 'BTC': { |
| 1705 | 'total': 12.0, |
| 1706 | 'free': 12.0, |
| 1707 | 'used': 0.0 |
| 1708 | }, |
| 1709 | 'ETH': { |
| 1710 | 'total': 0.0, |
| 1711 | 'free': 0.0, |
| 1712 | 'used': 0.0 |
| 1713 | }, |
| 1714 | 'USDT': { |
| 1715 | 'total': 10000.0, |
| 1716 | 'free': 10000.0, |
| 1717 | 'used': 0.0 |
| 1718 | }, |
| 1719 | 'LTC': { |
| 1720 | 'total': 10.0, |
| 1721 | 'free': 10.0, |
| 1722 | 'used': 0.0 |
| 1723 | }, |
| 1724 | 'XRP': { |
| 1725 | 'total': 0.1, |
| 1726 | 'free': 0.01, |
| 1727 | 'used': 0.0 |
| 1728 | }, |
| 1729 | 'EUR': { |
| 1730 | 'total': 10.0, |
| 1731 | 'free': 10.0, |
| 1732 | 'used': 0.0 |
| 1733 | }, |
| 1734 | } |
| 1735 | |
| 1736 | |
| 1737 | @pytest.fixture |
| 1738 | def testdatadir() -> Path: |
| 1739 | """Return the path where testdata files are stored""" |
| 1740 | return (Path(__file__).parent / "testdata").resolve() |
| 1741 | |
| 1742 | |
| 1743 | @pytest.fixture(scope="function") |
| 1744 | def import_fails() -> None: |
| 1745 | # Source of this test-method: |
| 1746 | # https://stackoverflow.com/questions/2481511/mocking-importerror-in-python |
| 1747 | import builtins |
| 1748 | realimport = builtins.__import__ |
| 1749 | |
| 1750 | def mockedimport(name, *args, **kwargs): |
| 1751 | if name in ["filelock", 'systemd.journal', 'uvloop']: |
| 1752 | raise ImportError(f"No module named '{name}'") |
| 1753 | return realimport(name, *args, **kwargs) |
| 1754 | |
| 1755 | builtins.__import__ = mockedimport |
| 1756 | |
| 1757 | # Run test - then cleanup |
| 1758 | yield |
| 1759 | |
| 1760 | # restore previous importfunction |
| 1761 | builtins.__import__ = realimport |
| 1762 | |
| 1763 | |
| 1764 | @pytest.fixture(scope="function") |
| 1765 | def open_trade(): |
| 1766 | return Trade( |
| 1767 | pair='ETH/BTC', |
| 1768 | open_rate=0.00001099, |
| 1769 | exchange='binance', |
| 1770 | open_order_id='123456789', |
| 1771 | amount=90.99181073, |
| 1772 | fee_open=0.0, |
| 1773 | fee_close=0.0, |
| 1774 | stake_amount=1, |
| 1775 | open_date=arrow.utcnow().shift(minutes=-601).datetime, |
| 1776 | is_open=True |
| 1777 | ) |
| 1778 | |
| 1779 | |
| 1780 | @pytest.fixture |
| 1781 | def hyperopt_results(): |
| 1782 | return [ |
| 1783 | { |
| 1784 | 'loss': 0.4366182531161519, |
| 1785 | 'params_dict': { |
| 1786 | 'mfi-value': 15, 'fastd-value': 20, 'adx-value': 25, 'rsi-value': 28, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 88, 'sell-fastd-value': 97, 'sell-adx-value': 51, 'sell-rsi-value': 67, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper', 'roi_t1': 1190, 'roi_t2': 541, 'roi_t3': 408, 'roi_p1': 0.026035863879169705, 'roi_p2': 0.12508730043628782, 'roi_p3': 0.27766427921605896, 'stoploss': -0.2562930402099556}, # noqa: E501 |
| 1787 | 'params_details': {'buy': {'mfi-value': 15, 'fastd-value': 20, 'adx-value': 25, 'rsi-value': 28, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'macd_cross_signal'}, 'sell': {'sell-mfi-value': 88, 'sell-fastd-value': 97, 'sell-adx-value': 51, 'sell-rsi-value': 67, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper'}, 'roi': {0: 0.4287874435315165, 408: 0.15112316431545753, 949: 0.026035863879169705, 2139: 0}, 'stoploss': {'stoploss': -0.2562930402099556}}, # noqa: E501 |
| 1788 | 'results_metrics': {'trade_count': 2, 'avg_profit': -1.254995, 'median_profit': -1.2222, 'total_profit': -0.00125625, 'profit': -2.50999, 'duration': 3930.0}, # noqa: E501 |
| 1789 | 'results_explanation': ' 2 trades. Avg profit -1.25%. Total profit -0.00125625 BTC ( -2.51Σ%). Avg duration 3930.0 min.', # noqa: E501 |
| 1790 | 'total_profit': -0.00125625, |
| 1791 | 'current_epoch': 1, |
| 1792 | 'is_initial_point': True, |
| 1793 | 'is_best': True |
| 1794 | }, { |
| 1795 | 'loss': 20.0, |
| 1796 | 'params_dict': { |
| 1797 | 'mfi-value': 17, 'fastd-value': 38, 'adx-value': 48, 'rsi-value': 22, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 96, 'sell-fastd-value': 68, 'sell-adx-value': 63, 'sell-rsi-value': 81, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal', 'roi_t1': 334, 'roi_t2': 683, 'roi_t3': 140, 'roi_p1': 0.06403981740598495, 'roi_p2': 0.055519840060645045, 'roi_p3': 0.3253712811342459, 'stoploss': -0.338070047333259}, # noqa: E501 |
| 1798 | 'params_details': { |
| 1799 | 'buy': {'mfi-value': 17, 'fastd-value': 38, 'adx-value': 48, 'rsi-value': 22, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'macd_cross_signal'}, # noqa: E501 |
| 1800 | 'sell': {'sell-mfi-value': 96, 'sell-fastd-value': 68, 'sell-adx-value': 63, 'sell-rsi-value': 81, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal'}, # noqa: E501 |
| 1801 | 'roi': {0: 0.4449309386008759, 140: 0.11955965746663, 823: 0.06403981740598495, 1157: 0}, # noqa: E501 |
| 1802 | 'stoploss': {'stoploss': -0.338070047333259}}, |
| 1803 | 'results_metrics': {'trade_count': 1, 'avg_profit': 0.12357, 'median_profit': -1.2222, 'total_profit': 6.185e-05, 'profit': 0.12357, 'duration': 1200.0}, # noqa: E501 |
| 1804 | 'results_explanation': ' 1 trades. Avg profit 0.12%. Total profit 0.00006185 BTC ( 0.12Σ%). Avg duration 1200.0 min.', # noqa: E501 |
| 1805 | 'total_profit': 6.185e-05, |
| 1806 | 'current_epoch': 2, |
| 1807 | 'is_initial_point': True, |
| 1808 | 'is_best': False |
| 1809 | }, { |
| 1810 | 'loss': 14.241196856510731, |
| 1811 | 'params_dict': {'mfi-value': 25, 'fastd-value': 16, 'adx-value': 29, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 98, 'sell-fastd-value': 72, 'sell-adx-value': 51, 'sell-rsi-value': 82, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal', 'roi_t1': 889, 'roi_t2': 533, 'roi_t3': 263, 'roi_p1': 0.04759065393663096, 'roi_p2': 0.1488819964638463, 'roi_p3': 0.4102801822104605, 'stoploss': -0.05394588767607611}, # noqa: E501 |
| 1812 | 'params_details': {'buy': {'mfi-value': 25, 'fastd-value': 16, 'adx-value': 29, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'macd_cross_signal'}, 'sell': {'sell-mfi-value': 98, 'sell-fastd-value': 72, 'sell-adx-value': 51, 'sell-rsi-value': 82, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal'}, 'roi': {0: 0.6067528326109377, 263: 0.19647265040047726, 796: 0.04759065393663096, 1685: 0}, 'stoploss': {'stoploss': -0.05394588767607611}}, # noqa: E501 |
| 1813 | 'results_metrics': {'trade_count': 621, 'avg_profit': -0.43883302093397747, 'median_profit': -1.2222, 'total_profit': -0.13639474, 'profit': -272.515306, 'duration': 1691.207729468599}, # noqa: E501 |
| 1814 | 'results_explanation': ' 621 trades. Avg profit -0.44%. Total profit -0.13639474 BTC (-272.52Σ%). Avg duration 1691.2 min.', # noqa: E501 |
| 1815 | 'total_profit': -0.13639474, |
| 1816 | 'current_epoch': 3, |
| 1817 | 'is_initial_point': True, |
| 1818 | 'is_best': False |
| 1819 | }, { |
| 1820 | 'loss': 100000, |
| 1821 | 'params_dict': {'mfi-value': 13, 'fastd-value': 35, 'adx-value': 39, 'rsi-value': 29, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': True, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 87, 'sell-fastd-value': 54, 'sell-adx-value': 63, 'sell-rsi-value': 93, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper', 'roi_t1': 1402, 'roi_t2': 676, 'roi_t3': 215, 'roi_p1': 0.06264755784937427, 'roi_p2': 0.14258587851894644, 'roi_p3': 0.20671291201040828, 'stoploss': -0.11818343570194478}, # noqa: E501 |
| 1822 | 'params_details': {'buy': {'mfi-value': 13, 'fastd-value': 35, 'adx-value': 39, 'rsi-value': 29, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': True, 'trigger': 'macd_cross_signal'}, 'sell': {'sell-mfi-value': 87, 'sell-fastd-value': 54, 'sell-adx-value': 63, 'sell-rsi-value': 93, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper'}, 'roi': {0: 0.411946348378729, 215: 0.2052334363683207, 891: 0.06264755784937427, 2293: 0}, 'stoploss': {'stoploss': -0.11818343570194478}}, # noqa: E501 |
| 1823 | 'results_metrics': {'trade_count': 0, 'avg_profit': None, 'median_profit': None, 'total_profit': 0, 'profit': 0.0, 'duration': None}, # noqa: E501 |
| 1824 | 'results_explanation': ' 0 trades. Avg profit nan%. Total profit 0.00000000 BTC ( 0.00Σ%). Avg duration nan min.', # noqa: E501 |
| 1825 | 'total_profit': 0, 'current_epoch': 4, 'is_initial_point': True, 'is_best': False |
| 1826 | }, { |
| 1827 | 'loss': 0.22195522184191518, |
| 1828 | 'params_dict': {'mfi-value': 17, 'fastd-value': 21, 'adx-value': 38, 'rsi-value': 33, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': False, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 87, 'sell-fastd-value': 82, 'sell-adx-value': 78, 'sell-rsi-value': 69, 'sell-mfi-enabled': True, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': False, 'sell-trigger': 'sell-macd_cross_signal', 'roi_t1': 1269, 'roi_t2': 601, 'roi_t3': 444, 'roi_p1': 0.07280999507931168, 'roi_p2': 0.08946698095898986, 'roi_p3': 0.1454876733325284, 'stoploss': -0.18181041180901014}, # noqa: E501 |
| 1829 | 'params_details': {'buy': {'mfi-value': 17, 'fastd-value': 21, 'adx-value': 38, 'rsi-value': 33, 'mfi-enabled': True, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': False, 'trigger': 'macd_cross_signal'}, 'sell': {'sell-mfi-value': 87, 'sell-fastd-value': 82, 'sell-adx-value': 78, 'sell-rsi-value': 69, 'sell-mfi-enabled': True, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': False, 'sell-trigger': 'sell-macd_cross_signal'}, 'roi': {0: 0.3077646493708299, 444: 0.16227697603830155, 1045: 0.07280999507931168, 2314: 0}, 'stoploss': {'stoploss': -0.18181041180901014}}, # noqa: E501 |
| 1830 | 'results_metrics': {'trade_count': 14, 'avg_profit': -0.3539515, 'median_profit': -1.2222, 'total_profit': -0.002480140000000001, 'profit': -4.955321, 'duration': 3402.8571428571427}, # noqa: E501 |
| 1831 | 'results_explanation': ' 14 trades. Avg profit -0.35%. Total profit -0.00248014 BTC ( -4.96Σ%). Avg duration 3402.9 min.', # noqa: E501 |
| 1832 | 'total_profit': -0.002480140000000001, |
| 1833 | 'current_epoch': 5, |
| 1834 | 'is_initial_point': True, |
| 1835 | 'is_best': True |
| 1836 | }, { |
| 1837 | 'loss': 0.545315889154162, |
| 1838 | 'params_dict': {'mfi-value': 22, 'fastd-value': 43, 'adx-value': 46, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'bb_lower', 'sell-mfi-value': 87, 'sell-fastd-value': 65, 'sell-adx-value': 94, 'sell-rsi-value': 63, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal', 'roi_t1': 319, 'roi_t2': 556, 'roi_t3': 216, 'roi_p1': 0.06251955472249589, 'roi_p2': 0.11659519602202795, 'roi_p3': 0.0953744132197762, 'stoploss': -0.024551752215582423}, # noqa: E501 |
| 1839 | 'params_details': {'buy': {'mfi-value': 22, 'fastd-value': 43, 'adx-value': 46, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'bb_lower'}, 'sell': {'sell-mfi-value': 87, 'sell-fastd-value': 65, 'sell-adx-value': 94, 'sell-rsi-value': 63, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal'}, 'roi': {0: 0.2744891639643, 216: 0.17911475074452382, 772: 0.06251955472249589, 1091: 0}, 'stoploss': {'stoploss': -0.024551752215582423}}, # noqa: E501 |
| 1840 | 'results_metrics': {'trade_count': 39, 'avg_profit': -0.21400679487179478, 'median_profit': -1.2222, 'total_profit': -0.0041773, 'profit': -8.346264999999997, 'duration': 636.9230769230769}, # noqa: E501 |
| 1841 | 'results_explanation': ' 39 trades. Avg profit -0.21%. Total profit -0.00417730 BTC ( -8.35Σ%). Avg duration 636.9 min.', # noqa: E501 |
| 1842 | 'total_profit': -0.0041773, |
| 1843 | 'current_epoch': 6, |
| 1844 | 'is_initial_point': True, |
| 1845 | 'is_best': False |
| 1846 | }, { |
| 1847 | 'loss': 4.713497421432944, |
| 1848 | 'params_dict': {'mfi-value': 13, 'fastd-value': 41, 'adx-value': 21, 'rsi-value': 29, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'bb_lower', 'sell-mfi-value': 99, 'sell-fastd-value': 60, 'sell-adx-value': 81, 'sell-rsi-value': 69, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': False, 'sell-trigger': 'sell-macd_cross_signal', 'roi_t1': 771, 'roi_t2': 620, 'roi_t3': 145, 'roi_p1': 0.0586919200378493, 'roi_p2': 0.04984118697312542, 'roi_p3': 0.37521058680247044, 'stoploss': -0.14613268022709905}, # noqa: E501 |
| 1849 | 'params_details': { |
| 1850 | 'buy': {'mfi-value': 13, 'fastd-value': 41, 'adx-value': 21, 'rsi-value': 29, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'bb_lower'}, 'sell': {'sell-mfi-value': 99, 'sell-fastd-value': 60, 'sell-adx-value': 81, 'sell-rsi-value': 69, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': False, 'sell-trigger': 'sell-macd_cross_signal'}, 'roi': {0: 0.4837436938134452, 145: 0.10853310701097472, 765: 0.0586919200378493, 1536: 0}, # noqa: E501 |
| 1851 | 'stoploss': {'stoploss': -0.14613268022709905}}, # noqa: E501 |
| 1852 | 'results_metrics': {'trade_count': 318, 'avg_profit': -0.39833954716981146, 'median_profit': -1.2222, 'total_profit': -0.06339929, 'profit': -126.67197600000004, 'duration': 3140.377358490566}, # noqa: E501 |
| 1853 | 'results_explanation': ' 318 trades. Avg profit -0.40%. Total profit -0.06339929 BTC (-126.67Σ%). Avg duration 3140.4 min.', # noqa: E501 |
| 1854 | 'total_profit': -0.06339929, |
| 1855 | 'current_epoch': 7, |
| 1856 | 'is_initial_point': True, |
| 1857 | 'is_best': False |
| 1858 | }, { |
| 1859 | 'loss': 20.0, # noqa: E501 |
| 1860 | 'params_dict': {'mfi-value': 24, 'fastd-value': 43, 'adx-value': 33, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'sar_reversal', 'sell-mfi-value': 89, 'sell-fastd-value': 74, 'sell-adx-value': 70, 'sell-rsi-value': 70, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': False, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal', 'roi_t1': 1149, 'roi_t2': 375, 'roi_t3': 289, 'roi_p1': 0.05571820757172588, 'roi_p2': 0.0606240398618907, 'roi_p3': 0.1729012220156157, 'stoploss': -0.1588514289110401}, # noqa: E501 |
| 1861 | 'params_details': {'buy': {'mfi-value': 24, 'fastd-value': 43, 'adx-value': 33, 'rsi-value': 20, 'mfi-enabled': False, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': True, 'trigger': 'sar_reversal'}, 'sell': {'sell-mfi-value': 89, 'sell-fastd-value': 74, 'sell-adx-value': 70, 'sell-rsi-value': 70, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': False, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal'}, 'roi': {0: 0.2892434694492323, 289: 0.11634224743361658, 664: 0.05571820757172588, 1813: 0}, 'stoploss': {'stoploss': -0.1588514289110401}}, # noqa: E501 |
| 1862 | 'results_metrics': {'trade_count': 1, 'avg_profit': 0.0, 'median_profit': 0.0, 'total_profit': 0.0, 'profit': 0.0, 'duration': 5340.0}, # noqa: E501 |
| 1863 | 'results_explanation': ' 1 trades. Avg profit 0.00%. Total profit 0.00000000 BTC ( 0.00Σ%). Avg duration 5340.0 min.', # noqa: E501 |
| 1864 | 'total_profit': 0.0, |
| 1865 | 'current_epoch': 8, |
| 1866 | 'is_initial_point': True, |
| 1867 | 'is_best': False |
| 1868 | }, { |
| 1869 | 'loss': 2.4731817780991223, |
| 1870 | 'params_dict': {'mfi-value': 22, 'fastd-value': 20, 'adx-value': 29, 'rsi-value': 40, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'sar_reversal', 'sell-mfi-value': 97, 'sell-fastd-value': 65, 'sell-adx-value': 81, 'sell-rsi-value': 64, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper', 'roi_t1': 1012, 'roi_t2': 584, 'roi_t3': 422, 'roi_p1': 0.036764323603472565, 'roi_p2': 0.10335480573205287, 'roi_p3': 0.10322347377503042, 'stoploss': -0.2780610808108503}, # noqa: E501 |
| 1871 | 'params_details': {'buy': {'mfi-value': 22, 'fastd-value': 20, 'adx-value': 29, 'rsi-value': 40, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'sar_reversal'}, 'sell': {'sell-mfi-value': 97, 'sell-fastd-value': 65, 'sell-adx-value': 81, 'sell-rsi-value': 64, 'sell-mfi-enabled': True, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper'}, 'roi': {0: 0.2433426031105559, 422: 0.14011912933552545, 1006: 0.036764323603472565, 2018: 0}, 'stoploss': {'stoploss': -0.2780610808108503}}, # noqa: E501 |
| 1872 | 'results_metrics': {'trade_count': 229, 'avg_profit': -0.38433433624454144, 'median_profit': -1.2222, 'total_profit': -0.044050070000000004, 'profit': -88.01256299999999, 'duration': 6505.676855895196}, # noqa: E501 |
| 1873 | 'results_explanation': ' 229 trades. Avg profit -0.38%. Total profit -0.04405007 BTC ( -88.01Σ%). Avg duration 6505.7 min.', # noqa: E501 |
| 1874 | 'total_profit': -0.044050070000000004, # noqa: E501 |
| 1875 | 'current_epoch': 9, |
| 1876 | 'is_initial_point': True, |
| 1877 | 'is_best': False |
| 1878 | }, { |
| 1879 | 'loss': -0.2604606005845212, # noqa: E501 |
| 1880 | 'params_dict': {'mfi-value': 23, 'fastd-value': 24, 'adx-value': 22, 'rsi-value': 24, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': True, 'trigger': 'macd_cross_signal', 'sell-mfi-value': 97, 'sell-fastd-value': 70, 'sell-adx-value': 64, 'sell-rsi-value': 80, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal', 'roi_t1': 792, 'roi_t2': 464, 'roi_t3': 215, 'roi_p1': 0.04594053535385903, 'roi_p2': 0.09623192684243963, 'roi_p3': 0.04428219070850663, 'stoploss': -0.16992287161634415}, # noqa: E501 |
| 1881 | 'params_details': {'buy': {'mfi-value': 23, 'fastd-value': 24, 'adx-value': 22, 'rsi-value': 24, 'mfi-enabled': False, 'fastd-enabled': False, 'adx-enabled': False, 'rsi-enabled': True, 'trigger': 'macd_cross_signal'}, 'sell': {'sell-mfi-value': 97, 'sell-fastd-value': 70, 'sell-adx-value': 64, 'sell-rsi-value': 80, 'sell-mfi-enabled': False, 'sell-fastd-enabled': True, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-sar_reversal'}, 'roi': {0: 0.18645465290480528, 215: 0.14217246219629864, 679: 0.04594053535385903, 1471: 0}, 'stoploss': {'stoploss': -0.16992287161634415}}, # noqa: E501 |
| 1882 | 'results_metrics': {'trade_count': 4, 'avg_profit': 0.1080385, 'median_profit': -1.2222, 'total_profit': 0.00021629, 'profit': 0.432154, 'duration': 2850.0}, # noqa: E501 |
| 1883 | 'results_explanation': ' 4 trades. Avg profit 0.11%. Total profit 0.00021629 BTC ( 0.43Σ%). Avg duration 2850.0 min.', # noqa: E501 |
| 1884 | 'total_profit': 0.00021629, |
| 1885 | 'current_epoch': 10, |
| 1886 | 'is_initial_point': True, |
| 1887 | 'is_best': True |
| 1888 | }, { |
| 1889 | 'loss': 4.876465945994304, # noqa: E501 |
| 1890 | 'params_dict': {'mfi-value': 20, 'fastd-value': 32, 'adx-value': 49, 'rsi-value': 23, 'mfi-enabled': True, 'fastd-enabled': True, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'bb_lower', 'sell-mfi-value': 75, 'sell-fastd-value': 56, 'sell-adx-value': 61, 'sell-rsi-value': 62, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal', 'roi_t1': 579, 'roi_t2': 614, 'roi_t3': 273, 'roi_p1': 0.05307643172744114, 'roi_p2': 0.1352282078262871, 'roi_p3': 0.1913307406325751, 'stoploss': -0.25728526022513887}, # noqa: E501 |
| 1891 | 'params_details': {'buy': {'mfi-value': 20, 'fastd-value': 32, 'adx-value': 49, 'rsi-value': 23, 'mfi-enabled': True, 'fastd-enabled': True, 'adx-enabled': False, 'rsi-enabled': False, 'trigger': 'bb_lower'}, 'sell': {'sell-mfi-value': 75, 'sell-fastd-value': 56, 'sell-adx-value': 61, 'sell-rsi-value': 62, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-macd_cross_signal'}, 'roi': {0: 0.3796353801863034, 273: 0.18830463955372825, 887: 0.05307643172744114, 1466: 0}, 'stoploss': {'stoploss': -0.25728526022513887}}, # noqa: E501 |
| 1892 | 'results_metrics': {'trade_count': 117, 'avg_profit': -1.2698609145299145, 'median_profit': -1.2222, 'total_profit': -0.07436117, 'profit': -148.573727, 'duration': 4282.5641025641025}, # noqa: E501 |
| 1893 | 'results_explanation': ' 117 trades. Avg profit -1.27%. Total profit -0.07436117 BTC (-148.57Σ%). Avg duration 4282.6 min.', # noqa: E501 |
| 1894 | 'total_profit': -0.07436117, |
| 1895 | 'current_epoch': 11, |
| 1896 | 'is_initial_point': True, |
| 1897 | 'is_best': False |
| 1898 | }, { |
| 1899 | 'loss': 100000, |
| 1900 | 'params_dict': {'mfi-value': 10, 'fastd-value': 36, 'adx-value': 31, 'rsi-value': 22, 'mfi-enabled': True, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': False, 'trigger': 'sar_reversal', 'sell-mfi-value': 80, 'sell-fastd-value': 71, 'sell-adx-value': 60, 'sell-rsi-value': 85, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper', 'roi_t1': 1156, 'roi_t2': 581, 'roi_t3': 408, 'roi_p1': 0.06860454019988212, 'roi_p2': 0.12473718444931989, 'roi_p3': 0.2896360635226823, 'stoploss': -0.30889015124682806}, # noqa: E501 |
| 1901 | 'params_details': {'buy': {'mfi-value': 10, 'fastd-value': 36, 'adx-value': 31, 'rsi-value': 22, 'mfi-enabled': True, 'fastd-enabled': True, 'adx-enabled': True, 'rsi-enabled': False, 'trigger': 'sar_reversal'}, 'sell': {'sell-mfi-value': 80, 'sell-fastd-value': 71, 'sell-adx-value': 60, 'sell-rsi-value': 85, 'sell-mfi-enabled': False, 'sell-fastd-enabled': False, 'sell-adx-enabled': True, 'sell-rsi-enabled': True, 'sell-trigger': 'sell-bb_upper'}, 'roi': {0: 0.4829777881718843, 408: 0.19334172464920202, 989: 0.06860454019988212, 2145: 0}, 'stoploss': {'stoploss': -0.30889015124682806}}, # noqa: E501 |
| 1902 | 'results_metrics': {'trade_count': 0, 'avg_profit': None, 'median_profit': None, 'total_profit': 0, 'profit': 0.0, 'duration': None}, # noqa: E501 |
| 1903 | 'results_explanation': ' 0 trades. Avg profit nan%. Total profit 0.00000000 BTC ( 0.00Σ%). Avg duration nan min.', # noqa: E501 |
| 1904 | 'total_profit': 0, |
| 1905 | 'current_epoch': 12, |
| 1906 | 'is_initial_point': True, |
| 1907 | 'is_best': False |
| 1908 | } |
| 1909 | ] |