This is a submission for the Amazon Q Developer "Quack The Code" Challenge: Exploring the Possibilities
🚀 What I Built
For this challenge, I developed a BankNifty Algorithmic Trading System—a robust, end-to-end platform that automates options trading. The system is built using Django as the backend framework and leverages SmartAPI for real-time trading operations. It’s fully containerized using Docker, ensuring seamless deployment across environments.
What sets this project apart is the deep integration of Amazon Q CLI, which played a pivotal role throughout development—not merely as a code assistant, but as a full-fledged engineering partner. From initial architecture to performance optimization, Amazon Q helped shape every core component of this system.
⚙️ Key Features
- A Django web interface for configuring trading parameters
- Docker-based deployment of trading algorithms
- Real-time market data processing via websockets
- Automated trade execution based on configurable strategies
- Emergency kill switches for risk management
Demo
Code Repository
https://github.com/drishangupta/AmazonQ_Trading/
🛠️ Getting Started
To set up and run the system:
Clone the repository.
Place the smartapiii folder inside an Ubuntu container.
Install all dependencies and create a snapshot of the container.
Use the resulting image to integrate with the Django-based BankNifty algo trading system.
🤖 How I Used Amazon Q Developer
Amazon Q CLI was my development partner throughout this project, helping with:
🧱 Code Development
- Django Backend Optimization: Amazon Q helped refactor views.py with proper error handling and threading implementation, improving the token caching strategy to reduce API calls
- Trading Logic Enhancement: Amazon Q optimized the websocket connection handling with robust reconnection logic and proper resource cleanup
🏗️ Infrastructure & Deployment
- Docker Configuration: Amazon Q helped create an efficient Dockerfile with proper layering and optimized container resource usage
- Deployment Workflow: Amazon Q implemented proper error handling for container lifecycle and created a robust kill switch mechanism
🐛 Debugging & Performance Tuning
- Resolved websocket connection stability issues
- Fixed race conditions in trading execution
- Addressed memory leaks in long-running processes
- Enhanced threading model for concurrent operations
🔐 Security & Repository Hygiene
- Conducted a comprehensive security review to identify and remove any PII or sensitive credentials
- Created a detailed .gitignore file to prevent accidental exposure of sensitive data
- Implemented environment variable placeholders to protect API credentials
- Provided guidance on secure credential management practices
- Ensured all code samples were properly sanitized before sharing
Working with Amazon Q on the CLI provided a seamless experience where I could iteratively refine code, get feedback on potential issues, and implement best practices throughout the codebase.
💡 Tips for Using Amazon Q Developer Effectively
After working extensively with Amazon Q, here are a few practical takeaways:
Think of It as a Collaborator: Share your architectural goals—it performs best when it understands the bigger picture.
Refine Iteratively: Break problems down into small parts and get feedback continuously.
Provide System-Wide Context: Amazon Q delivers more cohesive solutions when it understands how modules interact.
Focus on Security Early: I specifically asked it to audit for security issues—it identified credential risks I hadn’t noticed.
Use It for Documentation Too: Beyond coding, it helped me auto-generate comments and documentation, saving hours of manual effort.
Final Thoughts
I had a lot of fun developing along side AmazonQ and it would not be a stretch to say that without AmazonQ this would have taken weeks.
I hope this submission inspires more projects and entries!!
Let’s connect!
Feel free to reach out on LinkedIn if you have any questions or just want to geek out about algo trading, Django, or AI development!
Top comments (2)
Super sharp work, love seeing all the risk stuff gets baked in early. you ever feel like automating trading changes your gut feel for the markets or nah?
I had thought of it but I like to feel more control over money related matters! Lets connect over linkedin!
@drishangupta on linkedin!!