-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
PEP8 style algorithm API #7909
Merged
Martin-Molinero
merged 16 commits into
QuantConnect:master
from
jhonabreul:feature-python-pep-style
Apr 12, 2024
Merged
PEP8 style algorithm API #7909
Martin-Molinero
merged 16 commits into
QuantConnect:master
from
jhonabreul:feature-python-pep-style
Apr 12, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// containing the new key-value pair along with the original ones. | ||
/// We do this in order to avoid the overhead of using locks or concurrent dictionaries and still be thread-safe. | ||
/// </summary> | ||
private static Dictionary<string, T> AddToDictionary<T>(Dictionary<string, T> dictionary, string key, T value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! 👍
Martin-Molinero
approved these changes
Apr 11, 2024
Used to cache methods and contains invoke functionality
7eb082c
to
cd17661
Compare
Martin-Molinero
approved these changes
Apr 12, 2024
This was referenced Apr 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add PEP8 style API for Python algorithms:
QCAlgorithm
methods can be overriden with PEP8 names (snake case) as shown in the added Python algorithms:Initialize
can be overriden withinitialize
,OnOrderEvent
can be overriden withon_order_event
, etc.self.Portfolio[self.Securities[self.spy]].HoldingsValue
can be replaced withself.portfolio[self.securities[self.spy]].holdings_value
.self.add_equity("SPY", extended_market_hours=True)
.Resolution.MINUTE
orOrderStatus.PARTIALLY_FILLED
.Depends on QuantConnect/pythonnet#83 and QuantConnect/pythonnet#84
Related Issue
Motivation and Context
Having PEP8 conforming algorithms.
Users comming from Python would find the API easier to use.
Requires Documentation Change
Document the new API.
How Has This Been Tested?
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>