Resource#

A resource is a way of defining the location of data. Whether it is from memory, from storage, from network.

class portfolio_plan.resource.File(frequency: Frequency, path: PathLike)#

Bases: Resource

Parameters:
  • path (PathLike) – Path to a parquet file

  • frequency – Target frequency

fetch(symbols: List[str], start_date: datetime, end_date: datetime, name: str, **kwargs) Prices#
Raises:
  • ValidationError

  • IOError

class portfolio_plan.resource.YFinance(frequency: Frequency)#

Bases: Resource

Fetch and process price data from Yahoo! Finance.

Warning

DISCLAIMER:

  • Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.

  • This implementation uses the yfinance package to access Yahoo! Finance data.

  • This code is not affiliated, endorsed, or vetted by Yahoo, Inc.

  • Users are responsible for ensuring their usage complies with Yahoo Finance’s Terms of Service.

  • portfolio-plan features that interface with yfinance are intended for personal, non-commercial use

Relevant Yahoo Terms of Service:

fetch(symbols: List[str], start_date: datetime, end_date: datetime, name: str, **kwargs) Prices#
Parameters:
  • symbols (List[str]) – List of symbols to download

  • start_date (datetime)

  • end_date (datetime)

  • name (str)

Raises:
  • NetworkError

  • IOError

class portfolio_plan.resource.Memory(data: BytesIO, frequency: Frequency)#

Bases: Resource