- Add Conversation model with user/anonymous_token/bot_id fields
- Add Message model linked to conversations
- Add AnonymousUser model for tracking anonymous chat limits
- Create /api/conversations endpoints (list, create, get, delete)
- Add POST /api/conversations/{id}/chat for messaging
- Add POST /api/conversations/{id}/set-bot for linking bot
- Implement rate limiter with system-wide (500/5hrs) and anonymous limits
- Anonymous users: max 50 chats, max 1 bot, max 1 backtest
- Add warning after 40 anonymous messages
- Register conversations router in main.py
- Add create_bot, list_bots, set_bot, get_bot_info tools to registry
Split conversational.py (2271 lines) into modular files:
- tools.py: TOOL_REGISTRY, get_tool_registry(), SKILL_EMOJIS
- help.py: format_* functions for slash command help
- client.py: MiniMaxClient, SYSTEM_PROMPT, TOOLS definitions
- agent.py: ConversationalAgent class with all methods
- __init__.py: Public exports from all modules
Updated bots.py import to use new module path.
Deleted conversational.py.
- Display token name and symbol in risk analysis output
- Handle is_honeypot: -1 as 'Unknown (could not determine)'
- Show risk level (Low/Medium/High) with risk score
- Use risk_level field instead of status
- Store recent search results in agent instance
- When price returns empty, suggest using /search tool
- Check if user input matches recent search results and use that address
The price API requires full contract addresses (0x...-bsc), but users typically provide symbols.
Now /price TRADOOR will search for the token and show price info from search results.
- Added _is_error_output helper to detect errors in CLI output
- API errors like 'API error 403' now show proper error message instead of 'No price data available'
- Updated all command execution methods to use the helper
- Added _execute_backtest_direct() that extracts params from message or strategy config
- Added _execute_simulate_direct() that extracts params from message or strategy config
- Both commands now execute directly when called with /backtest or /simulate
- If token address is missing, asks user for the parameter
Commands now execute in two steps:
1. User sends /search -> acknowledge and wait for param
2. User sends 'pepe' -> auto-execute search with 'pepe'
Commands without params (/backtest, /simulate, /trending, /strategy) execute directly.
Pending commands tracked via self.pending_command state.
- Added _execute_trending method that runs the trending CLI command
- Returns formatted list of trending tokens on BSC
- Shows error message if no tokens found or command fails
- Added _get_strategy_response method to query bot's strategy_config from DB
- Shows formatted strategy with conditions, actions, and risk management
- Shows helpful message if no strategy is configured yet
- Reset conversational.py to pr-58 working AVE integration
- Added TOOL_REGISTRY with all available slash commands
- Added _handle_slash_command for skill activation
- Slash commands show brief acknowledgment when used alone
- Slash commands with args are passed to AI for handling
- Added dropdown menu in ChatInterface for skill discovery
- Menu positions above textarea
- Menu shows filtered tools as user types
Implement slash command help system as described in issue #57:
- Add Tool Registry in backend with metadata for all available tools
- Add command parser for '/' prefix in ConversationalAgent
- Add slash command handling functions:
- '/' shows list of all available tools
- '/help' shows general help about Randebu
- '/<tool-name>' shows detailed help for specific tool
- Update frontend ChatInterface to detect '/' and show formatted help dropdown
- Add keyboard navigation (Arrow keys, Tab, Enter, Escape) for slash menu
- Add subprocess-based AVE Cloud Skills CLI integration for token data
- Add new tools: search_tokens, get_token, get_price, get_risk, get_trending
- Add get_trending tool for trending tokens on BSC
- Replace direct API calls with CLI subprocess calls
Bug fixes:
- Fix repo_root path calculation (5 → 6 dirname() calls)
- Handle API response where data is a list instead of dict
- Add defensive type checking for all API responses
- Handle string values in market_cap and volume formatting
- Handle None values before calling len()
- Handle nested token data structure (data.token) and alternative field names
- Handle integer/bool types for honeypot check (1/0 vs true/false)
- Handle -1 as unknown for honeypot status
- Show raw API response for debugging when data is missing
Instead of importing library functions directly, now calling the
ave_data_rest.py CLI script via subprocess. This follows the
recommended approach from the SKILL.md documentation.
Changes:
- Add _call_ave_script helper method for subprocess calls
- Update search_tokens, get_token, get_price, get_risk to use CLI
- Set AVE_USE_DOCKER=false to run scripts directly without Docker
- Remove direct imports of ave.http module
Agent can now manage simulations via conversation:
- 'start' (run simulation on token)
- 'stop' (stop running simulation)
- 'status' (check if running, show progress)
- 'results' (get current/latest simulation results)
Example conversations:
- 'Run a simulation on GRIAN' → starts simulation
- 'How's the simulation going?' → shows status
- 'Stop the simulation' → stops and shows results
- 'Show me the results' → shows simulation results
Agent can now run backtests via conversation:
- User can say 'backtest this strategy' or 'test on [token]'
- Agent extracts token address (from conversation or asks user)
- Agent runs backtest and presents results in chat with:
- Total Return
- Final Balance
- Win Rate
- Max Drawdown
- Sharpe Ratio
- Agent suggests strategy adjustments based on results
When selling, the sale proceeds (quantity * price) are now added to current_balance.
This ensures:
- Cash decreases when buying
- Cash increases when selling (including stop loss / take profit)
- Portfolio P&L is calculated correctly
Shows real-time portfolio metrics:
- Cash Balance
- Position (quantity and value)
- Entry Price / Current Price
- Unrealized P&L
- Total Value
- P&L (absolute and percentage)
Updates as simulation runs and trades are executed.
- Tests now run with candle_delay=0 for fast execution
- Simulation defaults to candle_delay based on interval (e.g., 30s for 1m)
- Progress saved to DB every 5 seconds during simulation
- User can now see real-time updates while simulation runs
Tests: 14 passing in 0.15s
test_full_simulation_workflow_generates_signals_and_trades:
- Creates klines with clear price movements
- Uses very low threshold (0.1%) to ensure signals generated
- Verifies signals are NOT empty
- Verifies trade_log is NOT empty
- Verifies BUY signals are generated
- Verifies results contain signals and trade_log
This test ensures the simulation engine is working correctly.
Shows what happened at each candle:
- BUY/SELL/HOLD actions
- Price at that time
- Reason for action
- Entry price for positions
Trade log is stored in DB and displayed in frontend.
- Use ResizeObserver to handle width changes
- Use tick() to ensure DOM is ready before drawing
- Access reactive values in effect to trigger on changes
- Fixed canvas sizing to use percentage width
The simulation engine completes in seconds, but the background task wasn't
saving klines to DB. Now we fetch klines first synchronously so the user
can see the price chart immediately after starting a simulation.
Also marks any stuck 'running' simulations as 'stopped'.