每根K线交易一次 — 收到新K线开仓,马上平仓。 专门用来测试飞书通知是否正常。
Timeframe
1m
Direction
Long & Short
Stoploss
-0.0%
Trailing Stop
No
ROI
0m: 0.0%
Interface Version
3
Startup Candles
2
Indicators
0
freqtrade/freqtrade-strategies
freqtrade/freqtrade-strategies
this strategy is based around the idea of generating a lot of potentatils buys and make tiny profits on each trade
freqtrade/freqtrade-strategies
this strategy is based around the idea of generating a lot of potentatils buys and make tiny profits on each trade
# EveryMinuteStrategy - trade on every single 1m candle
# Purpose: test Feishu webhook notifications
from pandas import DataFrame
from freqtrade.strategy import IStrategy
from datetime import datetime, timezone
class EveryMinuteStrategy(IStrategy):
"""
每根K线交易一次 — 收到新K线开仓,马上平仓。
专门用来测试飞书通知是否正常。
"""
INTERFACE_VERSION = 3
timeframe = '1m'
can_short = True
# Exit immediately — don't wait
minimal_roi = {"0": 0.0000001}
# Tiny stoploss to force exit if no profit
stoploss = -0.0001
# 1 trade at a time
max_open_trades = 1
# Don't need historical candles
startup_candle_count = 2
process_only_new_candles = False
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['buy_signal'] = 1
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Enter on every single candle
dataframe.loc[
(dataframe['buy_signal'] == 1),
['enter_long', 'enter_tag']
] = (1, 'minute_entry')
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Don't exit by signal — let minimal_roi / custom_exit handle it
return dataframe
def custom_exit(self, pair: str, trade, current_time, current_rate, current_profit, **kwargs):
# Exit 3 seconds after opening — generates both entry_fill and exit_fill notifications
if (current_time - trade.open_date_utc).total_seconds() > 3:
return 'instant_exit'
return None