Commit Graph

1111 Commits

Author SHA1 Message Date
5328d760dd Add support for backtesting trading types in LiveTradingBotGrain and TradingBox
- Introduced handling for TradingType.BacktestFutures and TradingType.BacktestSpot in LiveTradingBotGrain.
- Updated TradingBox to map backtest trading types to their respective futures and spot types.
2025-12-11 23:41:53 +07:00
a254db6d24 Update bot market type 2025-12-11 23:32:06 +07:00
35df25915f Add flagsmith 2025-12-11 19:22:54 +07:00
65d00c0b9a Add reconcilliation for cancelled position if needed 2025-12-11 18:35:25 +07:00
1426f0b560 Clean code, remove warning for future and spot 2025-12-11 14:36:35 +07:00
df8c199cce Clean tradingbot and spot and future 2025-12-11 14:10:38 +07:00
292a48d108 Fix close position 2025-12-11 12:23:01 +07:00
8ff9437400 Fix a bit the spot trading 2025-12-10 23:16:46 +07:00
931af3d3af Refactor SpotBot and ExchangeService for balance retrieval
- Updated SpotBot to fetch token balance directly using the new GetBalance method in IExchangeService.
- Modified IExchangeService to include a method for retrieving balance by ticker.
- Enhanced ExchangeService to implement the new balance retrieval logic for both EVM and non-EVM exchanges.
- Updated TokenService to streamline contract address and decimal retrieval for various tokens.
- Adjusted TradesModal to reflect changes in position status handling.
2025-12-08 23:37:10 +07:00
a2ed4edd32 Implement spot position history retrieval in SpotBot and related services
- Added CheckSpotPositionInExchangeHistory method to SpotBot for verifying closed positions against exchange history.
- Enhanced logging for Web3Proxy errors during position verification.
- Introduced GetSpotPositionHistory method in IEvmManager, IExchangeService, and IWeb3ProxyService interfaces.
- Implemented GetSpotPositionHistory in EvmManager and ExchangeService to fetch historical swap data.
- Updated GMX SDK integration to support fetching spot position history.
- Modified generated API types to include new trading type and position history structures.
2025-12-07 19:20:47 +07:00
15d8b38d8b Adapt spot for recovery 2025-12-05 15:24:51 +07:00
78edd850fe Add isLiveTrading helper to fix bug 2025-12-04 23:42:09 +07:00
b44e1f66a7 Fix spot bot 2025-12-04 21:21:48 +07:00
a07d7ede18 Fix backtest spot 2025-12-03 16:47:32 +07:00
c932fef289 Add spot trading 2025-12-02 14:38:54 +07:00
9f4aa16997 Update benchmark 2025-12-02 00:03:33 +07:00
5bd03259da Add BacktestSpotBot and update BacktestExecutor for spot trading support
- Introduced BacktestSpotBot class to handle backtesting for spot trading scenarios.
- Updated BacktestExecutor to support both BacktestFutures and BacktestSpot trading types.
- Enhanced error handling to provide clearer messages for unsupported trading types.
- Registered new command handlers for OpenSpotPositionRequest and CloseSpotPositionCommand in ApiBootstrap.
- Added unit tests for executing backtests with spot trading configurations, ensuring correct behavior and metrics validation.
2025-12-01 23:41:23 +07:00
3771bb5dde Refactor SwapGmxTokens functionality into TradingService
- Moved SwapGmxTokensAsync method from AccountService to TradingService to centralize trading operations.
- Updated AccountController and AgentGrain to utilize the new TradingService method for swapping GMX tokens.
- Removed the old SwapGmxTokensAsync method from IAccountService and its implementation in AccountService.
2025-12-01 22:49:30 +07:00
Oda
9d536ea49e Refactoring TradingBotBase.cs + clean architecture (#38)
* Refactoring TradingBotBase.cs + clean architecture

* Fix basic tests

* Fix tests

* Fix workers

* Fix open positions

* Fix closing position stucking the grain

* Fix comments

* Refactor candle handling to use IReadOnlyList for chronological order preservation across various components
2025-12-01 19:32:06 +07:00
ab26260f6d Prepare for refactoring 2025-11-26 19:26:57 +07:00
f81a2da9df Fix tests 2025-11-26 18:42:02 +07:00
cef8073314 Remove comments 2025-11-26 10:38:24 +07:00
a93c738032 Build docker image for workers 2025-11-25 12:26:17 +07:00
3802187155 Update BB volume protection 2025-11-25 12:04:26 +07:00
4b5c1c5ce0 Fix graph 2025-11-25 11:03:52 +07:00
6376e13b07 Add Bollinger Bands Volatility Protection indicator support
- Introduced BollingerBandsVolatilityProtection indicator in GeneticService with configuration settings for period and standard deviation (stdev).
- Updated ScenarioHelpers to handle creation and validation of the new indicator type.
- Enhanced CustomScenario, backtest, and scenario pages to include BollingerBandsVolatilityProtection in indicator lists and parameter mappings.
- Modified API and types to reflect the addition of the new indicator in relevant enums and mappings.
- Updated frontend components to support new parameters and visualization for Bollinger Bands.
2025-11-25 02:12:57 +07:00
3ec1da531a Fix stuck the bundle backtests 2025-11-25 00:12:23 +07:00
4b33b01707 Update ichimoku 2025-11-24 20:02:14 +07:00
4268626897 Add IchimokuKumoTrend indicator support across application
- Introduced IchimokuKumoTrend indicator in GeneticService with configuration settings for tenkanPeriods, kijunPeriods, senkouBPeriods, offsetPeriods, senkouOffset, and chikouOffset.
- Updated ScenarioHelpers to handle creation and validation of the new indicator type.
- Enhanced CustomScenario, backtest, and scenario pages to include IchimokuKumoTrend in indicator lists and parameter mappings.
- Modified API and types to reflect the addition of the new indicator in relevant enums and mappings.
2025-11-24 19:43:18 +07:00
478dca51e7 Add BollingerBandsPercentBMomentumBreakout indicator support across application
- Introduced BollingerBandsPercentBMomentumBreakout indicator in GeneticService with configuration settings for period and multiplier.
- Updated ScenarioHelpers to handle creation and validation of the new indicator type.
- Enhanced CustomScenario, backtest, and scenario pages to include BollingerBandsPercentBMomentumBreakout in indicator lists and parameter mappings.
- Modified API and types to reflect the addition of the new indicator in relevant enums and mappings.
2025-11-24 17:31:17 +07:00
9f7e345457 Enhance StochasticCross integration in CustomScenario and TradeChart components
- Refined StochasticCross indicator implementation in CustomScenario, adding new parameters and labels.
- Improved TradeChart visualization for StochasticCross, including %K and %D series representation.
- Updated API and types to ensure kFactor and dFactor properties are correctly integrated.
- Adjusted backtest and scenario pages to reflect StochasticCross in indicator lists and parameter mappings.
2025-11-24 16:32:42 +07:00
18f868a221 Add StochasticCross indicator support in CustomScenario and TradeChart components
- Implemented StochasticCross indicator in CustomScenario with associated parameters and labels.
- Enhanced TradeChart to visualize StochasticCross data, including %K and %D series.
- Updated API and types to include kFactor and dFactor properties for StochasticCross.
- Modified backtest and scenario pages to incorporate StochasticCross in indicator lists and parameter mappings.
2025-11-24 11:04:05 +07:00
43d7c5c929 Add StochasticCross indicator support in GeneticService and related classes
- Introduced StochasticCross indicator type in GeneticService with configuration settings for stochPeriods, signalPeriods, smoothPeriods, kFactor, and dFactor.
- Updated IIndicator interface and IndicatorBase class to include KFactor and DFactor properties.
- Enhanced LightIndicator class to support new properties and ensure proper conversion back to full Indicator.
- Modified ScenarioHelpers to handle StochasticCross indicator creation and validation, ensuring default values and error handling for kFactor and dFactor.
2025-11-24 10:39:53 +07:00
ad3b3f2fa5 Add command for adding indicators 2025-11-24 10:05:16 +07:00
9e3d8c74b9 Remove some logs from db 2025-11-24 01:26:10 +07:00
fef66f6d7b Update configuration settings and logging behavior for SQL monitoring
- Increased thresholds for maximum query and method executions per window to 500 and 250, respectively, to reduce false positives in loop detection.
- Enabled logging of slow queries only, improving performance by reducing log volume.
- Adjusted SQL query logging to capture only warnings and errors, further optimizing logging efficiency.
- Updated various settings across appsettings files to reflect these changes, ensuring consistency in configuration.
2025-11-24 01:02:53 +07:00
372d19f840 Refactor welcome message handling to UserService for Telegram channel updates
- Moved the welcome message logic from UserController to UserService to centralize user notification handling.
- Improved error logging for message sending failures, ensuring better traceability of issues.
- Enhanced user experience by maintaining the detailed setup information and friendly greeting in the welcome message.
2025-11-24 00:43:58 +07:00
220ca66546 Update welcome message format in UserController for Kaigen Notifications
- Revised the welcome message sent to users upon Telegram channel configuration to enhance clarity and engagement.
- Included detailed setup information and a friendly greeting to improve user experience.
- Updated notification types to reflect the new features and services provided by the Kaigen notification system.
2025-11-24 00:37:07 +07:00
4e797c615b Enhance Telegram channel validation in UserService and Formatings
- Updated UpdateTelegramChannel method to support both numeric channel IDs and Telegram URL formats.
- Improved error handling for invalid formats, ensuring clear exceptions for users.
- Refactored Formatings class to extract numeric channel IDs from URLs and handle formatting consistently.
2025-11-24 00:23:42 +07:00
47bea1b9b7 Update closing position on BotStop 2025-11-23 23:31:34 +07:00
6429501b70 Add more logs for auto-close on owned keys 2025-11-23 22:57:30 +07:00
c7c89c903f Enhance error handling and logging in BotController, LiveTradingBotGrain, and BotService
- Added specific handling for ServiceUnavailableException in BotController to return user-friendly messages.
- Improved logging for Orleans exceptions in both BotController and BotService to provide clearer context during errors.
- Implemented verification of position closure status in LiveTradingBotGrain, including timeout handling for closing positions.
- Enhanced logging for critical and non-critical operations during bot stop processes to ensure better traceability.
2025-11-23 21:49:23 +07:00
d10ce5e3ba Enhance error handling and logging in BotController, LiveTradingBotGrain, and BotService
- Added specific handling for ServiceUnavailableException in BotController to return user-friendly messages.
- Improved logging for Orleans exceptions in both BotController and BotService to provide clearer context during errors.
- Implemented verification of position closure status in LiveTradingBotGrain, including timeout handling for closing positions.
- Enhanced logging for critical and non-critical operations during bot stop processes to ensure better traceability.
2025-11-23 21:48:21 +07:00
411fc41bef Refactor BotController and BotService for improved bot management
- Cleaned up constructor parameters in BotController for better readability.
- Enhanced StartCopyTradingCommand handling with improved formatting.
- Updated bot deletion logic in BotService to delete associated positions and trigger agent summary updates.
- Added new method in TradingService for deleting positions by initiator identifier.
- Implemented error handling in StopBotCommandHandler to ensure agent summary updates do not disrupt bot stop operations.
2025-11-23 15:30:11 +07:00
9c8ab71736 Do not update the masterBotUserId if update change it to null 2025-11-22 16:32:00 +07:00
461a73a8e3 Add MasterBot configuration properties to TradingBotBase and ensure MasterBotUserId preservation in RestartBotCommandHandler
- Introduced IsForCopyTrading, MasterBotIdentifier, and MasterBotUserId properties in TradingBotBase for enhanced bot configuration.
- Updated RestartBotCommandHandler to preserve MasterBotUserId from the database bot configuration.
2025-11-22 15:42:17 +07:00
bd4d6be8d9 Fix restart bot without account 2025-11-22 15:27:43 +07:00
2a354bd7d2 Implement profitable bots filtering in BotController and DataController
- Added IConfiguration dependency to BotController for accessing environment variables.
- Updated GetBotsPaginatedAsync method in BotService and IBotService to include a flag for filtering profitable bots.
- Modified DataController to utilize the new filtering option for agent summaries and bot retrieval.
- Enhanced PostgreSqlBotRepository to apply filtering based on profitability when querying bots.
2025-11-22 14:02:29 +07:00
e69dd43ace Enhance DataController and BotService with new configuration and bot name checks
- Added IConfiguration dependency to DataController for environment variable access.
- Updated GetPaginatedAgentSummariesCommand to include a flag for filtering profitable agents.
- Implemented HasUserBotWithNameAsync method in IBotService and BotService to check for existing bots by name.
- Modified StartBotCommandHandler and StartCopyTradingCommandHandler to prevent duplicate bot names during strategy creation.
2025-11-22 13:34:26 +07:00
269bbfaab0 Add GetBotByUserIdAndNameAsync method to IBotService and BotService
- Implemented GetBotByUserIdAndNameAsync in IBotService and BotService to retrieve a bot by user ID and name.
- Updated GetUserStrategyCommandHandler to utilize the new method for fetching strategies based on user ID.
- Added corresponding method in IBotRepository and PostgreSqlBotRepository for database access.
2025-11-22 10:46:07 +07:00