markethours: A python library for referencing and localizing US stock trading hours
markethours overview
We created market markethours and the markethours.info API because we couldn’t find other free tools for accessing stock trading hours, and we wanted to provide this library to help others experiencing similar issues.
markethours features include:
Reference stock trading hours by date
Automatically localize to Eastern Standard time
Easily check whether market has opened or closed
No user accounts needed
Getting started with markethours
Installation
pip install markethours
Example usage
from markethours import MarketHours
def main():
todays_hours = MarketHours()
# Check if the market has opened
print(todays_hours.market_has_opened())
# Check if the market has closed
print(todays_hours.market_has_closed())
# Wait for the market to open
todays_hours.wait_for_market_open()
# See the number of seconds until open
print(todays_hours.seconds_till_open())
# Do something if there's less than a minute before
# close. Something like this could be used in a loop
if todays_hours.seconds_till_close() < 60:
print('Hurry up!')
# Show open, close, and current time in EST
print(todays_hours.open)
print(todays_hours.close)
print(todays_hours.now_est())
if __name__ == '__main__':
main()
Disclaimer: markethours comes with no warranty of any kind, and its authors accept no responsibility for any damage that might stem from use of this package. See the LICENSE file for more details.
Metadata
Release files for markethours 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| markethours-1.0.0.tar.gz | 3.9 kB | Without provenance | Details for markethours-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markethours-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for markethours-1.0.0-py3-none-any.whl |
Total release size: 8.5 kB
Release files / markethours-1.0.0.tar.gz
| Download URL | markethours-1.0.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dd2ea4062e18869a2b214f9168323addf7adc55b7ec4f4e436f4ca14443fab5
|
|
BLAKE2b-256 checksum How to use checksums |
310c6e8fe726bf8f56f41f020968cf73f1568a152e2f4a9f6145de6a75cc5836
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.18
|
Release files / markethours-1.0.0-py3-none-any.whl
| Download URL | markethours-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ffbb1164193302084c6e4dc09a6b1854d4f6b7069af83137a744e4f8f3493e2
|
|
BLAKE2b-256 checksum How to use checksums |
942a8a29f1379492c167039930062949b0e79da86a05d2782d0e3ad5f4f60c7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.18
|
Security for markethours 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.