Commit Graph

41 Commits

Author SHA1 Message Date
e0a064456a Refactor bots allocation USD value calculation in AgentService and AgentGrain
- Updated the calculation of bots allocation USD value to directly sum BotTradingBalance from Bot entities, eliminating the need for additional service calls to fetch bot configurations.
- This change aims to prevent potential deadlocks and improve performance by reducing unnecessary asynchronous calls.
2026-01-06 17:39:01 +07:00
5e7b2b34d4 Refactor ETH balance and gas fee checks in SpotBot
- Updated balance checks to utilize user-defined thresholds for minimum trading and swap balances, enhancing flexibility.
- Improved gas fee validation by incorporating user settings, allowing for more personalized transaction management.
- Enhanced logging to provide clearer messages regarding balance sufficiency and gas fee limits, improving user feedback during operations.
2026-01-06 00:43:51 +07:00
fb49190346 Add agent summary update functionality and improve user controller
- Introduced a new endpoint in UserController to update the agent summary, ensuring balance data is refreshed after transactions.
- Implemented ForceUpdateSummaryImmediate method in IAgentGrain to allow immediate updates without cooldown checks.
- Enhanced StartBotCommandHandler to force update the agent summary before starting the bot, ensuring accurate balance data.
- Updated TypeScript API client to include the new update-agent-summary method for frontend integration.
2026-01-03 03:09:44 +07:00
aa3b06bbe4 Enhance user settings management by adding new properties and updating related functionality
This commit introduces additional user settings properties, including TrendStrongAgreementThreshold, SignalAgreementThreshold, AllowSignalTrendOverride, and DefaultExchange, to the User entity and associated DTOs. The UserController and UserService are updated to handle these new settings, allowing users to customize their trading configurations more effectively. Database migrations are also included to ensure proper schema updates for the new fields.
2025-12-30 06:48:08 +07:00
de540e0d45 Refactor agent summary update process; replace TrackBalanceOnBotStartAsync with UpdateSummary in IAgentGrain and AgentGrain, and adjust LiveTradingBotGrain to call UpdateSummary for improved balance tracking and strategy count accuracy. 2025-12-26 16:01:40 +07:00
7a3ede03ca Add balance tracking on bot start/restart; implement TrackBalanceOnBotStartAsync in IAgentGrain and AgentGrain, and trigger it in LiveTradingBotGrain. Enhance logging for balance tracking operations. 2025-12-26 15:43:46 +07:00
a07d7ede18 Fix backtest spot 2025-12-03 16:47:32 +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
4d4e5b6d25 Update position value calculations in AgentGrain and BotService
- Changed the calculation of USDC value in AgentGrain to use net profit and loss instead of realized profit.
- Added similar position value calculations in BotService, including error handling for position retrieval failures.
2025-11-20 20:34:12 +07:00
d341ee05c9 Add more tests + Log pnl for each backtest 2025-11-14 13:12:04 +07:00
79f07af899 Fix get Balance 2025-10-20 16:20:36 +07:00
ffb98fe359 Fix update agent save + revert market in redis 2025-10-08 21:32:48 +07:00
b2a4e1ca5d Fix agent volume 2025-10-08 19:57:19 +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
de0d042254 Use usdc balance instead usdc value for ensuring balance check 2025-10-05 01:36:25 +07:00
3635fb4c29 Use bot allocation on running strategies only 2025-10-04 13:54:14 +07:00
f72bfc4ab8 Update balance tracking 2025-10-03 16:43:20 +07:00
7c13ad5f06 Update Agent balance tracking 2025-10-03 15:30:39 +07:00
3e680ab815 Do not stop strategy if position open 2025-10-01 12:31:53 +07:00
014a3ed7e5 Fix agent count 2025-09-28 23:34:56 +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
16a56bd26c Add agent fees 2025-09-28 20:57:42 +07:00
a8d09c36b7 Update agent stats 2025-09-28 13:55:24 +07:00
6e07bac6ae Fix agent grain calculation 2025-09-28 11:47:47 +07:00
d432549d26 Clean and update event 2025-09-27 22:20:12 +07:00
44846a1817 Fix update AgentName 2025-09-24 11:35:40 +07:00
40f3c66694 Add ETH and USDC balance check before start/restart bot and autoswap 2025-09-23 14:03:46 +07:00
7c3c0f38ec Fix autoswap 2025-09-22 00:22:39 +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
98fdfb9793 Fix long time update AgentName 2025-09-17 14:47:28 +07:00
b0d2dcc6b9 Reduce Agent Summary call 2025-09-15 00:19:21 +07:00
2847778c7c Update pricing timing 2025-09-14 22:27:54 +07:00
cd93dede4e Add agentbalance 2025-08-15 19:35:01 +07:00
6a2e4e81b1 Update status to match UI 2025-08-14 18:08:31 +07:00
b70018ba15 Update summary on agentName change 2025-08-06 14:57:58 +07:00
2dcbcc3ef2 Clear a bit more 2025-08-05 19:34:42 +07:00
Oda
082ae8714b Trading bot grain (#33)
* Trading bot Grain

* Fix a bit more of the trading bot

* Advance on the tradingbot grain

* Fix build

* Fix db script

* Fix user login

* Fix a bit backtest

* Fix cooldown and backtest

* start fixing bot start

* Fix startup

* Setup local db

* Fix build and update candles and scenario

* Add bot registry

* Add reminder

* Updateing the grains

* fix bootstraping

* Save stats on tick

* Save bot data every tick

* Fix serialization

* fix save bot stats

* Fix get candles

* use dict instead of list for position

* Switch hashset to dict

* Fix a bit

* Fix bot launch and bot view

* add migrations

* Remove the tolist

* Add agent grain

* Save agent summary

* clean

* Add save bot

* Update get bots

* Add get bots

* Fix stop/restart

* fix Update config

* Update scanner table on new backtest saved

* Fix backtestRowDetails.tsx

* Fix agentIndex

* Update agentIndex

* Fix more things

* Update user cache

* Fix

* Fix account load/start/restart/run
2025-08-05 04:07:06 +07:00