Commit Graph

1663 Commits

Author SHA1 Message Date
Matthias 46809f08fe Merge branch 'develop' into feat/short 2022-01-07 10:13:16 +01:00
Matthias e540959c27 Remove btdata from generate_strategy_stats 2022-01-07 09:27:07 +01:00
Matthias 1203d08d1e generate_pair_metrics does not need processed dict 2022-01-07 09:27:07 +01:00
Matthias addba6597a
Merge pull request #6165 from freqtrade/drawdown_fixes
Improved drawdown calculation
2022-01-06 09:56:05 +01:00
Matthias 2a2392fd73 Update parameter name in docstring 2022-01-06 09:15:30 +01:00
Matthias a9a6cf13f8 Add exit_tag to detail-sells
closes #6159
2022-01-06 08:22:15 +01:00
Matthias 6abd6bceb9 Avoid recalculating statistics for comparison line 2022-01-05 20:16:48 +01:00
Sam Germain 501f473164 Merge branch 'develop' into feat/short 2022-01-04 22:47:33 -06:00
Matthias 8373a4e713 Small Adjustments to improve compatibility 2022-01-04 19:17:08 +01:00
Matthias 4d9b4ddc28 Update hyperopt-tools to use account drawdown 2022-01-04 17:43:39 +01:00
Matthias 09fae25c94 Fix some tests after drawdown calculation change 2022-01-04 17:07:31 +01:00
Matthias 7a2b50ce8b Update drawdown calculation to account drawdown 2022-01-04 17:07:31 +01:00
Matthias 42579c0268 Drop hyperopt results legacy mode 2022-01-04 17:06:40 +01:00
Matthias 711a6a6dbc Merge branch 'develop' into pr/xataxxx/6079 2022-01-02 22:21:41 +01:00
Matthias 209ecc8732 Fix typo in bt_progress 2022-01-02 19:38:03 +01:00
Matthias ddfbe55e7c Merge branch 'develop' into feat/short 2022-01-01 19:16:49 +01:00
Matthias 670aed06bf Remove loop for hyperopt. 2021-12-31 17:35:08 +01:00
Rokas Kupstys a715083fc0 Reduce memory usage by not holding on to no longer needed data. 2021-12-31 12:10:01 +02:00
Wade Dyck 3d9360bb8c When backtesting, pass the candle_type to load_data. 2021-12-27 11:46:05 -07:00
Reigo Reinmets 817a65b656 This is not needed since backtesting does not have open orders. 2021-12-26 20:01:48 +02:00
Reigo Reinmets de79d25caf Refactoring to use strategy based configuration 2021-12-24 12:38:43 +02:00
Reigo Reinmets db2f0660fa Some more compatibility fixes. 2021-12-18 11:15:59 +02:00
Reigo Reinmets 30673f84f9 Flake8 compatibility 2021-12-18 11:00:25 +02:00
Reigo Reinmets d10fb95fce Fix typo 2021-12-17 22:27:10 +02:00
Reigo Reinmets f11a40f144 Improve documentation on adjust_trade_position and position_adjustment_enable 2021-12-11 17:14:04 +02:00
Reigo Reinmets f97662e816 Add position_adjustment_enable config keyword to enable it. 2021-12-11 00:28:12 +02:00
Reigo Reinmets 1e3fc5e984 Slight code touchup 2021-12-10 22:48:00 +02:00
Reigo Reinmets c179951cca Expect stake_amount, not actual amount of pair from strategy for DCA. 2021-12-10 20:42:24 +02:00
Reigo Reinmets b2c2852f86 Initial backtesting support. This does make it rather slow. 2021-12-09 23:21:35 +02:00
Matthias edd80c3006 Merge branch 'develop' into feat/short 2021-12-09 06:34:07 +01:00
Matthias c981cc335d Remove wrong comment 2021-12-04 14:51:55 +01:00
Matthias 68ac8008ec Call custom_exit_price only for sell_signal and custom_sell 2021-12-04 14:14:22 +01:00
Matthias 86910b58dc Bracket entry/exit prices to low/high of the candle 2021-12-03 17:44:53 +01:00
Matthias d1209fe415 Merge branch 'develop' into pr/GluTbl/5756 2021-12-03 17:37:44 +01:00
Matthias 2f17fa2765 Update more to use candleType 2021-12-03 14:15:35 +01:00
Matthias 5493212672 More candletype changes 2021-12-03 13:04:31 +01:00
Matthias 77443d5abc
Merge pull request #6011 from freqtrade/lev/backtesting
correctly apply leverage to backtesting
2021-12-01 19:49:40 +01:00
Matthias 67f3570bf3 Merge branch 'develop' into feat/short 2021-12-01 07:21:36 +01:00
Matthias a2a974fc6d correctly apply leverage to backtesting 2021-11-30 20:32:34 +01:00
Matthias 6ca6f62509 Remove duplicate code in optimize_reports 2021-11-27 09:39:10 +01:00
Matthias 450293878f
Merge pull request #5964 from stash86/fix-docs
Add more words on VolumePairlist backtest error message
2021-11-26 07:48:24 +01:00
Matthias 897788de17 Reformulate exception to be "nicer" 2021-11-26 07:02:50 +01:00
Matthias cc9ea1d466
Merge pull request #5935 from freqtrade/short_buy_tag_compat
Short buy tag compat
2021-11-26 06:29:56 +01:00
Stefano Ariestasia 5307d2bf3b Trimming the sentence 2021-11-25 17:04:04 +09:00
Stefano Ariestasia 0d1e84cf55 Add more words
Because apparently, we get at least 1 question about this everyday in Discord
2021-11-25 16:00:10 +09:00
Matthias ce0593c0e1 Merge branch 'develop' into feat/short 2021-11-23 07:35:26 +01:00
Rokas Kupstys 78a00f2518 Use market data to get base and quote currencies in @informative() decorator. 2021-11-22 09:27:45 +02:00
Matthias c26c0b6822 Merge branch 'feat/short' into short_buy_tag_compat 2021-11-21 19:31:59 +01:00
Matthias aad37bb8f3
Merge pull request #5924 from freqtrade/feat/leverage
call leverage methods
2021-11-21 19:30:27 +01:00
Matthias 63d94aa585 short should be allowed for all non-spot modes 2021-11-21 19:29:08 +01:00
Matthias fb519a5b39 Add comment with reasoning to ignore leverage in min_amount calculation 2021-11-21 10:28:40 +01:00
Matthias 192ac88314 Update optimize-reports to enter_tag wording 2021-11-21 10:20:09 +01:00
Matthias 36deced00b Remove more buy_tag references 2021-11-21 09:55:10 +01:00
Matthias 6247608cc6 top/bottom cap leverage 2021-11-19 07:11:19 +01:00
Matthias 021d1b518c Call "leverage" to determine leverage to be used. 2021-11-18 20:55:45 +01:00
Matthias 5a8824171c Add short/long metrics to backtest result 2021-11-18 20:42:43 +01:00
Matthias 0a50017c84 Add long/short support to backtesting 2021-11-18 20:34:59 +01:00
Matthias f40221dd9f Merge branch 'develop' into feat/short 2021-11-18 20:20:01 +01:00
Matthias 8638e6fe47 Simplify tradingmode parsing 2021-11-18 19:58:44 +01:00
Matthias e0fd880c11 Improve some more pct formattings 2021-11-11 16:12:23 +01:00
Matthias 4eb9038358 Some more fixes to % formatting 2021-11-11 15:06:16 +01:00
Matthias 23a566b478 validate_stake_amount should not be a private method 2021-11-10 06:38:24 +01:00
Matthias e4cca63163 Align sell_reason assignment location
trade mode sets it after "exit confirmation" - so should backtesting
detected in #5828
2021-11-08 19:32:13 +01:00
Matthias ebc38159b8 Merge branch 'develop' into feat/short 2021-11-06 15:24:52 +01:00
raphael ae2343db93
Update optimize_reports
Update show_backtest_reults() to preserve backwards compatibility by fixing KeyError: 'results_per_buy_tag' for older hyperopt result files.
2021-11-04 10:25:13 -04:00
Matthias 431b96de98 Merge branch 'develop' into pr/theluxaz/5710 2021-11-03 19:43:36 +01:00
Matthias 4249fcefba
Merge pull request #5150 from cryptomeisternox/backtesting-filter
Adding command for Filtering and print trades
2021-11-01 09:43:49 +01:00
Matthias c094ac5762 Merge branch 'develop' into feat/short 2021-10-30 19:45:19 +02:00
Matthias 20904f1ca4 Add tests for new command 2021-10-30 19:43:42 +02:00
Matthias 72ecb45d86 Add test for backtest_show logic 2021-10-30 16:53:48 +02:00
Matthias d60001e886 Stoploss cannot be below candle low
fix #5816
2021-10-30 16:14:13 +02:00
Matthias f472709438 Add option to show sorted pairlist
Allows easy copy/pasting of the pairlist to a configuration
2021-10-30 10:50:40 +02:00
Matthias 6f1e719216 Merge branch 'develop' into pr/cryptomeisternox/5150 2021-10-30 10:26:05 +02:00
Matthias 201fe108bc
Merge pull request #5607 from TreborNamor/develop
a new hyperopt loss created that uses calmar ratio
2021-10-29 09:20:44 +02:00
Matthias 5cdae2ce3f Remove CalmarDaily hyperopt loss 2021-10-29 06:53:40 +02:00
Matthias 20a61e03da
Merge pull request #5786 from SimonEbner/clean_up_file_handles
Clean up file handles
2021-10-25 19:49:07 +02:00
Robert Roman 88b96d5d1b
Update hyperopt_loss_calmar.py 2021-10-25 00:45:10 -05:00
Simon Ebner f7926083ca Clean up unclosed file handles
Close all file handles that are left dangling to avoid warnings such as

