dry-run log

This commit is contained in:
zhangkun9038@dingtalk.com 2025-05-13 05:12:59 +00:00
parent 17b917bbc2
commit 0931dc713e
3 changed files with 22 additions and 9 deletions

View File

@ -1,9 +1,21 @@
#!/bin/bash
source .venv/bin/activate
rm -rf user_data/models/*
rm -rf ./freqtrade/user_data/data/backtest_results/*
docker-compose -f docker-compose_backtest.yml run --rm freqtrade >output.log 2>&1
#docker-compose -f docker-compose_backtest.yml run --rm freqtrade >output.log 2>&1
freqtrade backtesting \
--logfile ./user_data/logs/freqtrade.log \
--freqaimodel XGBoostRegressor \
--config config_examples/theforcev7.json \
--strategy-path ./freqtrade/templates \
--strategy TheForceV7 \
--timerange 20250510-20250513 \
--breakdown week month \
--export trades \
--fee 0.0008 \
--cache none
sed -i 's/\x1B\[[0-9;]*m//g' output.log
python3 filter.py
@ -28,7 +40,6 @@ cd -
sed -i 's/\x1B\[[0-9;]*m//g' output.log
python3 filter.py
cp output_filted.log result/ -f
source .venv/bin/activate
cd tools/
python tradestocsv.py
cd -

View File

@ -70,10 +70,12 @@ services:
--config /freqtrade/config_examples/config_my_hyperopt.json
--strategy-path /freqtrade/templates
--strategy TheForceV7
--timerange 20250510-20250513
--timerange 20250510-20250514
--breakdown week month
--export trades
--fee 0.0008
--slippage 0.005
--export trades
--cache none
# command: >

View File

@ -1,6 +1,8 @@
from freqtrade.strategy import IStrategy
from pandas import DataFrame
import numpy as np
import os
import datetime
import pandas as pd
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
@ -190,10 +192,9 @@ class TheForceV7(IStrategy):
),
'exit_long'] = 1
return dataframe
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float,
time: str, current_time: 'datetime', **kwargs) -> bool:
log_path = '/freqtrade/user_data/dryrun_results/dry_run_trades.csv'
time_in_force: str, current_time: datetime, **kwargs) -> bool:
log_path = './user_data/dryrun_results/dry_run_trades.csv'
# 自动创建目录
os.makedirs(os.path.dirname(log_path), exist_ok=True)
# 写入日志
@ -201,10 +202,9 @@ class TheForceV7(IStrategy):
f.write(f"{pair},{current_time},,,{rate},,{amount},,,,,,,,\n")
return True
def confirm_trade_exit(self, pair: str, trade: 'Trade', order_type: str, amount: float,
rate: float, time: str, exit_reason: str, current_time: 'datetime', **kwargs) -> bool:
log_path = '/freqtrade/user_data/dryrun_results/dry_run_trades.csv'
rate: float, time_in_force: str, exit_reason: str, current_time: 'datetime', **kwargs) -> bool:
log_path = './user_data/dryrun_results/dry_run_trades.csv'
# 自动创建目录
os.makedirs(os.path.dirname(log_path), exist_ok=True)
# 计算盈亏