AI Assistance
Strategy Development
Introduction
Mia is our agentic coding assistant. Think of agentic coding as a form of pair programming, where you are the observer who gives high-level directions and Mia is the driver who writes the code and calls the QuantConnect API. We trained Mia on hundreds of algorithms and thousands of documentation pages to provide contextual assistance for most issues you may encounter when developing a strategy. Agentic conversations like this unlock the ability for everyone to create, research, and deploy algorithmic trading strategies without being an expert programmer.
To open the Ask Mia panel, open a project and then, in the right navigation menu, click the
Ask Mia icon.
Write & Debug Code
Mia has read and write access to the files in your project. With Mia's deep knowledge of our documentation and LEAN, she can implement any strategy or functionality you request. After writing the code, Mia compiles the project to check for errors. If she detects some errors, she autonomously works to debug and fix them before compiling the project again.
Write Full Strategies
Mia can implement full trading strategies.
> Create a momentum strategy for a universe of US Equities.
Add New Factors
Mia can upgrade your existing strategy to incorporate new factors, allowing you to make more informed trading decisions.
> Filter trades based on the Fear & Greed Index. Favor long trades during fearful periods and short trades during greedy periods.
Add Portfolio Optimization
Mia can test various portfolio construction techniques to find what works best for your strategy.
> Replace the equal-weighted portfolio construction with a portfolio that optimizes the trailing Sharpe ratio.
Add Risk Management Orders
Mia can extend your strategy with risk management orders to reduce volatility in your equity curves.
> Add take-profit and stop-loss orders to this strategy.
Add Machine Learning
Mia can review your code and offer some suggestions on where machine learning models can fit in.
> Where can we incorporate some machine learning in this strategy?
Analyze Backtest Results
Once your project successfully compiles, Mia launches a backtest to evaluate the strategy's performance. If the algorithm throws errors during execution, Mia catches them and edits the code to solve the problem. When the algorithm runs without error, she reviews the backtest statistics, orders, logs, and more, and then provides a summary of the performance. If you have a specific question about the results, just ask.
> How can we increase the Sharpe ratio of this strategy?
> The algorithm takes a long time to run. Can you speed it up?
> Why didn't the algorithm place any trades during the backtest?
Optimize Parameters
Once you are satisfied with your trading strategy, you may want to run an optimization job to optimize parameters and test their sensitivity.
> What rebalance time leads to the best performance? Let's try 10 minutes to 60 minutes after the market opens, in steps of 5 minutes.
> Test how sensitive this strategy is to the width of the Bollinger Bands.
In some cases, you may even be able to make your strategy more robust by removing some parameters.
> Count the number of parameters we have in this strategy. Which ones could we remove?
Deploy & Manage Live Algorithms
Deploying your trading strategies to live trading on co-located servers has never been easier. Mia can deploy them while configuring your brokerage settings, data providers, notifications, and more.
> Deploy this algorithm to paper trading.
Mia has access to all your live deployments, so you can prompt her to analyze them and provide suggestions.
> Review my live algorithms. Give me a list of all orders placed today.
> I have a few strategies in live trading. Review them and suggest a new strategy that I could add to the mix to improve my risk-adjusted returns going forward.
> Why did my live algorithm throw this error? <error>
Models
The Ask Mia panel supports the following models:
- - Our most advanced model with the fastest execution speed. It's available to all members with a paid support seat.
- - Our cost-effective model with slower execution speed. It's available to all members.
To change the model, click the model name at the bottom of the Ask Mia panel and then click the name of the model to use.
Quotas
The following table shows the amount of AI tokens included with each support seat:
| Tier | AI Tokens Quota ($) |
|---|---|
| Gold | 75 |
| Silver | 30 |
| Bronze | 10 |
| Community | 5* |
The quotas don't restore on the first day of the month or the billing date. They restore according to a 1-month rolling window.
If you exhaust all the AI tokens included with your support seat, buy some QCC to continue using Mia, our agentic AI assistant. To enable Mia to consume your QCC, open the Billing page, scroll down to the Organization Credit (QCC) section, and then select the Automatically consume QCC for AI usage check box. QCC tokens are consumed at approximately the same rate as the top model from major providers. We provide this value-added wrapper on the major providers so we can offer powerful tools without violating our data licenses, enabling you to easily use the major models and still have the full benefits of QuantConnect.
*This quota is only for the Free Support model.
Public Support
In addition to agentic conversations, you can interact with Mia through the following support channels. In these channels, Mia simply responds to your prompts with text.
Community Forum
Mia automatically provides an initial response in the community forum.
Discord
You can ask Mia questions in our Discord server using @Mia Alissi or use the #ask-mia channel.
Troubleshooting
To check the status of the QuantConnect Cloud Platform, see our Status page.
If Mia isn't responding through the Ask Mia panel, you may need to enable Mia to consume your QCC. Open the Billing page, scroll down to the Organization Credit (QCC) section, and then select the Automatically consume QCC for AI usage check box.