```
ResourceWarning: unclosed file <_io.TextIOWrapper
name='...' mode='r' encoding='UTF-8'> params = json_load(filename.open('r'))
```
2021-10-24 23:15:05 +02:00
Simon Ebner df033d92ef Improve performance of decimalspace.py
decimalspace.py is heavily used in the hyperoptimization. The following
benchmark code runs an optimization which is taken from optimizing a
real strategy (wtc).
The optimized version takes on my machine approx. 11/12s compared to the
original 32s. Results are equivalent in both cases.

```
import freqtrade.optimize.space
import numpy as np
import skopt
import timeit

def init():
    Decimal = freqtrade.optimize.space.decimalspace.SKDecimal
    Integer = skopt.space.space.Integer
    dimensions = [Decimal(low=-1.0,
        high=1.0,
        decimals=4,
        prior='uniform',
        transform='identity')] * 20

    return skopt.Optimizer(
        dimensions,
        base_estimator="ET",
        acq_optimizer="auto",
        n_initial_points=5,
        acq_optimizer_kwargs={'n_jobs': 96},
        random_state=0,
        model_queue_size=10,
    )

def test():
    opt = init()
    actual = opt.ask(n_points=2)
    expected = [[
        0.7515, -0.4723, -0.6941, -0.7988, 0.0448, 0.8605, -0.108, 0.5399,
        0.763, -0.2948, 0.8345, -0.7683, 0.7077, -0.2478, -0.333, 0.8575,
        0.6108, 0.4514, 0.5982, 0.3506
    ], [
        0.5563, 0.7386, -0.6407, 0.9073, -0.5211, -0.8167, -0.3771,
        -0.0318, 0.2861, 0.1176, 0.0943, -0.6077, -0.9317, -0.5372,
        -0.4934, -0.3637, -0.8035, -0.8627, -0.5399, 0.6036
    ]]

    absdiff = np.max(np.abs(np.asarray(expected) - np.asarray(actual)))
    assert absdiff < 1e-5

def time():
    opt = init()
    print('dt', timeit.timeit("opt.ask(n_points=20)", globals=locals()))

if __name__ == "__main__":
    test()
    time()
```
2021-10-24 18:14:24 +02:00
Matthias 22dd2ca003 Fix mypy type errors 2021-10-24 15:18:29 +02:00
Matthias 17432b2823 Improve some stylings 2021-10-24 09:15:05 +02:00
Matthias dffb4c5d53 Merge branch 'develop' into pr/TreborNamor/5607 2021-10-24 08:55:10 +02:00
Sam Germain aed22f7dad Merge branch 'develop' into feat/short 2021-10-22 11:45:27 -06:00
Matthias 78724e304e Merge branch 'develop' into pr/theluxaz/5710 2021-10-21 17:46:39 +02:00
theluxaz 0e085298e9 Fixed test failures. 2021-10-21 17:25:38 +03:00
Matthias 96f99699e0
Merge pull request #4606 from rextea/add_days_breakdown_to_backtesting_summary
Add days breakdown table to backtesting
2021-10-21 13:56:30 +02:00
Matthias e458c9867a Styling fixes 2021-10-21 07:45:15 +02:00
Matthias 7b5346b984 Add test for breakdown-stats 2021-10-21 07:11:39 +02:00
Matthias fa028c2134 Support day/week/month breakdowns 2021-10-21 06:58:40 +02:00
Matthias 7197f4ce77 Don't show daily % profit (it's wrong) 2021-10-20 20:01:31 +02:00
Matthias de5497c766 backtest_days cannot be below 1 2021-10-20 19:39:37 +02:00
theluxaz 905f3a1a50 Removed exit_tag from Trade objects. 2021-10-20 17:58:50 +03:00
Sam Germain 3fffc315ac Merge branch 'develop' into feat/short 2021-10-20 08:11:53 -06:00
Matthias 5454460227 Revert initial_points to 30
closes #5760
2021-10-20 07:46:15 +02:00
theluxaz 1fdc4425dd Changed exit_tag to be represented as sell_reason 2021-10-20 01:26:15 +03:00
GluTbl 00406ea7d5
Update backtesting.py
Support for custom entry-prices and exit-prices during backtesting.
2021-10-19 17:15:45 +05:30
theluxaz 5ecdd1d112 Merge branch 'develop' into freqtrade-development 2021-10-19 00:00:15 +03:00
theluxaz 69a59cdf37 Fixed flake 8, changed sell_tag to exit_tag and fixed telegram functions 2021-10-18 23:56:41 +03:00
Matthias 7d8cd736b8 Support days-breakdown also for hyperopt results 2021-10-17 16:49:39 +02:00
Matthias 47bba331c1 Merge branch 'develop' into pr/rextea/4606 2021-10-17 16:29:31 +02:00
Matthias 69fdb8edfa Merge branch 'develop' into feat/short 2021-10-17 10:40:08 +02:00
Matthias 0e7d903a6f
Merge pull request #5644 from slyons/develop
Add ability to ignore unparameterized spaces
2021-10-14 08:07:07 +02:00
Sam Germain bd488cc086 Merge branch 'develop' into feat/short 2021-10-13 17:56:40 -06:00
theluxaz 0bb7ea10ab Fixed minor header for backtesting 2021-10-14 01:34:30 +03:00
theluxaz ed39b8dab0 fixed profit total calculation 2021-10-14 01:18:16 +03:00
Matthias aed919a05f Simplify "no-space-configured" error handling by moving it to hyperopt_auto 2021-10-13 19:54:35 +02:00
theluxaz b151cf032b Merge branch 'develop' of https://github.com/theluxaz/freqtrade into main
# Conflicts:
#	freqtrade/freqtradebot.py
#	freqtrade/optimize/backtesting.py
2021-10-13 02:01:26 +03:00
theluxaz 80b71790bc Added some bigfixes for sell_tag 2021-10-13 01:22:53 +03:00
theluxaz b898f86364 Added sell_tag and buy/sell telegram performance functions 2021-10-13 00:02:28 +03:00
sid 30bc96cf3f simplify expression 2021-10-09 06:36:23 +05:30
sid 46c320513a use profit_abs 2021-10-07 08:07:07 +05:30
sid 6ba46b38bd fix formatting 2021-10-06 13:46:05 +05:30
sid c0d01dbc26 add max_drawdown loss 2021-10-06 13:24:27 +05:30
Sam Germain e8b4cf6eaa Merge branch 'develop' into feat/short 2021-10-02 03:15:12 -06:00
Scott Lyons df45f467c6
Adding ability to ignore unparameterized spaces 2021-09-30 01:11:02 -07:00
Robert Roman ca973c05d1
Merge branch 'freqtrade:develop' into develop 2021-09-28 10:16:36 -05:00
Robert Roman 626a40252d
resolved mypy error
error: Signature of "hyperopt_loss_function" incompatible with supertype "IHyperOptLoss"
2021-09-27 17:33:29 -05:00
Robert Roman c3414c3b78
resolved mypy error
error: Signature of "hyperopt_loss_function" incompatible with supertype "IHyperOptLoss"
2021-09-27 17:32:49 -05:00
Matthias 5726886b06 Reduce backtest-noise from "pandas slice" warning 2021-09-27 20:52:19 +02:00
Robert Roman bdca3e2343
Merge branch 'freqtrade:develop' into develop 2021-09-26 15:37:09 -05:00
Matthias a926f54a25 Add "side" parameter to custom_stake_amount 2021-09-26 19:35:54 +02:00
Matthias 84e013de2d Update confirm_trade_entry to support "side" parameter 2021-09-26 19:33:22 +02:00
Matthias 4d49f1a0c7 Reset columns by dropping instead of resetting 2021-09-26 15:39:34 +02:00
Matthias 4fd00db630 Use "combined" enter_tag column 2021-09-26 15:22:37 +02:00
Matthias 6319c104fe Fix unreliable backtest-result when using webserver mode 2021-09-26 15:07:48 +02:00
Matthias 2a678bdbb4 Update buy_tag column to long_tag 2021-09-26 08:37:44 +02:00
Robert Roman 24baad7884
Add Calmar Ratio Daily
This hyper opt loss calculates the daily Calmar ratio.
2021-09-25 16:28:36 -05:00
Robert Roman 3b99c84b0a
resolved the total profit issue
I resolved the total profit issue and locally ran flak8 and isort
2021-09-23 21:31:33 -05:00
Matthias 0e13d57e57 Update advise_* methods to entry/exit 2021-09-22 20:42:31 +02:00
Matthias 4c6b1cd55b Add very simple short logic to test-strategy 2021-09-22 20:36:03 +02:00
Robert Roman c6b684603c
removed trade_count inside if statement
i removed trade_count inside if statement. Even though it helps overfitting, It is not useful when running hyperopt on small datasets.
2021-09-22 09:21:43 -05:00
Robert Roman b946f8e7f1
I sorted imports with isort 2021-09-22 09:18:17 -05:00
Robert Roman 3834bb86ff
updated line 42
I removed the minus sign on max drawdown.
2021-09-21 20:25:17 -05:00
Robert Roman 3845d55186
a new hyperopt loss created that uses calmar ratio
This is a new hyperopt loss file that uses the Calmar Ratio.

