-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
simple transforms #429
simple transforms #429
Conversation
2b55323
to
fc90d7d
Compare
@@ -1,5 +1,5 @@ | |||
# |
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.
Note: The diff here is crazy; however, this file was re-written entirely.
"454 additions and 942 deletions. " <- that's great! |
self.registered_transforms[tag] = {'class': transform_class, | ||
'args': args, | ||
'kwargs': kwargs} | ||
self.add_history(2, '1d', 'price') |
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.
So returns are always daily?
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.
Yes, because a history of '1d' in daily will have index -1 be the current minute's price, this gives us the price and yesterday's eod price.
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.
So I just can't get minute returns. I suppose that wasn't possible before either?
5bcee87
to
ade8d56
Compare
|
||
def __init__(self, initial_values=None): | ||
if initial_values: |
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.
Always better to check explicitly initial_values is not None
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.
I think that leaving the implicit truth value here is okay because if initial_values={}
then this should still be avoided.
I like this a lot. My main concern is the complexity inside of https://github.com/quantopian/zipline/pull/429/files#diff-318b64beea94178a9d6b7fa10381f433R280. I suppose it's necessary for all that smart caching. Could the complexity be reduced by caching less? |
5048d3d
to
669c450
Compare
transforms to quantopian syntax. Adds the sid attribute to the siddata so it is aware of which security it represents.
more efficient means of jumping larger gaps of dates. Adds a docstring to explain the usage of the function.
27f8378
to
39eb80e
Compare
👍 |
Removes the old transform classes and machinery to make simple transforms use history under the hood.
Changes the
add_transform
method to accept a string naming the simple transform and a window length (unless you pass returns).simple transforms are now actual methods on the SIDData that do internal calls to history and apply the proper transforms.