Skip to main content

Simple and efficient access to Yahoo Finance's 'screener' API <https://finance.yahoo.com/research-hub/screener/> for querying and retrieval of financial data.

Project description

screen

PyPI version codecov Downloads

Overview

'yfscreen' is a package that provides simple and efficient access to Yahoo Finance's 'screener' API https://finance.yahoo.com/research-hub/screener/ for querying and retrieval of financial data.

The core functionality of the 'yfscreen' package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, and JSON payload generation. This abstraction allows users to focus on filtering and retrieving data rather than managing API details. Use cases include screening across a range of security types:

  • Equities: coverage spans 50 regions to enable the identification of top-performing stocks based on specified criteria
  • Mutual funds: funds can be screened using metrics such as historical performance, performance ratings, and other factors
  • ETFs: a wide range of ETFs can be filtered by criteria including expense ratio, historical performance, and additional attributes
  • Indices: stock market indices are available and often categorized by sector, industry, or the overall market
  • Futures: futures contracts can be screened by exchange, price percent changes, and regional specifications

The package supports advanced query capabilities, including logical operators, nested filters, and customizable payloads. It automatically handles pagination to ensure efficient retrieval of large datasets by fetching results in batches of up to 250 entries per request. Filters can be dynamically defined to accommodate a wide range of screening needs.

The implementation leverages standard HTTP libraries to handle API interactions efficiently and provides support for both R and 'Python' to ensure accessibility for a broad audience.

Installation

  • Install the released version from PyPI:
pip install yfscreen
  • Or the development version from GitHub:
pip install git+https://github.com/jasonjfoster/screen.git@main#subdirectory=python

Usage

First, import the package and explore the available filter options:

import yfscreen as yfs

print(yfs.data_filters)

To create a query, define filters and use the create_query method:

filters = [
  ["eq", ["region", "us"]],
  ["btwn", ["intradaymarketcap", 2000000000, 10000000000]],
  ["btwn", ["intradaymarketcap", 10000000000, 100000000000]],
  ["gt", ["intradaymarketcap", 100000000000]],
  ["gt", ["dayvolume", 5000000]]
]

query = yfs.create_query(filters)

Next, specify the security type and create the payload with the create_payload method:

payload = yfs.create_payload("equity", query)

Finally, retrieve the data using the get_data method:

data = yfs.get_data(payload)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yfscreen-0.1.2.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yfscreen-0.1.2-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file yfscreen-0.1.2.tar.gz.

File metadata

  • Download URL: yfscreen-0.1.2.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for yfscreen-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a346e91079f00cacdaf9450c783f1fa4898f02738b71000e15f431d0a1dbc223
MD5 94419c1e133f09cb69484d9cf48ea84b
BLAKE2b-256 f407a84fed07af2b1d65d1e14148a188818bac1ed06613071988b3da97c06f6e

See more details on using hashes here.

File details

Details for the file yfscreen-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: yfscreen-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for yfscreen-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ca2c88cfb0d83bf8938339f35d30243050ec07d4cca3a9d71cb7f75cd239951
MD5 02cd12cd86afc42e0beac3d6c14b3dad
BLAKE2b-256 7b75a4f42a475c4c83725a567cb5322b5ee576be36ded20a455db3adf9abe52d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page