Most of the functions in date_utils can be done via pandas.
The other functions are no longer used for loading, etc. so remove
the date_utils module to reduce the total surface area of Zipline core.
This utility was referring to functions that had been long since
removed in the loader module.
If the utility is still needed by some, it can be added back in,
but using the pandas read/write instead of msgpack.
Instead of writing our own serialization using msgpack, leverage
the csv serialization provided by pandas.
Also, lessens the need for msgpack and functions in date_utils.
Instead of midnight to midnight for each day, use the trading
environment's market open and close for each day, so that the index
is exactly the trading minutes of each day.
Reduces the amount of memory consumed, but more importantly should
make it easier to inspect the Series that use the index and check
whether the values are correctly being filled.
Remove more use of lists for storing internal risk values to use
pandas structures, for easier matching of time to value.
Accordingy, convert use of -1 for getting last value,
to use current dt.
Continue on path of converting values stored inside of risk metrics
to use a DataFrame instead of storing multiple lists.
Also, the need for latest_dt in getting the current volatility for
the sharpe calculation, shows that we need to set the lastest_dt at
the beginning of the update loop.
to account for minimum price variation.
On an order to buy, between .05 below to .95 above a penny, use that penny.
On an order to sell, between .05 above to .95 below a penny, use that penny.
Eventually, all cumulative metrics, (alpha, beta, etc.) will be
stored in the same DataFrame
For easier tracking of dt to values during debugging, but should be
some performance gains as well.
So that it is easier to add new containers, factor out the creation
of the index.
Also, make the returns frequency a parameter, to make the use of
different frequencies more clear from within the risk metrics object,
rather than hot swapping in the new frequency type via the now
removed `initialize_daily_indices`.
The eigen_values, condition_number, algorithm_covariance, and
benchmark variance, which were easy to calculate alongside beta,
since they share the same inputs, but were not passed along to performance.
Remove to trim down the number of risk report members as well as
number of calcluations done.
Can add back in if there is an expressed need for eigen_values etc.,
perhaps in an 'opt-in' type configuration.
Expect the same shape of data for the supplemental data, to make
working and preparing with the supplemental data consistent with
what is passed to the algorithm.
Instead of sliding to the next trading day because of the behavior
of `searchsorted`, if dt argument is not a trading day use it as a
max value for corresponding date of the index.
Fixes a bug where if the end of the quarter is calculated with
disregard to trading days, get_index would return the first day
of the next quarter, instead of the last trading day of the intended
quarter.
For TALib functions like MACD that have output names, return a
DataFrame that for which the columns are the output names of the
function.
So that when using a TALib function, the algorithm doesn't need
to know the index position of the desired result, in favor of using
the name of the result.
e.g.
```
macd_result['AAPL'][0]
```
becomes,
```
macd_result['AAPL']['macd']
```
and
```
macd_result['AAPL'][1]
```
becomes,
```
macd_result['AAPL']['macdsignal']
```
Also, change return type of functions that return floats from a
dictionary to a Series, so that the function is always returning a
pandas type.
Instead of using a pandas Series of with dictionaries as the
values treasury curves, use a DataFrame which more naturally fits
the data type of a having a timeseries with mulitple values.
Should allow easier slicing/manipulation of the treasury curves,
e.g. getting 10 year curves would now be:
```
treasury_curves['10year']
```
Before we were setting benchmark returns on the first day
to 0. This commit changes this by calculating the benchmark
return from open to close.
According to @eherbert this is also what the answer key does.
zipline.__version__ is now present. Closes#94.
Moreover, git master should have a .dev version string according
to convention. Releases then get the .dev label removed.