-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add Example to Writing Algorithms / Universes / Futures #2055
Conversation
dataMappingMode: DataMappingMode.OpenInterest | ||
); | ||
// To reduce the transaction cost needed for rolling over contracts, we only filter the ones expiring on quarter ends. | ||
_future.SetFilter(futureFilterUniverse => futureFilterUniverse.ExpirationCycle(new int[] { 3, 6, 9, 12 })); |
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.
Since you are trading Mapped
, the filter doesn't matter. If we replace 3, 6, 9, 12 for 4, 7, 10, 11, the results are the same. In fact, we trade less if we don't use DataMappingMode.OpenInterest
because the contract with the highest OI can change more than once during the quarter.
dataMappingMode: DataMappingMode.OpenInterest | ||
); | ||
// Select the contracts expiring within a week since they have the highest liquidity. | ||
_future.SetFilter(futureFilterUniverse => futureFilterUniverse.Expiration(0, 7)); |
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.
Same as the previous algorithm.
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.
Please review to not use Mapped
and SetFilter
. it makes more sense to change the first one, and use Slice.FuturesChains. For the second, remove SetFilter
.
Also, keep an eye out for invalid orders.
I think I shall keep SetFilter? Since the page is for Future universes |
For the Bollinger Band example, we can trade the Mapped contract without adding the |
I modified the example to check from the FutureChain, now it should limit to 7-day expiring contracts. |
Description
Add Example to Writing Algorithms / Universes / Futures
Related Issue
Motivation and Context
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>