Commit Graph

55 Commits

Author SHA1 Message Date
c4e444347c Fix bot update with the tradingtype 2025-12-13 14:46:30 +07:00
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
a07d7ede18 Fix backtest spot 2025-12-03 16:47:32 +07:00
c932fef289 Add spot trading 2025-12-02 14:38:54 +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
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
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
190a9cf12d Finish copy trading 2025-11-20 14:46:54 +07:00
ff2df2d9ac Add MasterBotUserId and MasterAgentName for copy trading support
- Introduced MasterBotUserId and MasterAgentName properties to facilitate copy trading functionality.
- Updated relevant models, controllers, and database entities to accommodate these new properties.
- Enhanced validation logic in StartCopyTradingCommandHandler to ensure proper ownership checks for master strategies.
2025-11-20 00:33:31 +07:00
97103fbfe8 Add master strategy validation in LiveTradingBotGrain
- Introduced a check to ensure the master strategy is retrieved successfully before proceeding with key validation.
- Added logging for cases where the master strategy is not found, improving traceability in the bot's operation.
2025-11-19 23:39:38 +07:00
c229212acd Add copy trading authorization checks in LiveTradingBotGrain and StartCopyTradingCommandHandler. Integrated IKaigenService to verify user ownership of master strategy keys before allowing copy trading. Enhanced error handling and logging for authorization verification. 2025-11-16 22:11:54 +07:00
ec88b124e6 Refactor LiveTradingBotGrain to close all open positions before stopping the bot. Introduced CloseAllOpenPositionsAsync method to handle position closure and logging, ensuring a smoother stop process. Removed the previous check for open positions in the database. 2025-11-16 18:22:48 +07:00
1e15d5f23b Add copy trading functionality with StartCopyTrading endpoint and related models. Implemented position copying from master bot and subscription to copy trading stream in LiveTradingBotGrain. Updated TradingBotConfig to support copy trading parameters. 2025-11-16 14:54:17 +07:00
b60295fcb2 Add test for dailysnapshot 2025-11-14 19:42:52 +07:00
460a7bd559 Fix realized pnl on backtest save + add tests (not all passing) 2025-11-14 02:38:15 +07:00
472c507801 Add netpnl and initialBalance to backtests 2025-10-16 17:19:22 +07:00
49b0f7b696 Fix restart with no accountName 2025-10-12 16:28:53 +07:00
ff74296c26 Fix restart/start if not account with the first account of the user 2025-10-12 16:08:12 +07:00
117d45fb50 Do not stop bot if position open 2025-10-11 00:32:02 +07:00
d71d47f644 Add reason when stopping bot 2025-10-10 23:31:32 +07:00
ffb98fe359 Fix update agent save + revert market in redis 2025-10-08 21:32:48 +07:00
fa160e2d1b Update messages 2025-10-08 20:30:57 +07:00
1a99224d18 Fix ROI calculation for Strategy 2025-10-08 19:37:24 +07:00
76b087a6e4 Fix status and filtered positions for metrics 2025-10-08 18:37:38 +07:00
86dd6849ea Fix status IsFinished/IsOpen/IsForMetrics + use redis for markets on gmx.tsx instead of inmemory cache 2025-10-08 12:13:04 +07:00
67065469a6 Fix config update + remove messages + Summary fix for not open position 2025-10-08 02:52:11 +07:00
ff7e4ed3d3 un-stopped bot return status "stopped" instead of the error 2025-10-07 16:10:14 +07:00
719ce96e11 Fix lastStartTime update 2025-10-07 02:00:39 +07:00
347c78afc7 Update messaging 2025-10-06 01:34:13 +07:00
dab4807334 Fix Runtime 2025-10-06 00:55:18 +07:00
f67ee330b3 Fix Runtime by adding TotalRuntimeInSeconds 2025-10-05 20:51:46 +07:00
b25f0be083 Remove extra message on the low usdc while position open 2025-10-05 02:49:33 +07:00
343b85dada Fix fetch and restart bot 2025-10-04 18:31:50 +07:00
15eba0fc3c Prevent bot from stopping if position is open 2025-10-04 17:43:43 +07:00
3e680ab815 Do not stop strategy if position open 2025-10-01 12:31:53 +07:00
f041c1e8e8 Add net Pnl in db 2025-09-28 22:18:58 +07:00
6267dad8fa Fix roi with fees 2025-09-28 21:42:08 +07:00
9bdfb989c1 Fix ROI 2025-09-24 01:19:10 +07:00
6aad2834a9 Add single time swap + fetch balance cache in AgentGrain 2025-09-21 23:41:27 +07:00
c2f3734021 Add Role based grain placement 2025-09-18 20:17:28 +07:00
530dd83daa Update Resume bot status 2025-09-18 13:23:26 +07:00
ffe69356d8 Fix reminding for livetradingbot 2025-09-18 12:19:52 +07:00
5216a0ae87 Removed reminder when stopped 2025-09-15 01:54:51 +07:00
2847778c7c Update pricing timing 2025-09-14 22:27:54 +07:00
28fef53ff8 Add automatic swap when low ETH 2025-08-28 06:49:14 +07:00
d2975be0f5 Merge workers into API 2025-08-16 04:55:33 +07:00
4a45d6c970 Add platform grain 2025-08-14 19:44:33 +07:00
6a2e4e81b1 Update status to match UI 2025-08-14 18:08:31 +07:00
9d0c7cf834 Fix bots restart/stop 2025-08-13 22:22:22 +07:00