Skip to main content

A powerful stock screening and analysis tool

Project description

pystockquery

Python Version License: MIT

pystockquery is a powerful Python library for stock screening, analysis, and visualization using natural language queries. It allows investors and analysts to filter, rank, and analyze stocks using plain English commands.

Features

  • Natural Language Processing: Query stocks using human-readable sentences
  • Comprehensive Metrics: 150+ financial metrics and technical indicators
  • Advanced Filtering: Complex multi-condition screening
  • Visualization: Automatic chart generation based on queries
  • Export Capabilities: Save results to Excel, CSV, or JSON
  • Industry Comparisons: Relative valuation against industry peers

Installation

pip install pystockquery

git clone https://github.com/yourusername/pystockparameter.git
cd pystockquery
pip install .



from pystockquery import StockParameterAPI

# Initialize with your data file
api = StockParameterAPI('path/to/your/data.xlsx')

# Example queries
growth_stocks = api.query(
    "Show top 20 stocks with CAGR > 15%, Return on Equity > 20%, and positive ROI"
)

defensive_picks = api.query(
    "List defensive picks with Sharpe Ratio > 1.2, Volatility < 20%, and Dividend Yield > 3%"
)

# Generate visualization
api.visualize("Scatter plot of Sharpe Ratio vs Annualized Volatility")

# Export results
api.export(
    "Show undervalued stocks with P/E < 10 and P/B < 1",
    "undervalued_stocks.xlsx"
)


"Show top 20 stocks with CAGR > 15%, Return on Equity > 20%, and positive ROI"
"Filter stocks with Return on Assets (ttm) > 10% and Revenue Growth > 20%"
"Find high alpha stocks (Annualized Alpha > 5%) with low Beta (<1)"




"List defensive picks with Sharpe Ratio > 1.2, Volatility < 20%, and Dividend Yield > 3%"
"Find stocks with low Downside Deviation (<15%) and Maximum Drawdown < -10%"
"Filter stocks with high R-Squared (>0.85) and Tracking Error (<5%)"



"Rank all stocks by highest Sharpe Ratio"
"Show undervalued stocks with P/E < industry average and high ROE"
"Sort by Market Cap descending and filter Sector = Technology"



# Scatter plots
api.visualize("Plot Return on Equity vs Beta")

# Bar charts
api.visualize("Compare P/E ratios across sectors")

# Histograms
api.visualize("Show distribution of Profit Margins")
api.visualize("Show distribution of Profit Margins")
api.visualize("Show distribution of Profit Margins")

# Custom plots
api.visualize("Create bubble chart of Market Cap vs ROE colored by Sector")


# Complex boolean logic
api.query("""
Find stocks where:
    (P/E < 15 OR EV/EBITDA < 10)
    AND (ROE > 15% AND Revenue Growth > 10%)
    AND Sector in ('Technology', 'Healthcare')
""")

# Time-series analysis
api.query("Show stocks with improving ROE over last 3 years")

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

pystockquery-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

pystockquery-0.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pystockquery-0.1.1.tar.gz.

File metadata

  • Download URL: pystockquery-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pystockquery-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e9fd8c187b6f5f4110dbbcfcf915155a91f6e93e4cc67f0ac7948970224b1f1c
MD5 0a6b5b05d9e1d874b2e319c7405bcad4
BLAKE2b-256 9de61bb9c9c223f328c8bc68adeb995ea72f8f1535057d366f0b53c3db093af4

See more details on using hashes here.

File details

Details for the file pystockquery-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pystockquery-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pystockquery-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c24af2667226b1ebba05dd73e8ee5bc0d778e37673d525693e8a5a3c0ab3c050
MD5 65e1ee0f280b648244867d96629de6d1
BLAKE2b-256 25d24d8ba068303a49b9a8d1d06f66d98e08cca0121d4a29a0ea8339beb7e8aa

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