Skip to content

fix: generalize values for before_trading_start_minutes#222

Open
zhiyisun wants to merge 12 commits intostefan-jansen:mainfrom
zhiyisun:main
Open

fix: generalize values for before_trading_start_minutes#222
zhiyisun wants to merge 12 commits intostefan-jansen:mainfrom
zhiyisun:main

Conversation

@zhiyisun
Copy link

In original zipline, the before_trading_start_minutes is fixed as 8:45AM US/Eastern timezone. But that won't fit if the security market is in different location. Using (open time - 45min) and timezone info to support different timezone markets.

One tricky is exchange_calendars is moving from pytz to zoneinfo. It seems str() is the best function to convert timezone (expressed in both pytz and zoneinfo) to timezone string.

zhiyisun and others added 12 commits September 24, 2023 20:07
Use open_times and timezone info from trading_calendar for
before_trading_start_minutes. Replace the original 8:45 "US/Eastern".

Signed-off-by: Zhiyi Sun <zhiyisun@msn.com>
exchange_calendar is migrating from pytz to zoneinfo. Using str(self.trading_calendar.tz) can support both pytz and zoneinfo.
- Modified winsorise_uint32 function to exclude volume from uint32 boundary checks
- Updated daily bars (bcolz) to handle volume as uint64 instead of uint32
- Updated minute bars (bcolz) to handle volume as uint64 instead of uint32
- Updated HDF5 daily bars to handle volume as uint64 instead of uint32
- Updated Cython code to properly read volume as uint64
- Fixed related documentation and function signatures

This resolves the issue where large volume values (e.g., billions of shares)
were triggering uint32 overflow warnings.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Addresses the pandas FutureWarning that occurs when DataFrameGroupBy.apply
operates on the grouping columns. Explicitly set include_groups=False to
match the upcoming pandas behavior where grouping columns will be excluded
from the operation by default.

Fixes issues in:
- src/zipline/assets/asset_writer.py (lines ~321 and ~383)
- src/zipline/pipeline/loaders/earnings_estimates.py (line ~479)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Fixes the 'name 'uint64' is not defined' error that occurred when changing
the volume column from 32-bit to 64-bit integers. The Cython file
_src/zipline/data/_equities.pyx_ was missing the import for the uint64
dtype, which is now properly imported from numpy.

Also fixed pyproject.toml license specification to comply with PEP 621.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
… parameter

- Removed include_groups=False parameter from groupby calls in asset_writer.py and earnings_estimates.py
- This fixes TypeError in older pandas versions where include_groups parameter is not supported
- Addresses issue where DataFrame.groupby() was getting unexpected keyword argument 'include_groups'

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant