Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parameters change in real-time for live algorithms #8388

Open
yul opened this issue Oct 31, 2024 · 3 comments
Open

Support parameters change in real-time for live algorithms #8388

yul opened this issue Oct 31, 2024 · 3 comments
Labels

Comments

@yul
Copy link

yul commented Oct 31, 2024

Expected Behavior

User is able to change parameters for an algorithm running on live mode and that may be handled by the algorithm to change it's state. For example, this can be EMA period: user changes it and the corresponding indicator is reset and warmed up from historical data, without the need to re-deploy algorithm.
Also, maybe automatically log parameter values on deployment and when they change, to keep track of their actual values used in the algorithm.

Actual Behavior

Currently user has to re-deploy algorithm in order to update parameters.

Potential Solution

Not sure about implementation details, but for the user side QCAlgorithm class should probably have some callback, like def on_parameter_change(self, new_value, old_value), where it can pick up new parameter value and update algorithm state accordingly.

Checklist

  • [+] I have completely filled out this template
  • [+] I have confirmed that this issue exists on the current master branch
  • [+] I have confirmed that this is not a duplicate issue by searching issues
@Martin-Molinero
Copy link
Member

Hey @yul! Believe you can achieve similar functionality with the new command system, please take a look at
https://www.quantconnect.com/docs/v2/writing-algorithms/live-trading/commands

@yul
Copy link
Author

yul commented Oct 31, 2024

Hey @yul! Believe you can achieve similar functionality with the new command system, please take a look at https://www.quantconnect.com/docs/v2/writing-algorithms/live-trading/commands

I understand it can only be triggered via API, while I can do that, my clients who are not developers, but still want to use algorithms I develop would not be able to do that. And link generation would require sending notification, which looks like an awkward way to control an algorithm. I think it would be easier if user could just change parameter of the live instance.

@AlexCatarino
Copy link
Member

AlexCatarino commented Nov 5, 2024

Hi @yul,
You can write a 30-line Python script to trigger command events that would be as easy as using parameters in the IDE, see Send Commands by API.

print(create_command(<project_id>, {'ema_fast': 10, 'sma_slow': 50}))
print(create_command(<project_id>, {'ema_fast': 5, 'sma_slow': 100}))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants