Skip to content

Commit

Permalink
Revise tutorial and README for PricesCsv
Browse files Browse the repository at this point in the history
Revises `prices.ipynb` tutorial to add `PricesCsv` and adds example
.csv files to `docs/tutorials/resources`.

Updates README to cover getting price data from locally stored .csv
files.

Also adds `PricesCsv` to package `__init__` so that directly
accessible from `market_prices`.
  • Loading branch information
maread99 committed Jan 31, 2024
1 parent d9703e1 commit 052ba9a
Show file tree
Hide file tree
Showing 31 changed files with 77,856 additions and 243 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose"
options: "--check --verbose --diff"

build-and-test:

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A python library to create **meaningful** OHLCV datasets for financial instrumen

`market_prices` provides for enhanced querying and post-processing of financial price data.

Works out-the-box with prices from the Yahoo Finance API via [yahooquery][yahooquery] (see [Disclaimers](https://github.com/maread99/market_prices#disclaimers)).
Works out-the-box with prices from the Yahoo Finance API via [yahooquery][yahooquery] (see [Disclaimers](https://github.com/maread99/market_prices#disclaimers)) or from locally stored .csv files.

## Installation

Expand Down Expand Up @@ -206,6 +206,9 @@ symbol MSFT 9988.HK BTC-USD
The [quickstart.ipynb](https://github.com/maread99/market_prices/blob/master/docs/tutorials/quickstart.ipynb) tutorial offers a fuller introduction. [Here](https://github.com/maread99/market_prices/blob/master/docs/tutorials_docs.md) you'll find links to all the tutorials which collectively cover all that `market_prices` offers.

## Features include:
* Get price data out-the-box:
* `PricesYahoo` to get live and historic prices from the Yahoo Finance API via [yahooquery][yahooquery] (see [Disclaimers](https://github.com/maread99/market_prices#disclaimers)).
* `PricesCsv` to get price data from locally stored .csv files.
* 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).
Expand Down
3 changes: 3 additions & 0 deletions docs/developers/other_internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ NB: A daterange end that is a session close that is aligned against the base int

## `daterange.GetterIntraday.daterange_tight`
The `daterange.GetterIntraday.daterange_tight` tightens the end (first item) so that the difference between the end and the accuracy is less than one base interval. When the downsample interval (ds_interval) is high relative to the base interval this has the benefit of preventing 'partial requests' for data that cover just the end of the daterange over which no symbol trades (and hence no data would be expected to be returned). See the property documentation for an example.

## Right Limits
Right limits were introduced January 2024 to support sourcing historic price data from locally stored .csv files (`PricesCsv`). To minimise changes and maintain much of the existing implementation (and hence tests and tutorials) a new `BASE_LIMITS_RIGHT` class attribute was introduced rather than altering the existing `BASE_LIMITS` which could have been amended to take a tuple defining both the left and right limit. Similarly, a 'limit_right' parameter was added to the `daterange._Getter` constructor rather than redefining the 'limit' parameter as 'limits' to take a tuple. On reflection, given the different treatment of each limit (with the right limit defaulting to 'now' if not defined, whereas the left limit for daily data has to be found) I think that defining left and right limits separately IS definitely the way to do. This way the right limit can be ignored for any service that provides for data to now (i.e. most of them). It's much clearer to have them left and right limits separately. Keep it this way.
Loading

0 comments on commit 052ba9a

Please sign in to comment.