Commit Graph

1528 Commits

Author SHA1 Message Date
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
Matthias
9994fce577 Extract generation of report for one strategy to it's own method 2021-05-02 09:46:27 +02:00
Matthias
b125c975c7 Rename strategy_comparison method 2021-05-02 09:46:27 +02:00
Matthias
ac2e1eb3d7 Don't import joblib for regular strategies 2021-05-02 08:44:16 +02:00
Matthias
1cb430f59b Remove encoding specifics, gitattributes to echeckout as utf8 2021-05-01 17:41:40 +02:00
Matthias
e0ca3c014c Don't completely remove encode/decode 2021-05-01 17:12:48 +02:00
Matthias
30da307d13 Remove encode/decode for hyperopt 2021-05-01 17:01:52 +02:00
Matthias
e381df9098 extract has_space to Hyperopt-Tools 2021-05-01 16:36:35 +02:00
Matthias
7c8a367442 Update docs to not promote stoploss / take-profit 2021-04-28 20:36:06 +02:00
Matthias
2061162d79 Convert trade-opendate to python datetime 2021-04-26 20:01:13 +02:00
Rokas Kupstys
98f6fce2ec Use correct sell reason in case of custom sell reason. 2021-04-25 09:48:40 +03:00
Rokas Kupstys
595b8735f8 Add dataframe parameter to custom_stoploss() and custom_sell() methods. 2021-04-25 09:48:40 +03:00
Rokas Kupstys
1aad128d85 Support returning a string from custom_sell() and have it recorded as custom sell reason. 2021-04-25 09:48:40 +03:00
Matthias
88f26971fa Use defaultdict for backtesting 2021-04-24 19:15:09 +02:00
Matthias
f12e002686
Merge pull request #4775 from freqtrade/fix_wallet_unlimited
Fix wallet unlimited
2021-04-24 15:54:06 +02:00
Matthias
df16fbd742 Add "dataload complete" message to backtest + hyperopt 2021-04-23 19:22:41 +02:00
Matthias
d8c8a8d8c2 Remvoe pointless arguments from get_trade_stake_amount 2021-04-21 20:01:10 +02:00
Matthias
cfa9315e2a Prevent out of candle ROI sells 2021-04-20 20:29:53 +02:00
Matthias
ce870bbcf7 Use 3 decimals for ROI space 2021-04-15 21:38:20 +02:00
Matthias
52c482cecf Convert trailing and roi defaults to skdecimal 2021-04-14 20:36:34 +02:00
Matthias
e820814809 Default-stoploss-hyperopt should use decimal space, nto real 2021-04-14 20:32:34 +02:00
Matthias
9804e20114 Don't use _set_value for autoOpt-Spaces 2021-04-10 09:53:48 +02:00
Matthias
34e47db18d Test SKDecimal space 2021-04-09 22:15:24 +02:00
Matthias
5f67400649 Add SKDecimal Space 2021-04-09 21:58:15 +02:00
Matthias
7b2a0d46cb Fix typo 2021-04-05 15:38:25 +02:00
Matthias
b470672dfd
Merge pull request #4596 from rokups/rk/hyper-strategy
Support for creating auto-hyperoptable strategies.
2021-04-05 13:55:32 +02:00
Matthias
bd5e1c5096
Merge pull request #4660 from rextea/order_pairlist_results
Sort pair lists by total profit
2021-04-04 19:47:33 +02:00
rextea
9e56f6d4eb Sort pair lists by total profit 2021-04-04 01:19:38 +03:00
Matthias
9d4b5cc6bb Fix typo 2021-04-03 19:56:20 +02:00
Matthias
41cb2a6451 Merge branch 'develop' into pr/rokups/4596 2021-04-03 17:00:37 +02:00
Matthias
6555454bd2 Remove more ticker_interval occurances 2021-04-03 16:54:47 +02:00
Rokas Kupstys
ea43d5ba85 Implement DecimalParameter and rename FloatParameter to RealParameter. 2021-04-02 17:08:16 +03:00
Matthias
5acdc9bf42 Fix type errors by converting all hyperopt methods to instance methods 2021-04-01 06:47:23 +02:00
Rokas Kupstys
5e5b11d4d6 Split "enabled" to "load" and "optimize" parameters. 2021-03-31 12:31:28 +03:00
Matthias
2869d5368d Allow edge to use dynamic pairlists
closes #4298
2021-03-30 20:20:24 +02:00
Matthias
89bbfd2324 Remove candle_count from dataframe before backtesting
closes #3754
2021-03-29 20:26:54 +02:00
Matthias
8022386404 Type custom_hyperopt 2021-03-27 18:00:07 +01:00
Matthias
786ddc6a91 remove unused imports 2021-03-27 10:47:33 +01:00
rextea
76a02ff70a fix indentations 2021-03-26 18:49:17 +03:00
rextea
2bed41da5d Add days breakdown table to backtesting 2021-03-26 18:40:50 +03:00
Rokas Kupstys
40f5c7853e [SQUASH] Add a way to temporarily disable a parameter (excludes from parameter loading/hyperopt) and print parameter values when executed. 2021-03-26 16:56:24 +02:00
Rokas Kupstys
fd45dfd894 [SQUASH] Make skopt imports optional. 2021-03-26 16:56:24 +02:00
Rokas Kupstys
11689100e7 [SQUASH] Fix exception when HyperOpt nested class is not defined. 2021-03-26 16:56:24 +02:00
Rokas Kupstys
e9f0babe8a [SQUASH] Use HyperStrategyMixin as part of IStrategy interface. 2021-03-26 16:56:24 +02:00
Rokas Kupstys
2d13e5fd50 [SQUASH] Oopsies. 2021-03-26 16:56:24 +02:00
Rokas Kupstys
bb89e44e19 [SQUASH] Address PR comments.
* Split Parameter into IntParameter/FloatParameter/CategoricalParameter.
* Rename IHyperStrategy to HyperStrategyMixin and use it as mixin.
* --hyperopt parameter is now optional if strategy uses HyperStrategyMixin.
* Use OperationalException() instead of asserts.
2021-03-26 16:56:24 +02:00
Rokas Kupstys
0a205f52b0 Optional support for defining hyperopt parameters in a strategy file and reusing common hyperopt/strategy parts. 2021-03-26 16:56:24 +02:00
Matthias
8da7d5c009
Merge pull request #4594 from rextea/add_confirm_exit_enter_tade_to_backtesting
Add confirm_trade_exit and confirm_trade_entry to backtesting
2021-03-25 20:26:56 +01:00
Matthias
292ea8c1d0
Update backtesting.py 2021-03-25 09:34:33 +01:00
rextea
0ca95aa0c2 Change rate to acctual close rate 2021-03-25 10:25:25 +02:00
Matthias
ec15610bff Fix isort issue 2021-03-24 19:21:07 +01:00
rextea
f51f4b1817 Add confirm_trade_exit and confirm_trade_entry to backtesting 2021-03-23 10:35:46 +02:00
rextea
dc4ea604dd Add confirm_trade_exit and confirm_trade_entry to backtesting 2021-03-23 10:19:16 +02:00
rextea
eb5d69dcd4 Add confirm_trade_exit and confirm_trade_entry to backtesting 2021-03-23 10:12:08 +02:00
rextea
6856963aef Add confirm_trade_exit and confirm_trade_entry to backtesting 2021-03-23 10:09:41 +02:00
Matthias
76ca3c219f extract result-printing from hyperopt class 2021-03-17 20:45:15 +01:00
Matthias
b57c150654 Final balance should include forcesold pairs 2021-03-14 09:48:40 +01:00
Matthias
cd8d9f2930
Merge pull request #4534 from rokups/patch-1
Provide access to strategy instance from hyperopt class.
2021-03-13 17:14:47 +01:00
Rokas Kupstys
5e872273d1 Provide access to strategy instance from hyperopt class. 2021-03-13 15:13:42 +02:00
Matthias
d1acc8092c Improve backtest performance 2021-03-13 10:17:14 +01:00
Matthias
0db5c9746f
Merge pull request #4454 from freqtrade/backtest_compound_speed
Backtest compound, wallet, ...
2021-03-10 10:07:40 +01:00
Matthias
4b550dab17 Always reset fake-databases
Otherwise results may stick around for the next strategy
2021-03-08 19:40:29 +01:00
Matthias
0b81b58d28 Use pandas.values.tolist instead of itertuples
speeds up backtesting
closes #4494
2021-03-07 11:28:54 +01:00
Patrick Weber
4532222010
Fixed line length in HyperOpt for new name
Fixed line length errors and multiple f strings to facilitate strategy being added in the name
2021-03-05 13:16:49 -06:00
Patrick Weber
345f7404e9
Add strategy name to HyperOpt results filename
This just extends the HyperOpt result filename by adding the strategy name. This allows analysis of HyperOpt results folder with no additional necessary context. An alternative idea would be to expand the result dict, but the additional static copies are non value added.
2021-03-05 12:56:11 -06:00
Matthias
731ab5d2a7 Fix too long line errors 2021-03-05 19:22:57 +01:00
Matthias
bc05d03126 Make best / worst day absolute 2021-03-05 19:21:09 +01:00
raoulus
0968ecc1af added "Median profit" column to hyperopt -> export-csv 2021-03-04 17:27:04 +01:00
Matthias
078b77d41b Fix crash when using unlimited stake and no trades are made 2021-03-02 16:12:22 +01:00
Joe Schr
55a315be14 fix: avg_stake_amount should not be NaN if df is empty 2021-03-02 13:38:55 +01:00
Matthias
2083cf6ddf Fix mypy errors introduced by Arrow update 2021-03-01 08:57:57 +01:00
Matthias
9cb37409fd Explicitly convert starting-balance to float 2021-02-28 09:56:29 +01:00
Matthias
b2e9295d7f Small stylistic fixes 2021-02-27 19:57:42 +01:00
Matthias
324b9dbdff Simplify wallet code 2021-02-27 10:33:25 +01:00
Matthias
98f3142b30 Improve handling of backtesting params 2021-02-27 09:33:00 +01:00
Matthias
fc256749af Add test for backtesting _enter_trade 2021-02-27 09:33:00 +01:00
Matthias
53a57f2c81 Change some types
Fix types of new model object
2021-02-27 09:33:00 +01:00
Matthias
03eb23a4ce 2 levels of Trade models, one with and one without sqlalchemy
Fixes a performance issue when backtesting with sqlalchemy, as that
uses descriptors for all properties.
2021-02-27 09:33:00 +01:00
Matthias
394a6bbf2a Fix some type errors 2021-02-27 09:33:00 +01:00
Matthias
52acacbed5 Check min-trade-stake in backtesting 2021-02-27 09:33:00 +01:00
Matthias
f04f07299c Improve backtesting metrics 2021-02-27 09:33:00 +01:00
Matthias
7913166453 Improve performance by updating wallets only when necessary 2021-02-27 09:33:00 +01:00
Matthias
f367375e5b ABS drawdown should show wallet high and low values 2021-02-27 09:33:00 +01:00
Matthias
0d2f877e77 Use absolute drawdown calc 2021-02-27 09:32:59 +01:00
Matthias
74fc4bdab5 Shorten debug log 2021-02-27 09:32:59 +01:00
Matthias
72f21fc5ec Add trade-volume metric 2021-02-27 09:32:59 +01:00
Matthias
35e6a9ab3a Backtest-reports should calculate total gains based on starting capital 2021-02-27 09:32:59 +01:00
Matthias
8d61a26382 Allow dynamic stake for backtesting and hyperopt 2021-02-27 09:32:59 +01:00
Matthias
e4abe902fc Enable compounding for backtesting 2021-02-27 09:32:59 +01:00
Matthias
0faa6f84dc Improve Wallet logging disabling for backtesting 2021-02-27 09:32:59 +01:00
Matthias
081b9be45c use get_all_locks to get locks for backtest result 2021-02-27 09:32:59 +01:00
Matthias
712d503e6c Use sell-reason value in backtesting, not the enum object 2021-02-27 09:32:59 +01:00
Matthias
b5177eadab Extract close method for exchange 2021-02-27 09:32:59 +01:00
Matthias
4ce4eadc23 remove only ccxt objects when hyperopting 2021-02-27 09:32:59 +01:00
Matthias
9361aa1c95 Add wallets to backtesting 2021-02-27 09:32:59 +01:00
Matthias
11b20d6932 Add config to hyperopt_loss_function documentation 2021-02-17 07:04:29 +01:00
Matthias
eff0d46ea1
Merge pull request #4375 from flomerz/pass_processed_data
pass data and config to loss function
2021-02-16 20:06:50 +01:00
Matthias
009a447d8a Adjust documentation for new parameter in loss functions 2021-02-16 19:51:09 +01:00
Florian Merz
3e06cd8b3a pass data and config to loss function 2021-02-16 10:11:33 +01:00
Florian Reitmeir
5c263c7ffd add backtesting results abs profit min/abs profit max, to get a better view if a strategy has a enough money to succeed 2021-02-14 19:41:12 +01:00
Matthias
e7acee7904 Improve coin value output by rounding coin specific 2021-02-13 16:05:56 +01:00
Matthias
072abde9b7 Introduce round_coin_value to simplify coin rounding 2021-02-13 16:05:35 +01:00
Matthias
c659150d9f Also print trade_duration in seconds to json 2021-01-25 19:42:34 +01:00
Matthias
62e43539c9 Limit max_open_trades to maximum available pairs
closes #4008
2021-01-24 19:59:54 +01:00
Matthias
789a980a30 Fix tests for new export format 2021-01-24 19:42:32 +01:00
Matthias
deb8432d33 Streamline trade to dataframe conversion 2021-01-24 08:58:41 +01:00
Matthias
8ee264bc59 Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
Matthias
48977493bb Backtesting does not need to convert to BacktestResult object 2021-01-24 08:58:41 +01:00
Matthias
7c80eeea95 Add use_custom_stoploss to optimize_report 2021-01-19 22:51:12 +01:00
Matthias
0b65fe6afe Capture backtest start / end time 2021-01-14 19:09:25 +01:00
Matthias
9147106259 call bot_loop_start() in backtesting to allow setup-code to run 2021-01-14 19:09:25 +01:00
Matthias
baa1142afa Use preprocessed to get min/max date in hyperopt 2021-01-14 19:09:21 +01:00
Matthias
9d4cdcad10 Extract backtesting of one strategy 2021-01-14 19:04:42 +01:00
Matthias
f3de0dd3eb Fix support for protections in hyperopt
closes #4208
2021-01-14 06:53:40 +01:00
Matthias
63a579dbab Add sell_profit_offset parameter
Allows defining positive offsets before enabling the sell signal
2021-01-11 19:30:25 +01:00
Matthias
f11fd2fee1 Sort imports 2020-12-23 17:00:02 +01:00
Matthias
67193bca3d Move pairlists to be a plugin submodule 2020-12-23 16:54:35 +01:00
Matthias
266031a6be Disallow PerformanceFilter for backtesting
closes #4072
2020-12-16 19:24:47 +01:00
Matthias
f047297995 Improve wording, fix bug 2020-12-07 15:48:06 +01:00
Matthias
5849d07497 Export locks as part of backtesting 2020-12-07 11:39:01 +01:00
Matthias
bb51da8297 Fix slow backtest due to protections 2020-12-07 11:39:01 +01:00
Matthias
75a5161650 Support multis-strategy backtests with protections 2020-12-07 11:39:01 +01:00
Matthias
a3f9cd2c26 Only load protections when necessary 2020-12-07 11:39:01 +01:00
Matthias
e2d15f4082 Add parameter to enable protections for backtesting 2020-12-07 11:39:01 +01:00
Matthias
32189d27c8 Disable output from plugins in backtesting 2020-12-07 11:39:01 +01:00
Matthias
9f34aebdaa Allow closing trades without message 2020-12-07 11:39:01 +01:00
Matthias
b606936eb7 Make changes to backtesting to incorporate protections 2020-12-07 11:39:01 +01:00
Matthias
e40d97e05e Small formatting improvements 2020-11-28 17:52:29 +01:00
Matthias
5d3f59df90 Add best / worst trade 2020-11-28 17:45:56 +01:00
Matthias
a00f852cf9 Add best / worst pair to summary statistics 2020-11-28 17:37:10 +01:00
Matthias
a47d8dbe56 Small refactor, avoiding duplicate calculation of profits 2020-11-28 11:35:29 +01:00
Matthias
730c9ce471 Add Max_open_trades to summary metrics 2020-11-24 06:57:26 +01:00
Matthias
887d78171c
Merge pull request #3857 from freqtrade/arrow_deprecation_timestamp
Convert timestamp to int_timestamp for all arrow occurances
2020-11-02 16:40:43 +01:00
Matthias
e73203acb8 FIx bug with dmmp 2020-11-01 10:51:07 +01:00
Matthias
7a092271c5 Merge branch 'develop' into arrow_deprecation_timestamp 2020-10-20 20:01:54 +02:00
Matthias
cf2ae788d7 Convert backtesting rows to Tuples for performance gains 2020-10-18 17:16:57 +02:00