Push merge conflict

This commit is contained in:
2025-07-04 11:02:53 +07:00
parent 88f195c0ca
commit 59c5de7df7
27 changed files with 1133 additions and 1118 deletions

View File

@@ -155,11 +155,10 @@ The `TradingBotConfig` class defines all configuration parameters for trading bo
| `Timeframe` | `Timeframe` | Candle timeframe for analysis |
| `IsForWatchingOnly` | `bool` | If true, bot only sends signals without trading |
| `BotTradingBalance` | `decimal` | Initial trading balance for the bot |
| `BotType` | `BotType` | Type of trading bot behavior |
| `IsForBacktest` | `bool` | Whether this config is for backtesting |
| `CooldownPeriod` | `int` | Number of candles to wait before opening new position in same direction |
| `MaxLossStreak` | `int` | Maximum consecutive losses before requiring opposite direction signal (0 = no limit) |
| `FlipPosition` | `bool` | Whether the bot can flip positions |
| `FlipPosition` | `bool` | Whether the bot can flip positions (default: false) |
| `Name` | `string` | Unique identifier/name for the bot |
| `FlipOnlyWhenInProfit` | `bool` | Only flip positions when current position is profitable (default: true) |
@@ -183,8 +182,10 @@ The `TradingBotConfig` class defines all configuration parameters for trading bo
- Only closes when position is in profit or at breakeven (never closes at a loss due to time)
- `CloseEarlyWhenProfitable` allows immediate closure when profitable instead of waiting full duration
**Profit-Controlled Flipping:**
- `FlipOnlyWhenInProfit` ensures safer trading by only flipping profitable positions
**Bot Behavior Control:**
- `IsForWatchingOnly` controls whether the bot executes actual trades or only analyzes and generates signals
- `FlipPosition` controls whether the bot can flip positions when opposite signals occur (default: false)
- `FlipOnlyWhenInProfit` ensures safer trading by only flipping profitable positions when flipping is enabled
- Helps prevent cascading losses in volatile markets
**Synth API Integration:**
@@ -213,27 +214,22 @@ The `TradingBotConfig` class defines all configuration parameters for trading bo
| CloseEarlyWhenProfitable | Close positions early when profitable (requires MaxPositionTimeHours) | false |
| BotTradingBalance | Initial trading balance for the bot | Required |
### Bot Types
### Bot Behavior Configuration
The `BotType` enum in `TradingBotConfig` defines the following trading bot behaviors:
Trading bots support flexible behavior configuration through boolean flags rather than predefined types:
| Type | Description |
|-------------|----------------------------------------------------------------------------------------|
| SimpleBot | Basic bot implementation for simple trading strategies |
| ScalpingBot | Opens positions and waits for cooldown period before opening new ones in same direction |
| FlippingBot | Advanced bot that can flip positions when opposite signals are triggered |
#### Watch-Only Mode
- **`IsForWatchingOnly`**: When `true`, the bot analyzes market conditions and generates signals but does not execute actual trades
- Perfect for strategy testing, signal validation, or paper trading
- Useful for developing confidence in a strategy before committing real capital
#### Flipping Mode Configuration
The flipping behavior is controlled by several `TradingBotConfig` properties:
- **`BotType`**: Set to `FlippingBot` to enable position flipping capabilities
- **`FlipPosition`**: Boolean flag that enables/disables position flipping (automatically set based on BotType)
#### Position Flipping
- **`FlipPosition`**: When `true`, enables the bot to flip positions when opposite signals are triggered
- **`FlipOnlyWhenInProfit`**: Safety feature that only allows flipping when current position is profitable (default: true)
#### How Flipping Works
#### How Position Flipping Works
**FlippingBot Behavior:**
**When Flipping is Enabled (`FlipPosition = true`):**
1. Opens initial position based on scenario signals
2. Monitors for opposite direction signals from the same scenario
3. When opposite signal occurs:
@@ -242,11 +238,12 @@ The flipping behavior is controlled by several `TradingBotConfig` properties:
4. Closes current position and immediately opens new position in opposite direction
5. Continues this cycle for the duration of the bot's operation
**ScalpingBot vs FlippingBot:**
- **ScalpingBot**: Opens position → Waits for exit signal → Closes → Cooldown → Opens new position
- **FlippingBot**: Opens position → Monitors for opposite signals → Flips immediately (no cooldown between flips)
**When Flipping is Disabled (`FlipPosition = false`):**
- Opens position → Waits for exit signal → Closes → Cooldown → Opens new position in same direction
- More conservative approach with cooldown periods between trades
- Reduces frequency of trades and potential whipsaw losses
This configuration allows for more aggressive trading strategies while maintaining risk management through the profit-controlled flipping mechanism.
This simplified configuration provides clear control over bot behavior while maintaining risk management through the profit-controlled flipping mechanism.
## Backtesting (`BacktestController`)