Calmar Ratio = average annual rate of return / maximum drawdown
2021-09-21 20:04:23 -05:00
Sam Germain 778f0d9d0a Merged feat/short into lev-strat 2021-09-19 17:44:12 -06:00
Rokas Kupstys 5dc78a0c66 [SQUASH] Get rid of _initialize() and fix informatives for dynamic pairlists. 2021-09-18 10:48:53 +03:00
Rokas Kupstys dfa61b7ad2 [SQUASH] Fix informatives for each pair not being created because dataprovider was not available.
Fix not being able to have informative dataframe of a pair in whitelist.
2021-09-18 10:48:53 +03:00
Matthias 853c3a4433
Merge pull request #5587 from raph92/patch-3
Update prepare_trials_columns() return type
2021-09-18 08:08:18 +02:00
raphael 4b2c1a9b8e
Remove trailing whitespace 2021-09-17 14:39:15 -04:00
raphael e715f2a253
Update formatting
Line 302 was too long
2021-09-17 14:23:26 -04:00
raphael 9525a5b96c
Add type to "trials" parameter 2021-09-17 14:10:37 -04:00
Matthias 4d558879e9 Merge branch 'feat/short' into pr/samgermain/5378 2021-09-17 19:33:35 +02:00
raphael 124e97f3b9
Remove ununsed variables from export_csv_file 2021-09-17 11:57:36 -04:00
raphael 3a98fb72a4
Update prepare_trials_columns() return type
Was returning str, updated to pd.DataFrame
2021-09-17 11:42:33 -04:00
Matthias d680fdf33a Merge branch 'develop' into feat/short 2021-09-17 11:16:37 +02:00
Matthias 994c3c3a4c Add some errorhandling for custom estimator 2021-09-16 07:13:25 +02:00
Matthias c0811ae896 Add possibility to override estimator from within hyperopt 2021-09-15 21:36:53 +02:00
Matthias 57ea0c322f Rename indicator_space to buy_indicator_space 2021-09-15 20:20:31 +02:00
Sam Germain d77ab337bf merged with develop 2021-09-14 18:26:46 -06:00
Matthias 315ea1e116
Merge pull request #5566 from freqtrade/remove_hyperopt
Remove legacy hyperopt
2021-09-14 19:20:58 +02:00
Sam Germain 5225bd4a5b Merge branch 'develop' into feat/short 2021-09-13 14:02:23 -06:00
Matthias a12c3ecc9b Remove credentials whenever dry-run is set from within the exchange 2021-09-13 20:27:32 +02:00
Matthias fd6bf591f8 Update some tests to remove explicit hyperopt interface 2021-09-12 08:18:13 +02:00
Matthias dad4a49e81 Remove legacy hyperopt interface from hyperopt.py 2021-09-12 08:18:13 +02:00
Sam Germain 695a8fc73b comment updates, formatting, TODOs 2021-09-08 03:09:39 -06:00
Matthias 68b75af08e Fix bug with inversed sell signals in backtesting 2021-09-05 08:59:18 +02:00
Matthias ca44d2e092 Merge branch 'feat/short' into pr/samgermain/5378 2021-09-04 19:54:34 +02:00
Matthias 5184cc7749 Merge branch 'develop' into feat/short 2021-09-02 07:03:14 +02:00
Matthias b0c4f079c2 Merge branch 'develop' into feat/backtest_detail 2021-08-31 20:16:42 +02:00
Matthias 2ce458810b rename default_hyperopt_loss file 2021-08-26 19:39:57 +02:00
Matthias 053d6d8ee1 Merge branch 'feat/short' into pr/samgermain/5378 2021-08-25 20:34:52 +02:00
Matthias e1c3b7fd8c Merge branch 'develop' into feat/short 2021-08-25 20:31:40 +02:00
Matthias 7fb570cc58 hyperopt Fallback methods should not be used. 2021-08-25 20:28:55 +02:00
Matthias 23d21d8ace Fix wrong message if protection-space is missing
closes #5480
2021-08-25 19:57:10 +02:00
Matthias cb4889398b Fix backtesting bug 2021-08-25 07:03:48 +02:00
Matthias 6524edbb4e Simplify should_exit interface 2021-08-24 20:47:54 +02:00
Matthias b40f985b13 Add short-exit logic to backtesting 2021-08-24 20:02:40 +02:00
Matthias eb71ee847c Rename backtest index constants 2021-08-24 06:56:06 +02:00
Matthias 11bd8e912e Fix some tests 2021-08-24 06:52:28 +02:00
Matthias 7a977a8eaf Merge branch 'feat/short' into pr/samgermain/5378 2021-08-24 06:28:16 +02:00
Matthias 957551ea97 Merge branch 'develop' into feat/short 2021-08-24 06:25:06 +02:00
Matthias 7373b39015 Initial support for backtesting with short 2021-08-23 21:16:26 +02:00
Matthias 3e8164bfca Use proper exchange name in backtesting 2021-08-23 21:13:47 +02:00
Sam Germain a5be535cc9 strategy interface: removed some changes 2021-08-21 17:06:04 -06:00
Sam Germain e2d5299116 Name changes for strategy 2021-08-18 13:22:54 -06:00
Matthias fa4ec9f83e Add explicit test for get_sell_trade_entry 2021-08-15 14:52:24 +02:00
Matthias 8405ccc15e Seperate detail data loading from regular backest-data loading 2021-08-14 16:33:01 +02:00
Matthias 88172fab82 Allow "detailed" backtesting timeframe to look into the candle 2021-08-14 16:04:23 +02:00
Matthias bdbac37be7
Merge pull request #5399 from rokups/rk/fix-buy-tag-backtest
Fix buy_tag not being saved to trade object.
2021-08-12 06:36:33 +02:00
Rokas Kupstys f6267c7514 Fix buy_tag not being saved to trade object.
Column is mistakenly excluded because advise_buy() creating this column runs after code detecting presence of buy_tag column.
2021-08-11 15:21:23 +03:00
ipqhjjybj 65d025923d add code 2021-08-11 14:35:16 +08:00
Matthias 0b6aedbc4c
Merge pull request #5395 from freqtrade/fix/hyperopt-show
Stream hyperopt-result in small batches
2021-08-10 19:54:02 +02:00
Matthias 039d6384ed Stream hyperopt-result in small batches
Avoiding memory-exhaustion on huge hyperopt results

