Skip to content

Commit

Permalink
Merge branch 'freqtrade:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
xsa-dev authored Oct 27, 2023
2 parents 4655363 + bb78285 commit 0b2a37a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.270'
rev: 'v0.1.1'
hooks:
- id: ruff

Expand Down
4 changes: 4 additions & 0 deletions docs/strategy-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,10 @@ The following lists some common patterns which should be avoided to prevent frus
- don't use `dataframe['volume'].mean()`. This uses the full DataFrame for backtesting, including data from the future. Use `dataframe['volume'].rolling(<window>).mean()` instead
- don't use `.resample('1h')`. This uses the left border of the interval, so moves data from an hour to the start of the hour. Use `.resample('1h', label='right')` instead.

!!! Hint "Identifying problems"
You may also want to check the 2 helper commands [lookahead-analysis](lookahead-analysis.md) and [recursive-analysis](recursive-analysis.md), which can each help you figure out problems with your strategy in different ways.
Please treat them as what they are - helpers to identify most common problems. A negative result of each does not guarantee that there's none of the above errors included.

### Colliding signals

When conflicting signals collide (e.g. both `'enter_long'` and `'exit_long'` are 1), freqtrade will do nothing and ignore the entry signal. This will avoid trades that enter, and exit immediately. Obviously, this can potentially lead to missed entries.
Expand Down
3 changes: 1 addition & 2 deletions freqtrade/freqai/data_drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ def set_initial_return_values(self, pair: str,
f"for more than {len(dataframe.index)} candles.")

df_concat = pd.concat([hist_preds, new_pred], ignore_index=True, keys=hist_preds.keys())
# remove last row because we will append that later in append_model_predictions()
df_concat = df_concat.iloc[:-1]

# any missing values will get zeroed out so users can see the exact
# downtime in FreqUI
df_concat = df_concat.fillna(0)
Expand Down
9 changes: 4 additions & 5 deletions tests/freqai/test_freqai_datadrawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,9 @@ def test_set_initial_return_values(mocker, freqai_conf):
hist_pred_df = freqai.dd.historic_predictions[pair]
model_return_df = freqai.dd.model_return_values[pair]

assert (hist_pred_df['date_pred'].iloc[-1] ==
pd.Timestamp(end_x_plus_5) - pd.Timedelta(days=1))
assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5)
assert 'date_pred' in hist_pred_df.columns
assert hist_pred_df.shape[0] == 7 # Total rows: 5 from historic and 2 new zeros
assert hist_pred_df.shape[0] == 8

# compare values in model_return_df with hist_pred_df
assert (model_return_df["value"].values ==
Expand Down Expand Up @@ -234,9 +233,9 @@ def test_set_initial_return_values_warning(mocker, freqai_conf):
hist_pred_df = freqai.dd.historic_predictions[pair]
model_return_df = freqai.dd.model_return_values[pair]

assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5) - pd.Timedelta(days=1)
assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5)
assert 'date_pred' in hist_pred_df.columns
assert hist_pred_df.shape[0] == 9 # Total rows: 5 from historic and 4 new zeros
assert hist_pred_df.shape[0] == 10

# compare values in model_return_df with hist_pred_df
assert (model_return_df["value"].values == hist_pred_df.tail(
Expand Down

0 comments on commit 0b2a37a

Please sign in to comment.