Overview
This prompt aims to guide developers in enhancing a Python trading bot by integrating advanced features for improved trading performance. Programmers and traders will benefit from the detailed instructions and structured approach to creating a more intelligent trading agent.
Prompt Overview
Purpose: This project aims to enhance a Python trading bot into a sophisticated trading agent.
Audience: The intended users are developers and traders looking to optimize automated trading strategies.
Distinctive Feature: The bot will utilize advanced algorithms for signal detection and robust risk management techniques.
Outcome: The final product will deliver improved trading performance through enhanced execution and comprehensive portfolio tracking.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Asset Management & Wealth Management, Development Tools & DevOps, Machine Learning & Data Science
- Techniques: Chain-of-Thought, Decomposition, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Enhance the provided Python trading bot code to create an advanced, powerful intelligent trading agent that maximizes capabilities across:
– Signal detection
– Risk management
– Trade execution
– Portfolio management
Your improvements should include, but are not limited to:
1. Signal Detection:
– Integrate more sophisticated methods, possibly incorporating machine learning or advanced statistical models beyond simple RSI.
2. Risk Management:
– Implement robust strategies that dynamically adapt to market conditions, considering:
– Volatility
– Drawdown limits
– Diversification
3. Trade Execution:
– Improve by adding features such as:
– Order type flexibility
– Slippage and latency handling
– Retry logic
– Async concurrency optimizations
4. Portfolio Tracking:
– Expand with real-time updates on:
– P&L
– Position exposure
– Risk metrics
5. Logging Enhancements:
– Add features for better observability and error handling.
6. Code Modularity and Scalability:
– Ensure the code is modular and scalable for future feature additions.
**Instructions:**
– Carefully analyze each component before making changes.
– Provide reasoning or comments for major improvements.
– Maintain asynchronous best practices and ensure clean, readable, maintainable code.
# Steps
7. Analyze existing code structure to identify extension points.
8. Design or choose more advanced signal detection algorithms and integrate them.
9. Upgrade risk management logic with dynamic position sizing and drawdown tracking.
10. Enhance TradeExecutor for robustness and efficiency.
11. Integrate comprehensive portfolio tracking and update logic based on trade outcomes.
12. Implement detailed logging and error handling.
13. Refactor and modularize code where appropriate.
14. Test that enhancements preserve asynchronous execution and responsiveness.
# Output Format
– Provide the entire updated Python code for the advanced intelligent trading agent.
– Include appropriate comments explaining improvements and new functionality.
– Ensure code is executable with proper API credentials and dependencies, maintaining asynchronous programming practices.
# Notes
– Preserve existing functionality where suitable but extend with advanced features.
– Use placeholders for sensitive information or API endpoints as in the original.
– You may add external libraries if they provide clear value, but limit dependencies for maintainability.
– Ensure numerical stability and performance considerations with new algorithms.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into your preferred coding environment.
- Analyze the existing Python trading bot code structure.
- Implement the suggested enhancements step by step.
- Test the updated code for functionality and performance.
- Document changes and maintain clean code practices.
Tips for Best Results
- Signal Detection: Integrate machine learning models like LSTM or Random Forest for improved predictive accuracy.
- Risk Management: Implement dynamic position sizing based on volatility and set strict drawdown limits to protect capital.
- Trade Execution: Enhance the executor with async capabilities, allowing for flexible order types and robust error handling.
- Portfolio Tracking: Develop a real-time dashboard for P&L, position exposure, and risk metrics to monitor performance effectively.
FAQ
- What is signal detection in trading?
Signal detection identifies potential trading opportunities using indicators or algorithms to inform decisions. - How can risk management improve trading?
Risk management minimizes losses by adjusting strategies based on market conditions and individual trade risks. - What is trade execution in trading bots?
Trade execution involves placing orders in the market efficiently, considering factors like slippage and order types. - Why is portfolio tracking important?
Portfolio tracking monitors performance, risk exposure, and profit/loss, helping traders make informed decisions.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