closes #5305
closes #5149
2021-08-10 10:12:57 +02:00
Matthias 3f160c7144 Cache dataframe before cutting the first candle
This allows providing the "current closed" candle in all cases.
2021-08-10 09:14:29 +02:00
Matthias 5bfb9edf02 Only query date once from list 2021-08-09 15:42:17 +02:00
Matthias 895b912c71 Fix recently introduced lookahead bias in backtesting
closes #5388
2021-08-09 14:54:47 +02:00
Matthias a5f796bc97 refactor ohlcvdata_to_dataframe to advise_all_indicators 2021-08-09 14:53:18 +02:00
Matthias f17942b68f Fix random test failure 2021-08-09 11:18:18 +02:00
Matthias 47f641d12f Remove hyperopt-pickle result support 2021-08-09 07:04:18 +02:00
Matthias 3bd0c3d009 Remove legacy code from export to csv 2021-08-08 11:02:54 +02:00
Matthias faf16a64e5 Remove legacy hyperopt file support 2021-08-08 10:22:45 +02:00
Matthias 0ae4eccea5 Refactor Hyperopt-list and hyperopt-show to reduce some duplicate code 2021-08-08 10:06:35 +02:00
Matthias 6532aba765
Merge pull request #5360 from freqtrade/hyperopt_protections
Hyperopt protections and Boolean parameter
2021-08-07 09:42:05 +02:00
Sam Germain b9356a5564 Autopep8 formatting 2021-08-06 16:35:39 -06:00
Matthias a6454cfc39 Autoenable protections when protection-space is selected 2021-08-04 07:17:29 +02:00
Matthias 091bf7c4d2 Output protection space 2021-08-04 06:50:14 +02:00
Matthias 544e0da6c2 Add protection parameter space 2021-08-04 06:50:14 +02:00
Matthias 800b2eeaf0 Load protections as part of backtest()
this enables different values in hyperopt per epoch
2021-08-04 06:50:14 +02:00
Matthias dfc17f2bd1 Fix ci failure 2021-08-03 07:21:11 +02:00
Matthias 4ab03f7e37 Don't load fallback methods for autohyperopt 2021-08-02 21:17:56 +02:00
Matthias e70a742005 Reorder space methods in hyperopt 2021-08-02 21:12:10 +02:00
Matthias 056bc93bc6 backtesting needs startup_candle_count
fixes informative-pair loading  being different between --strategy-list and
--strategy.
2021-08-01 19:17:52 +02:00
Matthias 1ccc89d1e9 Store fully analyzed dataframe 2021-07-31 10:00:24 +02:00
Matthias b1cbc75e93 Properly cache pair dataframe in backtesting (without startup-range). 2021-07-31 08:45:04 +02:00
Matthias 138b126d03
Merge pull request #5299 from kevinjulian/feat/kevinjulian/add-buy-signal-name
Add buy signal name
2021-07-30 08:23:11 +02:00
kevinjulian aea5da0c73 changes testcase 2021-07-23 11:42:43 +07:00
kevinjulian f5a660f845 caps BUY_TAG_IDX 2021-07-21 20:19:56 +07:00
kevinjulian 49886874aa rename to buy_tag 2021-07-21 20:05:35 +07:00
kevinjulian 5d04d6ffa7 fix edge testcase 2021-07-20 23:40:32 +07:00
kevinjulian cbfedf8b29 fix backtest testcase 2021-07-20 23:25:00 +07:00
Kevin Julian edf9c08f06
Merge branch 'develop' into feat/kevinjulian/add-buy-signal-name 2021-07-20 19:19:46 +07:00
kevinjulian ed30c023cd fix some testcase 2021-07-20 19:08:14 +07:00
kevinjulian 9e63bdbac9 feat: add buy signal name 2021-07-20 04:58:20 +07:00
Matthias 365479f5e0 Remove startup-candles after populating buy/sell signals
closes #5242
2021-07-18 11:06:41 +02:00
Matthias 7b7d9c02d7
Merge pull request #5243 from freqtrade/feat/webservermode_progress
Introduce webserver mode subcommand
2021-07-18 10:48:55 +02:00
Matthias 38296e8689
Merge pull request #5189 from rokups/rk/custom-stake
Implement strategy-controlled stake sizes
2021-07-11 19:45:43 +02:00
Matthias 7ea0a74c53 Default to proposed stake 2021-07-11 14:11:41 +02:00
Rokas Kupstys 0e4466ca1e Implement strategy-controlled stake sizes. Expose `self.wallet` to a strategy. 2021-07-11 12:38:58 +03:00
Matthias ad26b0dad0 Don't void backtest object when not necessary 2021-07-10 10:59:00 +02:00
Matthias 6129c5ca9e Fix deprecation warnings from pandas 1.3.0
closes #5251
2021-07-09 20:46:38 +02:00
Matthias 2f33b97b95 Validate startup candles for backtesting correctly
closes #5250
2021-07-09 07:20:43 +02:00
octaviusgus d1104bd434 fix daily profit data and daily profit curve example 2021-07-06 22:47:39 +02:00
Matthias 005da97183 extract backtesting abort functionality 2021-07-06 19:48:28 +02:00
Matthias 830b2548bc Add backtest stopping 2021-07-06 19:48:28 +02:00
Matthias 134c61126e Properly track bt progress ... 2021-07-06 19:48:28 +02:00
Matthias 048008756f Add progress tracking for backtesting 2021-07-06 19:48:28 +02:00
Matthias 800e314bfd Store backtesting results in backtest instance 2021-07-06 19:48:28 +02:00
octaviusgus 4aa2ae37bd
add daily_profit_list
added extra key daily_profit in return of optimize_reports.generate_daily_stats
this allows us to analyze and plot a daily profit chart / equity line using snippet below inside jupyter notebook

