Commit Graph

1121 Commits

Author SHA1 Message Date
7108907e0e Add Redis support for SignalR backplane and caching
- Introduced Redis configuration in appsettings.json to enable SignalR backplane functionality.
- Updated Program.cs to conditionally configure SignalR with Redis if a connection string is provided.
- Added Redis connection service registration in ApiBootstrap for distributed scenarios.
- Included necessary package references for StackExchange.Redis and Microsoft.Extensions.Caching.StackExchangeRedis in project files.
- Implemented password masking for Redis connection strings to enhance security.
2026-01-07 16:59:10 +07:00
bc4725ca19 Refactor FuturesBot and SpotBot to utilize ticker enum for candle retrieval
- Updated GetCurrentCandleForPositionClose method in both FuturesBot and SpotBot to parse the ticker parameter into an enum, enhancing type safety and clarity.
- Adjusted TradingBotBase to use the position's ticker for candle retrieval, ensuring consistency across trading bot implementations.
2026-01-07 01:44:05 +07:00
a0859b6a0d Refactor LlmController and GeminiProvider for improved message handling and redundant tool call detection
- Enhanced LlmController to detect and handle redundant tool calls, ensuring efficient processing and preventing unnecessary requests.
- Updated message formatting in GeminiProvider to align with Gemini's expectations, improving the structure of requests sent to the API.
- Improved logging in AiChat component to provide better insights into received responses and fallback mechanisms for empty content.
- Adjusted handling of final responses in AiChat to ensure meaningful content is displayed, enhancing user experience during interactions.
2026-01-07 00:54:23 +07:00
3fd9463682 Enhance LlmController and AiChat component with system reminders and developer mode
- Added system reminders in LlmController to prevent redundant tool calls and ensure final responses are text-only.
- Updated AiChat component to include a developer mode toggle, allowing users to filter out internal messages during chat interactions.
- Adjusted message handling to improve clarity and user experience, particularly during tool execution and progress updates.
- Modified iteration handling for backtest queries to reflect updated logic for improved performance.
2026-01-06 23:32:29 +07:00
1b08655dfa Enhance LlmController and AiChat component for improved progress updates and message handling
- Introduced a new method in LlmController to generate descriptive messages for tool execution results, improving clarity in progress updates.
- Updated AiChat component to display progress messages in chat history, enhancing user experience during tool execution.
- Refactored progress indicator styling for better visual feedback and readability.
- Adjusted backtest query handling in LlmController to optimize iteration counts based on query type, improving performance and user interaction.
- Enhanced documentation for backtest tools in BacktestMcpTools to clarify usage and parameters, ensuring better understanding for developers.
2026-01-06 23:25:14 +07:00
b7b4f1d12f Refactor AiChat component to enhance message history navigation and input handling
- Introduced state management for message history, allowing users to navigate through previous messages using the up and down arrow keys.
- Updated input handling to reset history index when the user types a new message, improving user experience.
- Changed the key event handler from 'onKeyPress' to 'onKeyDown' for better control over key events during message input.
- Adjusted appsettings.json to simplify the default model configuration for Gemini integration.
2026-01-06 22:53:58 +07:00
2814d67c58 Implement revoke all approvals functionality in TradingController and related services
- Added a new endpoint in TradingController to revoke all token approvals for a specified Privy wallet address, with permission checks for user access.
- Implemented the revokeAllApprovals method in TradingService to handle the revocation logic, including error handling and logging.
- Updated IWeb3ProxyService and Web3ProxyService to support revocation requests to the Privy service.
- Introduced a new PrivyRevokeAllApprovalsResponse type for structured responses from the revocation process.
- Enhanced the UI in account tables to allow users to revoke approvals directly from the interface, providing feedback on success or failure.
- Updated appsettings.json to change the default model for Gemini integration.
2026-01-06 22:40:37 +07:00
afd9ddaad5 Update SuperTrendIndicatorBase to remove confidence level from signal generation
- Changed the confidence level parameter in AddSignal method calls from Medium to None for both long and short signals in SuperTrendIndicatorBase class.
- This adjustment aims to simplify signal generation logic and may impact trading strategy evaluations.
2026-01-06 22:00:15 +07:00
8acb35719d Add PrivyBalanceResponse type for improved type safety in wallet balance retrieval
- Introduced a new type definition for Privy balance response to enhance type safety and clarity in the getWalletBalanceImpl function.
- Updated the makePrivyRequest call to utilize the new PrivyBalanceResponse type, streamlining the handling of balance data.
- This change aims to improve code maintainability and reduce potential errors during balance retrieval processes.
2026-01-06 20:15:53 +07:00
ad654888f1 Enhance Privy API integration with fallback RPC support for wallet balance retrieval
- Added an AbortSignal parameter to the makePrivyRequest function to support request cancellation.
- Improved error handling in makePrivyRequest to preserve detailed error information for better debugging.
- Implemented a fallback mechanism in getWalletBalanceImpl to retrieve wallet balances via direct RPC calls when Privy API fails (e.g., 503 errors).
- Introduced a new getWalletBalanceViaRpc function to handle RPC balance retrieval, including detailed logging and error management.
- Enhanced overall error messaging to provide clearer feedback during balance retrieval processes.
2026-01-06 19:55:50 +07:00
949044c73d Enhance LlmController and GeminiProvider for improved rate limit handling
- Increased delay between iterations in LlmController from 500ms to 2000ms to better respect rate limits.
- Added retry logic in LlmController for handling rate limit errors (HTTP 429) with a 10-second wait before retrying.
- Introduced additional delay after tool calls in LlmController to further mitigate rate limit issues.
- Updated GeminiProvider to increase maximum retry attempts from 3 to 5 and base retry delay from 2s to 3s for better handling of rate limits.
- Enhanced logging for rate limit scenarios to provide clearer feedback during API interactions.
2026-01-06 19:43:11 +07:00
909d6f0b86 Refactor LlmController for improved service scope management and error handling
- Introduced IServiceScopeFactory to create a scope for background tasks, allowing access to scoped services like ILlmService and IMcpService.
- Enhanced error handling during chat stream processing, providing user-friendly error messages for database connection issues.
- Refactored SendProgressUpdate method to accept hubContext and logger as parameters, improving logging consistency.
- Updated InjectBacktestDetailsFetchingIfNeeded method to utilize scoped services, ensuring accurate backtest detail fetching.
- Improved overall error messaging and logging throughout the LlmController for better user feedback during chat interactions.
2026-01-06 19:26:06 +07:00
42cbfbb8d8 Refactor progress update messages and improve UI opacity in AiChat component
- Simplified progress update messages in LlmController by removing iteration details for clarity.
- Enhanced the visual appearance of the AiChat component by adjusting opacity levels for progress indicators and text elements, improving overall readability and user experience.
- Updated styling for tool name and error messages to ensure consistent visual feedback during chat interactions.
2026-01-06 19:00:35 +07:00
40a39849f5 Enhance LLM chat streaming and progress updates
- Implemented SignalR integration for real-time chat streaming in LlmController, allowing for progress updates during LLM interactions.
- Refactored AiChat component to handle streaming responses and display progress updates, including iteration status and tool call results.
- Introduced a new ProgressIndicator component to visually represent the current state of chat processing.
- Updated AiChatService to manage SignalR connections and handle streaming updates effectively, improving user experience during chat sessions.
- Enhanced error handling and messaging for better feedback during chat interactions.
2026-01-06 18:57:17 +07:00
86e056389d Implement streaming chat functionality in LlmController
- Added a new ChatStream endpoint to handle real-time chat interactions with LLMs, providing streaming progress updates.
- Introduced LlmProgressUpdate class to encapsulate various types of progress updates during chat processing, including iteration starts, tool calls, and final responses.
- Enhanced error handling and user authentication checks within the streaming process to ensure robust interaction.
- Refactored tool execution logic to safely handle tool calls and provide detailed feedback on execution status and results.
2026-01-06 18:18:06 +07:00
438a0b1a63 Implement rate limit handling and retry logic in GeminiProvider
- Added a retry policy with exponential backoff for handling transient errors and rate limits in the Gemini API provider.
- Introduced a delay between iterations in LlmController to prevent rapid bursts and avoid hitting rate limits.
- Enhanced logging for retries and error handling to improve visibility into API interactions and rate limiting behavior.
2026-01-06 17:55:29 +07:00
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
520ec7dfaf Update MaxConcurrentPerInstance in production settings
- Reduced the MaxConcurrentPerInstance value from 60 to 30 to optimize resource allocation and improve system performance under load.
- This change aims to enhance stability and responsiveness of the worker backtest compute process.
2026-01-06 17:09:10 +07:00
97e99d44d4 Implement buffer logic for token swaps in GMX plugin
- Introduced a new buffer amount to prevent overdraw when requested swap amounts exceed wallet balances, enhancing balance management.
- Updated swap logic to apply the buffer conditionally, ensuring safe transaction amounts are used during swaps.
- Improved logging to provide warnings when requested amounts exceed available balances, enhancing user feedback and transparency.
2026-01-06 16:54:10 +07:00
b928eac031 Enhance SpotBot closing price calculation and logging
- Implemented logic to calculate broker closing price from PNL when the price is zero or invalid, improving accuracy in trade reconciliation.
- Added detailed logging for calculated closing prices, including entry price, PNL, and leverage, to enhance visibility into trading performance.
- Updated handling of take profit and stop loss updates based on valid closing prices, ensuring more reliable position management.
2026-01-06 16:36:02 +07:00
58eee1a878 Update SpotBot PNL calculation and enhance documentation guidelines
- Added logic to calculate broker PNL when it is zero or invalid, using actual prices for more accurate profit and loss reporting.
- Improved logging to provide detailed information when PNL is calculated, enhancing visibility into trading performance.
- Updated documentation guidelines to discourage unnecessary .md files unless explicitly requested by users.
2026-01-06 16:24:53 +07:00
55eb1e7086 Enhance token handling and logging in GMX plugin
- Updated token retrieval logic to ensure non-synthetic tokens are prioritized for swaps, improving accuracy in token selection.
- Added detailed logging for token data, including assetSymbol and baseSymbol, to enhance visibility during token lookups.
- Introduced a new test case to validate the successful swap of USDC to BTC, confirming the resolution to the non-synthetic WBTC token.
- Improved error handling for token lookups, providing clearer feedback when a valid token symbol is not found.
2026-01-06 01:44:11 +07:00
09a6a13eb1 Enhance SpotBot position verification and logging
- Introduced a new method to verify the execution of opening swaps in history, ensuring positions are only marked as filled after confirming successful swaps.
- Improved logging to provide detailed feedback on swap confirmation status, including retries for pending swaps and error handling for verification failures.
- Adjusted position status update logic to enhance robustness in managing filled positions, preventing premature status changes.
2026-01-06 01:23:58 +07:00
94f86c8937 Refactor closing price determination in MessengerService
- Introduced a new variable to capture the closing price based on filled stop loss or take profit trades, improving clarity in the closing message.
- Enhanced message formatting to include the closing price when applicable, providing better feedback on trade outcomes.
- Streamlined conditional checks for filled trades to ensure accurate reporting of closing prices.
2026-01-06 00:51:36 +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
efbb116ed2 Enhance SpotBot position management and logging
- Introduced logic to check if the opening swap was canceled by the broker, marking positions as canceled when necessary.
- Adjusted orphaned balance thresholds for ETH and other tokens to improve balance management.
- Enhanced logging to provide detailed information on swap status, including warnings for canceled swaps and their implications on position management.
- Added a new method to verify swap execution status, improving the robustness of position handling in SpotBot.
2026-01-06 00:13:21 +07:00
6134364ddd Enhance SpotBot balance management after position closure
- Added logic to wait for ETH→USDC swap to settle before refreshing the USDC balance, preventing premature bot stoppage due to low balance.
- Implemented balance verification and cache invalidation for accurate balance checks post-swap.
- Improved logging to indicate the status of balance refresh and cache invalidation after closing a position.
2026-01-05 23:21:51 +07:00
815b172bb7 Refine SpotBot token balance handling and logging
- Adjusted max dust amount threshold based on token type: increased for ETH to account for gas reserves, while maintaining a lower threshold for other tokens.
- Enhanced logging to clarify when a position is closed, indicating if the remaining balance is expected for gas reserves or if it was successfully closed.
2026-01-05 22:27:38 +07:00
645bbe6d95 Enhance SpotBot slippage handling and logging
- Increased slippage tolerance from 0.6% to 0.7% to account for gas reserves.
- Improved logging to provide detailed information when adjusting position quantities due to slippage or when retaining original quantities.
- Updated CloseSpotPositionCommandHandler to use the position's opened quantity instead of the entire wallet balance, ensuring gas fees are preserved.
- Adjusted Web3ProxyService settings for retry attempts and operation timeouts to improve performance.
- Enhanced swap token implementation to handle native tokens correctly and increased operation timeout for better reliability.
2026-01-05 22:13:18 +07:00
a0d5e336d5 Improve error handling and logging in SpotBot position closing
- Added try-catch block around position closing logic to handle potential failures gracefully.
- Enhanced logging to provide detailed warnings when closing a position fails, ensuring the position status remains unchanged for retry on the next cycle.
- Re-threw exceptions for unhandled cases to inform callers of operation failures, improving overall robustness of the SpotBot.
2026-01-05 20:39:44 +07:00
700d975da7 Implement on-chain token balance retrieval and enhance SpotBot logging
- Added a new method in IWeb3ProxyService to retrieve token balances directly from the blockchain, ensuring accurate decimal handling.
- Updated ExchangeService to utilize the new on-chain balance method, replacing the previous balance retrieval logic.
- Enhanced SpotBot logging to provide clearer warnings when token balances are significantly lower than expected, and to log cases of excess token balances.
- Introduced a new API endpoint for fetching token balances on-chain, improving the overall functionality of the service.
2026-01-05 20:30:24 +07:00
25a2b202a1 Enhance SpotBot logging and orphaned position handling
- Updated SpotBot to log detailed information when detecting small token balances, indicating potential gas reserves or dust.
- Introduced a minimum threshold for orphaned positions, improving decision-making on whether to open new positions.
- Enhanced logging for potential zombie positions, providing clearer warnings when token balances are missing.
- Improved force close logging to clarify the status of remaining balances after attempts to clear them.
2026-01-05 19:49:59 +07:00
e880dea126 Enhance FuturesBot logging and code readability
- Updated FuturesBot logging to include a prefix indicating the bot type for better clarity in logs.
- Refactored signal retrieval code for improved readability by formatting the method call across multiple lines.
- Minor whitespace adjustments to enhance code consistency.
2026-01-05 19:11:04 +07:00
f578d8dc22 Refactor SpotBot position history logging
- Updated SpotBot to log detailed information when a closing position is found in the history, including position direction and dates.
- Enhanced logging for scenarios where no closing position is found or when position history is unavailable, improving clarity on position status.
- Removed outdated log messages to streamline the logging process.
2026-01-05 18:58:27 +07:00
13474b6abb Update LLM 2026-01-05 17:36:19 +07:00
fb3a628b19 Update llm prompt sys 2026-01-05 06:23:54 +07:00
3c8242c88a Implement force closing of remaining balance in SpotBot
- Added a new method to force close any remaining balance in a trading position if it was not fully closed.
- Enhanced logging to provide detailed information during the force close process, including current price checks and retry attempts.
- Implemented error handling to manage potential failures during the force close operation, ensuring manual intervention is flagged when necessary.
2026-01-05 06:04:18 +07:00
d53b6eee20 Update LlmService to prioritize Gemini as the default provider for BYOK and adjust provider selection logic
- Changed the default LLM provider for BYOK from Claude to Gemini.
- Updated the provider selection priority to Gemini > OpenAI > Claude for improved service efficiency.
- Removed redundant gemini provider check from the SelectProvider method to streamline the logic.
2026-01-05 05:41:48 +07:00
531ebd2737 Enhance LlmController with detailed data analysis workflow and proactive tool usage
- Expanded system message to include a comprehensive critical analysis workflow for data retrieval and analysis.
- Added specific guidelines for retrieving complete data and providing in-depth analysis for backtests, bundles, and indicators.
- Emphasized the importance of proactive engagement and multiple tool iterations to ensure thorough responses.
- Updated tool usage instructions to improve clarity and effectiveness in user interactions.
2026-01-05 00:33:28 +07:00
c78aedfee5 Enhance LlmController with caching and adaptive iteration logic
- Introduced IMemoryCache to cache available MCP tools for improved performance and reduced service calls.
- Updated system message construction to provide clearer guidance on LLM's domain expertise and tool usage.
- Implemented adaptive max iteration logic based on query complexity, allowing for more efficient processing of user requests.
- Enhanced logging to include detailed iteration information and improved context trimming to manage conversation length effectively.
2026-01-04 23:49:50 +07:00
073111ddea Implement iterative tool calling in LlmController for enhanced response accuracy
- Added support for iterative tool calling in LlmController, allowing multiple rounds of tool execution until a final answer is reached.
- Updated system message to provide clearer guidance on proactive tool usage and response expectations.
- Enhanced logging to track iterations and tool execution results, improving debugging and user feedback.
- Ensured that the final response is returned even if the maximum iterations are reached, maintaining user engagement.
2026-01-04 23:33:55 +07:00
a227c72e1f Enhance trading bot functionality and LLM system message clarity
- Added BotTradingBalance property to UserStrategyDetailsViewModel for better tracking of bot allocations.
- Updated DataController to include BotTradingBalance in the response model.
- Improved LlmController by refining the system message to ensure LLM understands its response capabilities and tool usage.
- Introduced new MCP tools for running and analyzing bundle backtests, enhancing backtesting capabilities for users.
- Implemented security measures in BotTools to ensure users can only access their own bots, improving data privacy.
2026-01-04 23:26:59 +07:00
df27bbdfa1 Add system message to LLM requests and improve indicator type resolution
- Introduced a system message in LlmController to clarify that tools are optional for LLM responses, enhancing user guidance.
- Refactored indicator type resolution in IndicatorTools to support fuzzy matching and provide suggestions for invalid types, improving user experience and error handling.
- Updated methods to utilize the new resolution logic, ensuring consistent handling of indicator types across the application.
2026-01-04 02:00:51 +07:00
8ce7650bbf Remove McpService and refactor dependency injection for MCP tools
- Deleted the McpService class, which was previously responsible for executing Model Context Protocol (MCP) tools.
- Updated the ApiBootstrap class to change the registration of IMcpService to the new Managing.Mcp.McpService implementation.
- Added new MCP tool implementations for DataTools, BotTools, and IndicatorTools to enhance functionality.
2026-01-03 22:55:27 +07:00
6f55566db3 Implement LLM provider configuration and update user settings
- Added functionality to update the default LLM provider for users via a new endpoint in UserController.
- Introduced LlmProvider enum to manage available LLM options: Auto, Gemini, OpenAI, and Claude.
- Updated User and UserEntity models to include DefaultLlmProvider property.
- Enhanced database context and migrations to support the new LLM provider configuration.
- Integrated LLM services into the application bootstrap for dependency injection.
- Updated TypeScript API client to include methods for managing LLM providers and chat requests.
2026-01-03 21:55:55 +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
78c2788ba7 Implement synthetic token validation and enhance swap logic in GMX plugin
- Added early validation to prevent swapping synthetic tokens, ensuring users are informed about the limitations of synthetic tokens.
- Enhanced the swap logic to handle synthetic tokens by falling back to a direct swap order transaction when synthetic tokens are involved or when the SDK swap fails.
- Improved the calculation of minimum output amounts based on swap path statistics or fallback to price-based calculations for better accuracy.
2026-01-02 23:45:32 +07:00
16421a1c9c Enhance token data retrieval and improve bot list filtering
- Updated `getTokenDataFromTicker` to support both synthetic and non-synthetic tokens by attempting to fetch v2 tokens first, falling back to a version-less search if necessary.
- Added minimum and maximum balance filters to the bot list, allowing users to specify balance constraints for better bot management.
- Refactored sorting direction to use a dedicated `SortDirection` enum for improved type safety.
2026-01-02 01:20:53 +07:00
9b83527acc Remove console.log for user 2026-01-01 22:31:09 +07:00
7091db99f0 Remove obsolete Aspire.Hosting.AppHost package reference from Managing.Workers project file 2026-01-01 22:30:36 +07:00