Tutorials / Documentation
January 31, 2024 ยท View on GitHub
Tutorials
To get a good appreciation of what market_prices offers and how it works it's recommended that the following tutorials are worked through in the order listed.
Introduction
- quickstart.ipynb
- An introduction to basic usage and a peek beyond.
get
These tutorials covers all aspects of the Prices classes get method which is used to get a prices dataset.
- prices.ipynb
- Create a prices object from
PricesYahooorPricesCsv.
- Create a prices object from
- intervals.ipynb
- Define the time interval represented by each row of a prices table.
- periods.ipynb
- Define the period covered by a prices table.
- The Golden Rule
- The Silver Rule
- Define period from
startthroughend. - Define period as a duration bound with
startorend.- Durations in terms of trading times with
minutesandhours. - Durations in terms of trading sessions with
days. - Durations in calendar terms with
weeks,monthsandyears.
- Durations in terms of trading times with
- Multiple symbols trading on different exchanges with differing opening times and in different timezones.
lead_symboloption to determine the exchange calendar against which to evaluate the period.
- Timezones (
tzin) add_a_rowoption to include the row prior to period start.
- Define the period covered by a prices table.
- anchor.ipynb
- How indices are evaluated.
- "open" and "workback"
anchor forceindices to exclude non-trading periods.openendto determine the final indice when the period end is an unaligned session close.- Overlapping indices warning.
- Circumstances in which indices are unable to observe session breaks.
- "open" and "workback"
- Interrogating indices with
.ptaccessor methods.
- How indices are evaluated.
- data_availability.ipynb
- How availabiliy of data at underlying base intervals determines the period over which data is available for any specific interval.
PricesIntradayUnavailableErrorandLastIndiceInaccurateError.- Options when a request can only be partially fufilled;
strict,priorityandcomposite. - Composite calendars.
- other_get_options.ipynb
- Post-processing options, including
tzout,fill,include,exclude,side,close_onlyandlose_single_symbol.
- Post-processing options, including
Other Prices methods
These tutorials cover other methods of Prices classes.
- specific_query_methods
- Covers the following methods that return a single-row
DataFramegiving prices for a specific session, time or period.session_pricesclose_atprice_atprice_range
- Covers the following methods that return a single-row
- other_prices_methods
- Covers the following methods:
request_all_pricesto request all available prices from the data provider.prices_for_symbolsto return a Prices instance for a subset of symbols.
- Covers the following methods:
Price table accessor
The .pt accessor opens the door to a wealth of functionality to interrogate and operate on DataFrame returned by get.
- pt_accessor.ipynb
- Examples of all the properties and methods offered by the price table accessor classes, from reindexing and downsampling to querying and tidying.
Other documentation
Parsing
parsing.md offers a explanation of how the valimp library is used to validate and otherwise parse inputs to public functions.
Typing
typing.md covers:
- Type annotation.
- Custom types of the
mptypes.pymodule.
Method documentation.
method_doc.md explains what to expect from the documentation of public methods.
Issues
See the Issues page for outstanding issues.
Developer
Contributions to market_prices are certainly welcome. If you are looking to contribute, please do have a look through the following developer docs.
- The internals around serving price data.
- Data providers.
- typing specifications.
- documentation specifications.
- Tests for
PricesBase. - Data from yahoo API is unreliable for test suite.
- Versioning.
- Draft release notes.
- Release workflow.
- Considerations for intervals that are not a factor of (sub)session length.
daterange.GetterIntraday.daterange_tight