So that calculations that leverage the range of the treasury_curves,
like `pd.Series.searchsorted` will not overshoot the 'end' of the
range we are calculating risk metrics.
The treasury_duration member in RiskMetrics is never used except
for in unit tests.
Remove the saving of treasury_duration in preparation for the
move of the choose_treasury method out of the RiskMetrics classes.
Down the line, if we do restore the sanving of treasury_duration,
choose_treasury can return a tuple that includes treasury_duration
instead of just returning the rate.
To make the risk metrics being calculated more clear, change the
naming convention that ratios have a '_risk' suffix.
Also, fixes typo in beta docstring.
On ranges with missing data from Yahoo, e.g.:
On 2013-04-2 the date range of April 2013-03-29 failed because
of the first day in the range being Good Friday, and the API not
yet updating for the Monday after.
Handle the 404 that is found by raising and warning that no
benchmark data was found, but continuing on.
In the test factory creation of returns, the date creation was using
a timedelta of one day instead of incrementing by trading days.
Working towards changing risk module behavior which would leverage
the trading day map, but tests fail because non-trading days are
created.
Remove `factory.create_returns`, moving uses of that function to us
`factory.create_returns_from_period`, since the number of days input
for `create_returns` was more difficult to use when specifying ranges
over arbirtray dates.
Move the risk metric definitions to functions at the module level
with defined parameters.
Both risk implementations call these functions, where the difference
between risk implementations is with which internal data they
send to the various risk metrics.
Metrics moved:
- Sharpe Ratio
- Sortino Ratio
- Information Ration
- Alpha
Following the lead of the RiskMetricsBatch conversion to use
more pandas and numpy.
Bringing the iterative and batch versions closer together as we
work towards folding them into one.
So that the environments' exchange time is used without having to
specify it independently.
Also, moves uses of Delorean.shift for the exchange conversion inside
of environment to use the exchange_dt_to_utc method.
Wires up performance tracker so that when `emission_rate` is set
to `minute`, the performance packets are sent out every minute,
instead of once per day.
Please note, the performance packets that are generated are not
ready for prime time consumption, this patch is merely a step towards
hooking up the ability to inspect minute data.
Known issues:
- The packets do not currently include risk information.
Since we need to consider how this affects the denominators
of the risk calculations.
So that a filter function can filter out sids on a 'static' source,
when the universe of sids changes.
e.g. when using fetch_csv with a changing universe of stocks.
So that Transaction object behavior is exercised, uses the Transaction
object in performance module tests instead of ndict.
Also, adds fields to the __init__ of Transaction, to make the
definition of the object more well defined.
This function is unused, and on the general path of moving testing
functions out of gens.utils
# Please enter the commit message for your changes. Lines starting
Slight refactoring of grouping the tracking variables in the
PerformanceTracker together.
So that it's easier to see which are config members and which are
members used to track internal state.
Changes name to `grouped_by_dt` instead of `grouped_by_date` to
clarify that the grouping is by dt, which can be by minute, instead
of grouping by calendar date.
Previous attempt to make sim_parms logic clearer had clobbered the
override logic when sim_params is passed to the run function.
Added a few comments as well as restructuring how the sim_params
that are passed to run overrides the default values or not.
This also makes the passing of sim_params to run to no longer have
the side-effect of overwriting the default sim_params.