forked from scrtlabs/catalyst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Fix continuous future end dates.
The end date of the last contract with a sufficient start date was being used for the continuous future overall end date; however the end date of that contract (which is the last day for which there is data for the contract) is not necessarily the greatest end date out of all contracts. It is possible for the furthest out contract to have some, but very few, trades before it is more actively traded. Which would give it a start date within in the range of the simulation, but an end date is earlier than the other contracts which are active during the simulation. This bug would result in `nan`s when getting the current price because of the `end_date` check in `get_spot_value`. When the current simulation time was greater than the `end_date` of the last contract the condition which guards against attempting to get data for an instrument past its end date would return a `nan`, even when the current underlying contract did have data for that date. Use max end date of all contracts instead of the last one, to ensure that the continuous future last date is always great enough to allow access to all contracts with in the chain. Also, use min start date to accurately mirror the end date behavior.
- Loading branch information
Eddie Hebert
committed
Nov 9, 2016
1 parent
fa6e4fe
commit e415c0f
Showing
2 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
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
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