Meaningful OHLCV datasets
Project description
market_prices
A python library to create meaningful OHLCV datasets.
Works out-the-box with prices from the Yahoo Finance API (see Disclaimers).
Features include:
- Include securities trading on different exchanges with differing opening hours across different time zones.
- Request the period covered by a dataset in terms of either:
- trading time (minutes and hours)
- number of sessions
- calendar time (weeks, months and years)
- Request data at ANY interval (pretty much).
- Use properties and functions of the
pd.DataFrame.pt
accessor to interrogate and operate directly on price tables. - Anchor indices either:
- on each (sub)session open.
- on the period end and work back (crossing sessions).
- Price tables indexed with a pandas
IntervalIndex
that defines both sides of the time interval covered by each row. - Respects breaks in exchanges that observe separate morning and afternoon subsessions.
- Indices excluded for any periods when no underlying exchange is open.
- Fills missing prices, by security, within the bounds of trading hours (zero leakage).
- Optionally fills missing values outside of trading hours (for multiple securities with different opening hours).
- Efficient data-usage (only requests data required and only requests any data point once).
Installation
$ pip install market_prices
pip will also take care of installing any missing dependencies.
Although not a dependency, it's anticipated that market_prices
will be used within a Jupyter environment (JupyterLab or a Jupyter Notebook).
Tutorials / Documentation
market_prices
comes with a host of notebook tutorials that show example usage and explain every aspect of what's on offer. Check out quickstart.ipynb for a taster.
All tutorials and other documentation are indexed here.
Each method's own documentation is also pretty comprehensive.
exchange_calendars
market_prices
is nothing without exchange_calendars
.
exchange_calendars
provides market_prices
:
- Knowledge of underlying exchanges' opening times.
- A wealth of functionality to interrogate exchanges' sessions and trading minutes.
This knowledge and functionality allows market_prices
to:
- Index prices according to exchanges' opening hours.
- Evaluate periods defined in terms of trading minutes or sessions.
Calendar maintenance
If you come across missing prices or sessions then the first port of call is to check that the associated calendar is accurate - it may need updating.
- If prices are not included for a session, the calendar may be assuming that day is a holiday.
- If prices are showing as missing on a day when the exchange was closed, the calendar is probably assuming that day represents a trading session.
All calendars are maintained by user-contributions. If you find one that needs updating, PR the required changes over at exchange_calendars
and it'll filter into market_prices
on the next exchange_calendars
release. Links to the workflow to update calendars can be found here.
The prices tutorial covers how market_prices
associates calendars with symbols.
Release schedule, bugs, development and feedback
The first beta version of market_prices
was released May 2022.
Whilst the test suite is pretty comprehensive, there will inevitably be bugs. Please do raise an issue with any that you come across. Even better, offer a PR! Contributions welcome.
Please use discussions to make any suggestions and offer general feedback.
A new beta release will be made to coincide with the release of exchange_calendars
version 4.0. The public interface will remain unchanged although the minimum version of the exchange_calendars
dependency will be advanced to 4.0 to allow for some of the internals to be cleaned up.
Disclaimers
market_prices
should not be assumed sufficiently reliable to undertake market analysis intended to inform investment decisions. Users should inspect the source code and the test suite of the library and its dependencies in order to make their own assessment of the packages' suitability for their purposes. market_prices
is used entirely at the user's own risk.
Yahoo APIs
The default PricesYahoo
class requests data from publically available Yahoo APIs via the yahooquery package.
market_prices
is NOT in any way affiliated, partnered, sponsored or endorsed by Yahoo. Users of the PricesYahoo
class should make enquiries to satisfy themselves that they are eligible to receive data from Yahoo APIs and are in compliance with the license requirements and Terms of Service under which the Yahoo APIs may be accessed, to include restrictions concerning NO COMMERCIAL USE.
Users may find the following references useful in this respect. (These references should not be considered to definitively cover all terms and conditions related to the use of Yahoo APIs.)
Further, it should NOT be assumed that price data returned by the PricesYahoo
class will accurately reflect data as provided by Yahoo APIs. In this respect users should make their own inspection of the source code and test suites of market_prices
and its dependencies.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file market_prices-0.8.1.tar.gz
.
File metadata
- Download URL: market_prices-0.8.1.tar.gz
- Upload date:
- Size: 133.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a0f1d54763faac95b6acd0cf7efebef15611cb604b5a33d57e5c6f90a8c1fdd |
|
MD5 | fe0771af759cb79cc55a7c80e4edf81b |
|
BLAKE2b-256 | cedb86693494f09dd76c02e85cc6e3c6bec0d14d97c0e310b01d3145fab9ecff |
File details
Details for the file market_prices-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: market_prices-0.8.1-py3-none-any.whl
- Upload date:
- Size: 139.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a74a5b24c574da0744b11cf3219fb0c0dff5c98f5fad0adc70403774cceac6a |
|
MD5 | 70d1499bd651accf166ca109442f0ea8 |
|
BLAKE2b-256 | 67efff66e79ded4d796176406ccf2a6a30ae0fc5f2a12ceba54ffd27adf94e38 |