Download fix.py from raghava4u/Trading-Bot-M20: direct link, hf CLI and curl.
- Browser
- Download file 823 Bytes
-
https://huggingface.co/raghava4u/Trading-Bot-M20/resolve/main/fix.py
- Command line
-
hf download hf://raghava4u/Trading-Bot-M20/fix.py
-
curl -L -o fix.py https://huggingface.co/raghava4u/Trading-Bot-M20/resolve/main/fix.py
823 Bytes
| import sys | |
| with open('backtester/strategies.py', 'r', encoding='utf-8') as f: | |
| text = f.read() | |
| replacement = """ short_score = np.where(perfect_short_setup, 5.0, 0.0) | |
| # ???? Only trade WITH the daily trend (strict filter) ???? | |
| trend_allows_long = daily_trend >= 0.3 | |
| trend_allows_short = daily_trend <= -0.3 | |
| signals = pd.DataFrame(index=df.index) | |
| signals["entry"] = 0 | |
| signals.loc[(long_score >= min_confidence) & good_time & trend_allows_long, "entry"] = 1 | |
| signals.loc[(short_score >= min_confidence) & good_time & trend_allows_short, "entry"] = -1 | |
| # Tie-break""" | |
| text = text.replace(" short_score = np.where(perfect_short_setup, 5.0, 0.0)\n # Tie-break", replacement) | |
| with open('backtester/strategies.py', 'w', encoding='utf-8') as f: | |
| f.write(text) | |
| print('Done!') | |