```
# Plotting equity line (starting with 0 on day 1 and adding daily profit for each backtested day)

from freqtrade.configuration import Configuration
from freqtrade.data.btanalysis import load_backtest_data, load_backtest_stats
import plotly.express as px
import pandas as pd

# strategy = 'Strat'
# config = Configuration.from_files(["user_data/config.json"])
# backtest_dir = config["user_data_dir"] / "backtest_results"

stats = load_backtest_stats(backtest_dir)
strategy_stats = stats['strategy'][strategy]

equity = 0
equity_daily = []
for dp in strategy_stats['daily_profit']:
    equity_daily.append(equity)
    equity += float(dp)

dates = pd.date_range(strategy_stats['backtest_start'], strategy_stats['backtest_end'])

df = pd.DataFrame({'dates':dates,'equity_daily':equity_daily})

fig = px.line(df, x="dates", y="equity_daily")
fig.show()

```
2021-07-04 14:38:17 +02:00
Matthias 898bef1837
Merge pull request #5219 from freqtrade/hyperopt_paramfile
automatic Hyperopt paramfile
2021-07-04 13:56:52 +02:00
Matthias 77293b1f1e Remove Zero duration Trades
after the recent backtesting fixes, this metric no longer makes sense, as it can't really be 0 any longer.
2021-07-04 10:50:10 +02:00
Matthias a4096318e0 Provide full backtest-statistics to Hyperopt loss functions
closes #5223
2021-07-04 10:15:19 +02:00
Matthias 9d6860337f
Merge pull request #5212 from rokups/rk/trailing-stop-2
Trailing stoploss in backtesting v2
2021-07-03 08:39:30 +02:00
Matthias fbd91cd3f8 Improve formatting to avoid backslash newlines 2021-07-03 08:22:21 +02:00
Matthias b25ad68c44 Fix np.bool_ not outputting correctly 2021-07-02 20:52:25 +02:00
Matthias 15e36a20e1 Improve naming of default hyperopt serializer 2021-06-30 19:48:34 +02:00
Rokas Kupstys bc0742ae67 Fix extremely optimistic results when using a combination of custom_stoploss and trailing_stop. 2021-06-30 09:10:50 +03:00
Matthias 0809225a0a Update documentation to mention parameter strategy files 2021-06-30 07:05:20 +02:00
Matthias 645da51b5f Add test for parameter loading 2021-06-30 06:55:10 +02:00
Matthias dcf53ac3ff Add test for try_eport_params 2021-06-30 06:33:40 +02:00
Matthias 84703080b8 Extract hyperopt_defaults_serializer to hyperopt_tools 2021-06-29 20:51:29 +02:00
Matthias 62cdbdc26a Automatically export hyperopt parameters 2021-06-29 20:51:25 +02:00
barbarius a8117c6e0b Refactored to use results variable from for loop 2021-06-29 11:24:49 +02:00
Matthias 8ca0076332 Fix small typos 2021-06-29 06:50:47 +02:00
Matthias d4514f5f16 Introduce File versions to hyperopt result files 2021-06-29 06:50:47 +02:00
Matthias a7e9e362b7 Simplify printing logic for non-optimized parameters 2021-06-29 06:50:47 +02:00
Matthias 8b7010fc9a Update pprint name 2021-06-29 06:50:47 +02:00
Matthias aa5181ca81 Properly export non-optimized parameters 2021-06-29 06:50:47 +02:00
Matthias 34e6ce431f Print non-optimized parameters (also stop / roi) 2021-06-29 06:50:47 +02:00
Matthias 2310deec53 Update name to get non-optimized parameters 2021-06-29 06:50:47 +02:00
Matthias 8cdd1e3aef Fix some type errors 2021-06-29 06:50:47 +02:00
Matthias 2bf17f71e7 Dump parameters from hyperopt-show 2021-06-29 06:50:47 +02:00
barbarius a0f28f4a15 Added max open trades to strategy summary first line 2021-06-28 17:05:12 +02:00
barbarius 2e5b719de8 Added timerange above multiple strategy backtest result summary table 2021-06-28 10:54:54 +02:00
barbarius c99ae3b419 Added timerange above multiple strategy backtest result summary table 2021-06-28 10:20:34 +02:00
Matthias 1067a9f356 Move strategy-override signals to top-level of the config
closes #2867
2021-06-26 16:06:13 +02:00
aayush-jain18 d294ef10d7 unexpected docstring params 2021-06-25 23:56:16 +05:30
aayush-jain18 a46f60bd94 spell corrections 2021-06-25 22:10:04 +05:30
Matthias e40d481d09
Merge pull request #5014 from Rikj000/hyperopt-show-include-non-optimized-in-json
BugFix - `hyperopt-show --print-json` include non-optimized params
2021-06-19 07:42:15 +01:00
Rik Helsen 656bebd4da 🪲 Included completely non_optimized spaces in json + swapped merge dictionary order 2021-06-18 22:03:04 +02:00
Matthias e1010ff592 Don't load protections from config if strategy defines a property 2021-06-18 19:55:53 +02:00
Rik Helsen 1567804509 kwargs merge dictionaries instead of using loops 2021-06-17 22:41:49 +02:00
Cryptomeister Nox 85979c3176 * Adding command for Filtering
* Read latest Backtest file and print trades
2021-06-17 20:35:02 +02:00
Rik Helsen 546ca01071 ♻️ Fixed flake8 warning 2021-06-17 20:33:21 +02:00
Rik Helsen 90d37f5ec6 🔀 Merged upstream branches and fixed merge conflicts 2021-06-17 20:24:20 +02:00
Matthias 8bb464bd64
Merge pull request #5108 from rokups/rk/pessimistic-trailing-stoploss
Implement most pessimistic handling of trailing stoploss.
2021-06-17 18:41:00 +01:00
Matthias b38ab84a13 Add documentation mention about new behaviour 2021-06-17 06:48:41 +02:00
Matthias 1c9def2fdb
Update freqtrade/optimize/optimize_reports.py 2021-06-16 20:17:44 +01:00
barbarius 1bb04bb0c2 Moved daily avg trade row next to total trades on backtest results 2021-06-16 11:40:55 +02:00
Rokas Kupstys 6d5fc96714 Implement most pessimistic handling of trailing stoploss. 2021-06-15 09:05:36 +03:00
Matthias cf7394d01c Export backtesting results by default
closes #4977
2021-06-14 19:57:24 +02:00
Matthias eaf0aac77e Remove OrderedDict
as we're no longer supporting python 3.6
2021-06-13 11:47:18 +02:00
Matthias d54ee0eb04 Refactor hyperopt_tools naming 2021-06-13 11:24:24 +02:00
Matthias ef208012c4
Merge pull request #5104 from freqtrade/enums_own_module
Enums own package
2021-06-10 05:31:14 +01:00
Bruno Gouvea 40f1ede775 Simplifying HO's result function 2021-06-09 12:03:24 -03:00
Matthias d16a619489 Move SellType Enum to it's own module 2021-06-08 21:04:34 +02:00
Bruno Gouvea 3cce668353 Creating a control variable to determine the existence of max drawdown in the final result. 2021-06-08 02:57:44 -03:00
Bruno Gouvea 816bb531b3 Creating fake column for legacy mode on max drawdown 2021-06-08 02:42:55 -03:00
Bruno Gouvea 4595db39aa Displaying max. drawdown only when it is not legacy mode. 2021-06-08 02:18:00 -03:00
Bruno Gouvea c513c9685d Remove blank line (PEP8) 2021-06-07 18:20:04 -03:00
Bruno Gouvea 5c3a418e65 Adjusting drawdown column position. 2021-06-07 18:15:26 -03:00
Bruno Gouvea 35d6140068 Displays the max drawdown in the hyper optimization results table. 2021-06-07 17:53:19 -03:00
Matthias f920c26802 fix Hyperopt-list avg-time filters
These should use a numeric field (which currently isn't available).

closes #5061
2021-05-31 20:01:40 +02:00
Matthias 8a56af9192 Update onlyprofit loss should use absolute profit
closes #4934
2021-05-28 08:38:46 +02:00
Matthias a89364aa98 Merge branch 'develop' into pr/Antreasgr/4838 2021-05-27 14:59:39 +02:00
Matthias 3014bc3467 Don't use Sum sign in hyperopt to avoid compatibility problems 2021-05-27 14:22:11 +02:00
Matthias cf39dd2163 Fix csv-export error with new hyperopt format 2021-05-27 13:08:28 +02:00
Matthias 8e89d3e6e4 Fix sort error 2021-05-25 19:33:34 +02:00
Matthias cc5769e900 Convert np.int64 to proper int
closes #5018
2021-05-25 19:24:56 +02:00
Rikj000 bd44deea0d BugFix - hyperopt-show --print-json include non-optimized params 2021-05-24 18:51:33 +02:00
Matthias af16614bf2 Fix formatting issue 2021-05-24 07:48:36 +02:00
Priveyes 6f990c5976
Fix a rare error in save_result : ValueError: Out of range float values are not JSON compliant
freqtrade/freqtrade/optimize/hyperopt.py", line 166, in _save_result
    rapidjson.dump(epoch, f, default=str, number_mode=rapidjson.NM_NATIVE)
ValueError: Out of range float values are not JSON compliant
2021-05-23 18:49:07 +02:00
Matthias 971d5b2ecc
Merge pull request #5002 from freqtrade/track_rejected_trades
Track rejected trades
2021-05-23 14:56:50 +01:00
Matthias 3f956441fc Properly format % of zero_duration_trades 2021-05-23 15:53:54 +02:00
Matthias a39860e0de Add tests for rejected signals 2021-05-23 14:15:02 +02:00
Matthias 7f125315b0 Track Rejected Trades
closes #3423
2021-05-23 09:42:05 +02:00
Matthias 02faeb60a3
Merge pull request #4943 from rokups/rk/statistics
Extra statistics
2021-05-23 08:38:27 +01:00
Rokas Kupstys db985cbc2e Fix hyperopt-show failing to display old results with missing new fields. 2021-05-23 09:45:26 +03:00
Rokas Kupstys 25cc4eae96 Fix tests that broke after table formatting changed. 2021-05-22 15:25:37 +02:00
Rokas Kupstys 981b2df7ca Include win:loss ratio in results tables. 2021-05-21 12:18:08 +03:00
Rokas Kupstys debd98ad9a Make results table more compact by merging win/draw/loss columns and drawdown abs/% into single columns. 2021-05-21 11:36:23 +03:00
Rokas Kupstys e1dc1357ce Add drawdown column to strategy summary table. 2021-05-21 11:36:23 +03:00
Rokas Kupstys edcfa94093 Include zero duration trades in backtesting report. 2021-05-21 11:36:23 +03:00
Matthias f398888865 Refactor preprocessed trimming to seperate method 2021-05-21 08:26:19 +02:00
Kamontat Chantrachirathumrong 6172e67fcd
Update hyperopt.py 2021-05-20 11:56:31 +07:00
Kamontat Chantrachirathumrong c2b9da68e1
fix indent 2021-05-20 11:56:11 +07:00
Kamontat Chantrachirathumrong 1b3bfb2e7f
found root cause. 2021-05-20 11:50:15 +07:00
Kamontat Chantrachirathumrong 48210170e7
wrap with is not empty 2021-05-20 11:49:25 +07:00
Kamontat Chantrachirathumrong 082fb11bbe
Avoid having error `cannot set a frame with no defined index and a scalar` 2021-05-20 01:54:48 +07:00
Matthias ef4d1c24d7
Merge pull request #4941 from brookmiles/fix-stoploss-above-candle
prevent backtest stoploss trade price being set above candle high
2021-05-19 06:20:35 +02:00
Matthias 7a9853bfe1 Fix "Too many open Files" exception 2021-05-18 20:39:55 +02:00
Matthias 36eba0f110 Don't use "r+" memmap, but "r2 2021-05-17 21:05:48 +02:00
Matthias 6aa574fa2b Convert ROI result to proper json object
closes #4952
2021-05-17 20:58:50 +02:00
Matthias 4f968b4a6f
Merge pull request #4926 from rokups/rk/misc-fixes
Two fixes
2021-05-15 15:11:07 +02:00
Rokas Kupstys 2d5f465f1b Fix protections being loaded multiple times for first strategy when backtesting. 2021-05-15 13:37:03 +03:00
Rokas Kupstys 29fed37df3 Fix exception when few pairs with no data do not result in aborting backtest.
Exception is triggered by backtesting 20210301-20210501 range with BAKE/USDT pair (binance). Pair data starts on 2021-04-30 12:00:00 and after adjusting for startup candles pair dataframe is empty.

Solution: Since there are other pairs with enough data - skip pairs with no data and issue a warning.

Exception:
```
Traceback (most recent call last):
  File "/home/rk/src/freqtrade/freqtrade/main.py", line 37, in main
    return_code = args['func'](args)
  File "/home/rk/src/freqtrade/freqtrade/commands/optimize_commands.py", line 53, in start_backtesting
    backtesting.start()
  File "/home/rk/src/freqtrade/freqtrade/optimize/backtesting.py", line 502, in start
    min_date, max_date = self.backtest_one_strategy(strat, data, timerange)
  File "/home/rk/src/freqtrade/freqtrade/optimize/backtesting.py", line 474, in backtest_one_strategy
    results = self.backtest(
  File "/home/rk/src/freqtrade/freqtrade/optimize/backtesting.py", line 365, in backtest
    data: Dict = self._get_ohlcv_as_lists(processed)
  File "/home/rk/src/freqtrade/freqtrade/optimize/backtesting.py", line 199, in _get_ohlcv_as_lists
    pair_data.loc[:, 'buy'] = 0  # cleanup from previous run
  File "/home/rk/src/freqtrade/venv/lib/python3.9/site-packages/pandas/core/indexing.py", line 692, in __setitem__
    iloc._setitem_with_indexer(indexer, value, self.name)
  File "/home/rk/src/freqtrade/venv/lib/python3.9/site-packages/pandas/core/indexing.py", line 1587, in _setitem_with_indexer
    raise ValueError(
ValueError: cannot set a frame with no defined index and a scalar
```
2021-05-15 13:37:03 +03:00
Brook Miles 2eac23a15f if stoploss price is above the candle high, set it to candle open instead. this can occur if stoploss had previously been reached but the sell was prevented by `confirm_trade_exit` 2021-05-15 15:38:51 +09:00
Matthias 5e73195b30 Use linux lineseperator at all times 2021-05-15 07:01:32 +02:00
Matthias ecee42f561 Read pickle file in mmap mode 2021-05-13 20:13:04 +02:00
Matthias 1055862bc0 Extract data-load + dump from hyperopt
(Reduces memory-usage as the dataframes go out of scope)
2021-05-12 21:15:01 +02:00
Matthias 24a1d5a96f Change default hyperopt-name to be shorter 2021-05-12 19:06:13 +02:00
Matthias 3cbe40875d read hyperopt results from pickle or json 2021-05-12 06:06:30 +02:00
Matthias 06bf1aa274 Store epochs as json per line 2021-05-12 05:58:25 +02:00
Matthias 7398ea88e0 Change optimize_reports to convert dates to string earlier 2021-05-11 20:37:49 +02:00
Matthias 92186d89a2 Add some changes to strategytemplate 2021-05-09 09:56:36 +02:00
Rokas Kupstys 8d8c782bd0 Slice dataframe in backtesting, preventing access to rows past current time. 2021-05-08 18:40:49 +03:00
Rokas Kupstys f1eb653545 Fix strategy protections not being loaded in backtesting. 2021-05-08 10:29:47 +03:00
Rokas Kupstys 1b01ad6f85 Make exchange parameter optional and do not use it as parameter in backtesting. 2021-05-08 10:29:47 +03:00
Matthias 4b6cd69c81 Add test for no-exchange dataprovider 2021-05-08 10:29:47 +03:00
Rokas Kupstys d344194b36 Fix dataprovider in hyperopt. 2021-05-08 10:29:47 +03:00
Rokas Kupstys 6fb4d83ab3 Fix dataprovider in hyperopt. 2021-05-08 10:29:47 +03:00
Rokas Kupstys cdfa6adbe5 Store pair datafrmes in dataprovider for backtesting. 2021-05-08 10:29:47 +03:00
Rokas Kupstys d34da3f981 Revert "Add dataframe parameter to custom_stoploss() and custom_sell() methods."
This reverts commit 595b8735f8.

# Conflicts:
#	freqtrade/optimize/backtesting.py
#	freqtrade/strategy/interface.py
2021-05-08 10:29:47 +03:00
Matthias 513be11fd9 Fix hyperopt output
closes #4892
2021-05-07 20:23:11 +02:00
Matthias 554f5f14b6 Raise exception if no data is left 2021-05-07 06:41:15 +02:00
Matthias 4f529fe424 Don't use Arrow to get min/max backtest dates 2021-05-06 19:43:14 +02:00
Matthias da574e4e69 Small style fixes 2021-05-03 06:30:41 +02:00
Matthias fc110ea418 Support csv export for new and old versions 2021-05-02 20:41:45 +02:00
Matthias 287b43e999 Output strategy results including non-optimized parameters 2021-05-02 11:30:53 +02:00
Matthias d069ad43d8 Small reformatting in hyperopt 2021-05-02 11:01:26 +02:00
Matthias 8ee0b0d8e8 Store not optimized parameters (if applicable) 2021-05-02 10:46:04 +02:00
Matthias 46f0f66039 Keep dimensions stored in hyperopt class
There is no point in regenerating them and it will cause some
overhead as all space classes will be recreated for every epoch.
2021-05-02 09:48:37 +02:00
Matthias ced5cc7ce2 Don't recalculate min/max date - they won't change between epochs 2021-05-02 09:46:27 +02:00
Matthias ecdfb6e5ed Fix output of % for new format 2021-05-02 09:46:27 +02:00
Matthias 881cba336a Show backtesting result in hyperopt-show 2021-05-02 09:46:27 +02:00
Matthias 420e75af65 Extract show_backtest_result for one strategy 2021-05-02 09:46:27 +02:00
Matthias 97478abb9d Move format explanation string to HyperoptTools 2021-05-02 09:46:27 +02:00
Matthias f2e182002d Simplify calling backtesting by returning the proper result 2021-05-02 09:46:27 +02:00
Matthias e2e1d34828 Extract stake_currency param from hyperopt-explanationstring 2021-05-02 09:46:27 +02:00
Matthias 6aaaad29d7 Use backtesting output for hyperopt results 2021-05-02 09:46:27 +02:00
Matthias 545cba7fd8 Refactor optimize_report
we should not calculate non-daily statistics in the daily stats method
2021-05-02 09:46:27 +02:00