Skip to main content

A unified financial data interface and analysis toolkit for CN/HK/US markets.

Project description

Yquoter

Yquoter: Your universal cross-market quote fetcher. Fetch A-shares, H-shares, and US stock prices easily via one interface.

  • Join Discord
  • License

Yquoter Social Banner

๐Ÿ“‚ Project Structure

This is a high-level overview of the Yquoter package structure:

Yquoter/
โ”œโ”€โ”€ src/ 
โ”‚   โ””โ”€โ”€ yquoter/
โ”‚       โ”œโ”€โ”€ __init__.py             # Exposes the main API interfaces (e.g., get_quotes)
โ”‚       โ”œโ”€โ”€ datasource.py           # Unified interface for all data fetching sources
โ”‚       โ”œโ”€โ”€ tushare_source.py       # A module for Tushare users, requires activation
โ”‚       โ”œโ”€โ”€ spider_source.py        # Default data source using internal web scraping
โ”‚       โ”œโ”€โ”€ spider_core.py          # Core logic and mechanism for the internal spider
โ”‚       โ”œโ”€โ”€ config.py               # Manages configuration settings (tokens, paths)
โ”‚       โ”œโ”€โ”€ .env                    # Stores sensitive environment variables (e.g., Tushare token)
โ”‚       โ”œโ”€โ”€ indicators.py           # Utility for calculating technical indicators
โ”‚       โ”œโ”€โ”€ logger.py               # Logging configuration and utilities
โ”‚       โ”œโ”€โ”€ cache.py                # Manages local data caching mechanisms
โ”‚       โ”œโ”€โ”€ utils.py                # General-purpose utility functions
โ”‚       โ””โ”€โ”€ configs/
โ”‚           โ”œโ”€โ”€ mapping.yaml        # Mapping for Data & configs
โ”‚           โ””โ”€โ”€ standard.yaml       # Yquoter's data standard
โ”‚
โ”œโ”€โ”€ examples/
โ”‚   โ””โ”€โ”€ basic_usage.ipynb # Detailed usage examples in Jupyter Notebook
โ”‚
โ”œโ”€โ”€ assets/               # Non-code assets (e.g., logos, screenshots for README)
โ”œโ”€โ”€ temp/                 # Temporary files (ignored by Git)
โ”œโ”€โ”€ .cache/               # Cache files (ignored by Git)
โ”œโ”€โ”€ pyproject.toml        # Package configuration for distribution (PyPI)
โ”œโ”€โ”€ requirements.txt      # Declaration of project dependencies
โ”œโ”€โ”€ LICENSE               # Apache 2.0 Open Source License details
โ”œโ”€โ”€ README.md             # Project documentation (this file)
โ”œโ”€โ”€ .gitignore            # Files/directories to exclude from version control
โ””โ”€โ”€ .github/workflows/ci.yml  # GitHub Actions workflow for Continuous Integration

๐Ÿš€ Core API Reference

The Yquoter library exposes a set of standardized functions for data acquisition and technical analysis.

For detailed descriptions of all function parameters (e.g., market, klt, report_type), please refer to the dedicated Parameters Reference.

๐Ÿ“ Note: Yquoter internally integrates and standardizes external data sources like Tushare. This means Tushare users can leverage Yquoter's unified API and caching mechanisms without dealing with complex native interface calls. To learn more about the underlying data source, visit the Tushare GitHub repository.

Returns: pandas.DataFrame

Data Acquisition Functions

Function Description Primary Parameters Returns
get_stock_history Fetch historical OHLCV (K-line) data for a date range. market, code, start, end DataFrame (OHLCV)
get_stock_realtime Fetch the latest trading snapshot (real-time quotes). market, code DataFrame (Realtime Quotes)
get_stock_factors Fetch historical valuation/market factors (e.g., PE, PB). market, code, trade_day DataFrame (Factors)
get_stock_profile Fetch basic profile information (e.g., company name, listing date, industry). market, code DataFrame (Profile)
get_stock_financials Fetch fundamental financial statements (e.g., Income Statement, Balance Sheet). market, code, end_day, report_type DataFrame (Financials)

Technical Analysis Functions

These functions primarily take an existing DataFrame (df) or data request parameters (market, code, start, end) and calculate indicators.

Function Description Primary Parameters Returns
get_ma_n Calculate N-period Moving Average (MA). df, n (default 5) DataFrame (MA column)
get_boll_n Calculate N-period Bollinger Bands (BOLL). df, n (default 20) DataFrame (BOLL, Upper/Lower bands)
get_rsi_n Calculate N-period Relative Strength Index (RSI). df, n (default 14) DataFrame (RSI column)
get_rv_n Calculate N-period Rolling Volatility (RV). df, n (default 5) DataFrame (RV column)
get_max_drawdown Calculate Maximum Drawdown and Recovery over a period. df Dict (Max Drawdown)
get_vol_ratio Calculate Volume Ratio (Volume to its N-period average). df, n (default 5) DataFrame (Volume Ratio)

Utility Functions

Function Description Primary Parameters
init_tushare Initialize TuShare connection with your API token. token
init_cache_manager Initialize the cache manager with a maximum LRU entry count. max_entries
register_source Register a new custom data source plugin. source_name, func_type (e.g., "realtime")
register_tushare_module Register specific TuShare data interfaces. None
set_default_source Set a new default data source. name
get_newest_df_path Get the path of the newest cached data file. None

๐Ÿ› ๏ธ Usage Example

๐Ÿ“˜ View the Basic Usage Tutorial (Jupyter Notebook)


๐Ÿค Contribution Guide

We welcome contributions of all forms, including bug reports, documentation improvements, feature requests, and code contributions.

Before submitting a Pull Request, please ensure that you:

Adhere to the project's coding standards.

Add necessary test cases to cover new or modified logic.

Update relevant documentation (docstrings, README, or examples).

For major feature changes, please open an Issue first to discuss the idea with the community.


๐Ÿ“œ License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.


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

yquoter-0.1.0.tar.gz (151.1 kB view details)

Uploaded Source

Built Distribution

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

yquoter-0.1.0-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file yquoter-0.1.0.tar.gz.

File metadata

  • Download URL: yquoter-0.1.0.tar.gz
  • Upload date:
  • Size: 151.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for yquoter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 011cb370cc57f73212b282d45aa7b1445094277f742c490ec07090258d8b588d
MD5 91955e67f1fa432ac8490fb1c21e864c
BLAKE2b-256 98f278b3133754a2ee9cf534b3b2b8d9e9fe34e11d2673a23a5ee442192e81ff

See more details on using hashes here.

File details

Details for the file yquoter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yquoter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for yquoter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f4d284cee0634fef46f15d50f993b9d0691f079e60b878225ebc4b2d37d4663
MD5 1198d3737f5ab289ca96aa6b686c8755
BLAKE2b-256 93753cb85456163a90a5ecb3aef8feb37bddacae27262d59a098f58dc042c80d

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