For futures, we need to divide the position’s commission by the
contract size to get a per-unit commission in order to properly update
the position’s cost basis.
Optimize session close lookups in MinuteResampleSessionBarReader:
- Adds `session_closes_in_range` method (along with
`session_opens_in_range`) to TradingCalendar to allow vectorized
retrieval of all values in a range of sessions.
- Improves code path for resampling a single session's worth of data (as
is the case when calling `get_value`), since we don't actually need to
look up the close minute.
When retrieving the open and close for a given session, we only care
about the scalar values, so using DataFrame.at instead of DataFrame.loc
is significantly faster.
Instead of recursively calling `DailyHistoryAggregator.closes` until we
find a non-nan close, we can instead call `load_raw_arrays` once, and
find the value from the returned array.
* ENH: Use regular rounding to calculate order amounts.
We previously tried to prevent accidental over-ordering by truncating
orders down unless they were within 1e-4 of the next higher integer.
Unfortunately, this makes it easy for a sell order to be one share short
of the desired position.
Using regular rounding treats both buys and sells in the same way.
* ENH keep non-rounding behavior consistent, but leave code structured to make easier to override
* DOC make round_order public and describe behavior in docstring
The CFE was closed along with the NYSE in observation of the days of
mourning in honor of the passing of presidents Gerald Ford and Ronald
Reagan. The CFE also observed the closures due to Hurricane Sandy,
along with NYSE. Adding those adhoc holidays to exchange_calendar_cfe
and removing them from cfe.csv in tests. To fit with
USNationalDaysofMourning, also removing the closure in observation of
the day of mourning in honor of the passing of president Nixon in
1994, despite the fact that the exchange did not exist at that time.
Signed-off-by: Maxwell Rounds <maxwell.j.rounds@gmail.com>
Useful for avoiding the need to create Asset objects when sids are
easier to use.
This is based off the existing implementation of StaticAssets, and
StaticAssets is now implemented as a wrapper around StaticSids.
Capital base is included in the sim params, so we should define the
value there, or use the default.
This change also unifies the default capital base as 1e5, as was
previously defined in algorithm.py.