Alleviates bottleneck caused re-indexing into a pd.Series during a tight
loop, by keeping track of the index value into the underlying `.values`
in a lookup table.
Based on suggestion from @dalejung
Risk calculations are robust to nans, except for
beta which calls numpy with the complete list of
algorithm_returns. If nans are present the result
of covar will be nan.
This is fixed by filtering out nans in
algorithm_returns.
Makes get_datetime agnostic as to whether its input is a datetime or a
Timestamp. (astimezone is an alias to tz_convert when the input is a
Timestamp).
Instead of checking the positions indexes every time either
`_position_amounts` or `_position_last_sale_prices` is updated, check
and grow the individual Series on each update.
This gain with this patch is by reducing the following bottlenecks:
- Checking both vectors when only one is updated.
- Using try/except to trigger the growth, instead of incurring the cost
of checking the Index contains on every update.
In testing this change results in about a 33% speedup of the
`update_last_sale` algorithm when run with a buy and hold algorithm with
160 equities, resulting in a 20% speedup overall.
This makes the drift and standard deviation used in RandomWalkSource
keyword args to give the user more control over the price series that
are emitted.
The standard deviation of prices is very different at different frequencies,
users should have the ability to specify the standard deviation used.
The drift term should also be configurable to give the user more control.
contstruction.
BarData can be falsey. in create_buffer_panel, the intention of the
check against bar_data was to see if it was passed at all, not if it was
truthey. In order to make that check more explicit, the check now
asserts that bar_data is not None.
On Ubuntu (assume this is true for all posix) tickers containing a slash char ("CRD/A", "BRK/A", both valid tickers with yahoo api accessible timeseries) lead to a path error in loader.py line 286.
When a history minute digest panel was constructed at runtime, there
would be 1 minute missing between the current minute at iloc[-1] and the
next prior minute at iloc[-2].