4个月盈利58%, 目前最高盈利; stake_amount改成自动随amount成比例更新
This commit is contained in:
parent
02535ec1ce
commit
f8672df24f
@ -7,14 +7,14 @@
|
||||
"margin_mode": "isolated",
|
||||
"max_open_trades": 5,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 75,
|
||||
"stake_amount": 91,
|
||||
"tradable_balance_ratio": 1,
|
||||
"process_only_new_candles": false,
|
||||
"fiat_display_currency": "USD",
|
||||
"dry_run": true,
|
||||
"timeframe": "3m",
|
||||
"additional_timeframes": ["4h"],
|
||||
"dry_run_wallet": 2000,
|
||||
"dry_run_wallet": 2450,
|
||||
"cancel_open_orders_on_exit": true,
|
||||
"stoploss": -0.14,
|
||||
"max_entry_position_adjustment": 3,
|
||||
|
||||
@ -56,3 +56,4 @@
|
||||
│ Drawdown End │ 2025-05-24 17:27:00 │
|
||||
│ Market change │ 0.81% │
|
||||
└─────────────────────────────┴─────────────────────┘
|
||||
|
||||
|
||||
@ -15,23 +15,24 @@
|
||||
"max_open_trades": 5
|
||||
},
|
||||
"buy": {
|
||||
"add_position_callback": 0.053,
|
||||
"bb_length": 13,
|
||||
"bb_lower_deviation": 1.04,
|
||||
"bb_std": 3.0,
|
||||
"bb_width_threshold": 0.012,
|
||||
"h1_max_candles": 200,
|
||||
"h1_max_consecutive_candles": 3,
|
||||
"h1_rapid_rise_threshold": 0.064,
|
||||
"max_entry_adjustments": 4,
|
||||
"min_condition_count": 2,
|
||||
"rsi_bull_threshold": 54,
|
||||
"rsi_length": 16,
|
||||
"rsi_oversold": 47,
|
||||
"stochrsi_bull_threshold": 36,
|
||||
"stochrsi_neutral_threshold": 30,
|
||||
"volume_multiplier": 1.6,
|
||||
"stake_divisor": 2.719
|
||||
"add_position_callback": 0.053,
|
||||
"bb_length": 14,
|
||||
"bb_lower_deviation": 1.05,
|
||||
"h1_rapid_rise_threshold": 0.065,
|
||||
"min_condition_count": 2,
|
||||
"rsi_oversold": 42,
|
||||
"stake_divisor": 2.793,
|
||||
"step_coefficient": 1.45,
|
||||
"stochrsi_neutral_threshold": 29
|
||||
},
|
||||
"sell": {
|
||||
"exit_bb_upper_deviation": 0.99,
|
||||
@ -44,5 +45,5 @@
|
||||
"protection": {}
|
||||
},
|
||||
"ft_stratparam_v": 1,
|
||||
"export_time": "2025-10-01 07:04:56.228084+00:00"
|
||||
"export_time": "2025-10-05 16:38:39.948030+00:00"
|
||||
}
|
||||
@ -8,6 +8,7 @@ import pandas_ta as ta
|
||||
from freqtrade.persistence import Trade
|
||||
import numpy as np
|
||||
import datetime
|
||||
import pandas as pd
|
||||
import math
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -130,7 +131,20 @@ class FreqaiPrimer(IStrategy):
|
||||
missing_columns = [col for col in required_columns if col not in dataframe.columns]
|
||||
if missing_columns:
|
||||
logger.warning(f"[{metadata['pair']}] 数据框中缺少以下列: {missing_columns}")
|
||||
|
||||
|
||||
def custom_stake_amount(self, pair: str, current_time: pd.Timestamp,
|
||||
current_rate: float,
|
||||
proposed_stake: float,
|
||||
min_stake: float,
|
||||
max_stake: float,
|
||||
**kwargs) -> float:
|
||||
# 获取初始资金(回测中固定为dry_run_wallet的值)
|
||||
initial_balance = self.config.get('dry_run_wallet', 10000)
|
||||
# 始终以初始资金的3.75%计算
|
||||
desired_stake = initial_balance * 0.0375
|
||||
desired_stake = math.floor(desired_stake) # 取整,去掉小数点后的数字
|
||||
return max(min(desired_stake, max_stake), min_stake)
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# 计算 3m 周期的指标
|
||||
bb_length_value = self.bb_length.value
|
||||
@ -296,9 +310,9 @@ class FreqaiPrimer(IStrategy):
|
||||
dataframe['prev_market_state'] = dataframe['prev_market_state'].fillna('neutral')
|
||||
|
||||
# 记录当前的市场状态
|
||||
if len(dataframe) > 0:
|
||||
current_score = dataframe['market_score'].iloc[-1]
|
||||
current_state = dataframe['market_state'].iloc[-1]
|
||||
# if len(dataframe) > 0:
|
||||
# current_score = dataframe['market_score'].iloc[-1]
|
||||
# current_state = dataframe['market_state'].iloc[-1]
|
||||
#logger.info(f"[{metadata['pair']}] 熊牛得分: {current_score:.1f}, 市场状态: {current_state}")
|
||||
#logger.info(f"[{metadata['pair']}] 各时间框架趋势: 3m={'牛' if dataframe['trend_3m'].iloc[-1] == 1 else '熊'}, \
|
||||
# 15m={'牛' if dataframe['trend_15m'].iloc[-1] == 1 else '熊'}, \
|
||||
|
||||
@ -167,7 +167,7 @@ docker-compose run --rm freqtrade hyperopt $PAIRS_FLAG \
|
||||
--timerange ${START_DATE}-${END_DATE} \
|
||||
--random-state 42 \
|
||||
-e 2500 \
|
||||
-j 6 \
|
||||
-j 5 \
|
||||
--hyperopt-loss SharpeHyperOptLossDaily \
|
||||
--spaces buy \
|
||||
--fee 0.0016
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user