nasdaq-public-api


Namenasdaq-public-api JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryMinimal Nasdaq public API client for accessing market data. Automates cookie management and data retrieval.
upload_time2025-09-06 23:08:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2025 r-bit-rry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api-client finance market-data nasdaq stocks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NASDAQ Public API Client

[![PyPI version](https://badge.fury.io/py/nasdaq-public-api.svg)](https://badge.fury.io/py/nasdaq-public-api)
[![Python Version](https://img.shields.io/pypi/pyversions/nasdaq-public-api.svg)](https://pypi.org/project/nasdaq-public-api/)
[![License](https://img.shields.io/pypi/l/nasdaq-public-api.svg)](https://github.com/your-username/nasdaq-public-api/blob/main/LICENSE)

A minimal Python client for accessing NASDAQ's public API. This library automates cookie management and provides easy access to market data without requiring an API key.

## Features

- Automated cookie management using Selenium
- Access to company profiles and financial data
- Historical stock price retrieval
- Insider trading and institutional holdings data
- Earnings calendar and short interest information
- Stock screener for stocks and ETFs
- News and press release retrieval
- Typed dataclasses for all API responses
- Automatic data parsing and conversion
- Proper financial data handling with units and currencies
- Optimized data processing with pandas

## Installation

```bash
pip install nasdaq-public-api
```

## Quick Start

```python
from nasdaq import NASDAQDataIngestor

# Initialize the data ingestor
ingestor = NASDAQDataIngestor()

# Get company profile
profile = ingestor.fetch_company_profile("AAPL")
print(profile)

# Get historical stock prices
historical_data = ingestor.fetch_historical_quotes("AAPL", period=30)
print(historical_data)

# Get earnings calendar
earnings = ingestor.fetch_earnings_calendar(days_ahead=7)
print(earnings)
```

## Typed Data Models

The library includes comprehensive dataclasses for all NASDAQ API responses with automatic parsing and conversion:

```python
from nasdaq import NASDAQDataIngestor
from nasdaq.models import CompanyProfile, HistoricalQuote, DividendRecord

# Initialize the data ingestor
ingestor = NASDAQDataIngestor()

# Get typed company profile
company_data = ingestor.fetch_company_profile("AAPL")
company_profile = CompanyProfile.from_nasdaq_response(company_data, "AAPL")
print(company_profile)
# CompanyProfile(symbol=AAPL, company_name=Apple Inc., ...)

# Get typed historical quotes with automatic parsing
historical_raw = ingestor.fetch_historical_quotes("AAPL", period=5)
quotes = [HistoricalQuote.from_nasdaq_row(row) for row in historical_raw.values()]
print(quotes[0])
# HistoricalQuote(date=2023-01-15 00:00:00, open_price=175.4, ...)

# Get typed dividend records with unit conversion
dividends_raw = ingestor.fetch_dividend_history("AAPL")
dividends = [DividendRecord.from_nasdaq_row(row) for row in dividends_raw]
print(dividends[0])
# DividendRecord(ex_or_eff_date=2023-02-10 00:00:00, amount=0.23, ...)
```

## Available Data Models

### Financial Data
- `CompanyProfile` - Company information and fundamentals
- `RevenueEarningsQuarter` - Quarterly revenue and earnings
- `HistoricalQuote` - Daily stock price data
- `DividendRecord` - Dividend payment history
- `FinancialRatio` - Financial ratios and metrics
- `OptionChainData` - Call and put option chains

### Ownership Data
- `InsiderTransaction` - Corporate insider trading records
- `InstitutionalHolding` - Institutional investor holdings
- `ShortInterestRecord` - Short selling activity

### Regulatory Data
- `SECFiling` - SEC filing records
- `EarningsCalendarEvent` - Earnings announcements
- `MarketScreenerResult` - Stock and ETF screening results

### News Data
- `NewsArticle` - Financial news articles
- `PressRelease` - Corporate press releases

## Automatic Data Processing Features

### Monetary Value Parsing
```python
# Automatically converts:
"$1.5B" → 1_500_000_000.0
"$2.3M" → 2_300_000.0
"5.5%" → 0.055
"(100,000)" → -100000.0
```

### Date/Time Parsing
```python
# Automatically parses:
"01/15/2023" → datetime(2023, 1, 15)
"Jan 15, 2023" → datetime(2023, 1, 15)
"2023-01-15" → datetime(2023, 1, 15)
```

### Unit Conversions
```python
# Automatically handles:
"M" → Millions (1_000_000)
"B" → Billions (1_000_000_000)
"T" → Trillions (1_000_000_000_000)
```

## Requirements

- Python 3.12+
- Chrome browser (for cookie management)
- ChromeDriver (automatically managed)

## API Reference

### NASDAQDataIngestor

#### `fetch_company_profile(symbol: str) -> str`
Fetch company description for a given stock symbol.

#### `fetch_revenue_earnings(symbol: str) -> list[dict]`
Fetch revenue and earnings data for the last 6 quarters.

#### `fetch_historical_quotes(symbol: str, period: int = 5, asset_class: str = "stock") -> dict`
Fetch historical prices for a given stock symbol.

#### `fetch_insider_trading(symbol: str) -> dict`
Fetch insider trading data for a given stock symbol.

#### `fetch_institutional_holdings(symbol: str) -> dict`
Fetch institutional holdings data for a given stock symbol.

#### `fetch_short_interest(symbol: str) -> list[dict]`
Fetch short interest data for a given stock symbol.

#### `fetch_earnings_calendar(days_ahead: int = 7) -> pandas.DataFrame`
Fetch earnings calendar for upcoming days.

#### `fetch_nasdaq_screener_data() -> pandas.DataFrame`
Fetch both NASDAQ stock and ETF data.

#### `fetch_stock_news(symbol: str, days_back: int = 7) -> list[str]`
Fetch recent stock news for a given symbol.

#### `fetch_press_releases(symbol: str, days_back: int = 15) -> list[str]`
Fetch recent press releases for a given symbol.

#### `fetch_dividend_history(symbol: str) -> list[dict]`
Fetch dividend history data for the given stock symbol.

#### `fetch_financial_ratios(symbol: str) -> dict`
Fetch financial ratios data for the given stock symbol.

#### `fetch_option_chain(symbol: str, money_type: str = "ALL") -> dict`
Fetch option chain data for the given stock symbol.

#### `fetch_sec_filings(symbol: str, filing_type: str = "ALL") -> list[dict]`
Fetch SEC filings data for the given stock symbol.

## Data Processing Utilities

The package also includes optimized data processing utilities in the `data_processing` module:

- `DataProcessing`: General data manipulation functions
- `FinancialDataProcessor`: Specialized financial data aggregation
- `TimeSeriesProcessor`: Time series-specific operations
- `LargeDatasetProcessor`: Optimized processing for large datasets

## Configuration

The library can be configured through environment variables:

- `NASDAQ_COOKIE_REFRESH_INTERVAL`: Cookie refresh interval in seconds (default: 1800)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Disclaimer

This library is for educational and research purposes only. Please obey all applicable laws and terms of service when using this library. The authors are not responsible for any misuse of this software.

## Caveats

⚠️ **Rate Limiting**: NASDAQ may impose rate limits on API access. Use responsibly.

⚠️ **Data Accuracy**: This library provides access to publicly available data. Verify critical information through official sources.

⚠️ **Terms of Service**: Ensure compliance with NASDAQ's terms of service when using this library.

⚠️ **Browser Automation**: The library uses Selenium for cookie management, which requires Chrome and may be affected by browser updates.

⚠️ **API Changes**: NASDAQ may change their API structure, potentially breaking functionality.

⚠️ **Typed Models**: The new typed dataclasses are additive and don't change existing API behavior. They provide enhanced functionality for developers who want stronger typing and automatic data parsing.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nasdaq-public-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "api-client, finance, market-data, nasdaq, stocks",
    "author": null,
    "author_email": "r-bit-rry <34023431+r-bit-rry@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/7e/96/e2f90bb5a3e25e4c22a631e52fd9f23b1fe2471496fa0533a3f905abac6b/nasdaq_public_api-0.2.0.tar.gz",
    "platform": null,
    "description": "# NASDAQ Public API Client\n\n[![PyPI version](https://badge.fury.io/py/nasdaq-public-api.svg)](https://badge.fury.io/py/nasdaq-public-api)\n[![Python Version](https://img.shields.io/pypi/pyversions/nasdaq-public-api.svg)](https://pypi.org/project/nasdaq-public-api/)\n[![License](https://img.shields.io/pypi/l/nasdaq-public-api.svg)](https://github.com/your-username/nasdaq-public-api/blob/main/LICENSE)\n\nA minimal Python client for accessing NASDAQ's public API. This library automates cookie management and provides easy access to market data without requiring an API key.\n\n## Features\n\n- Automated cookie management using Selenium\n- Access to company profiles and financial data\n- Historical stock price retrieval\n- Insider trading and institutional holdings data\n- Earnings calendar and short interest information\n- Stock screener for stocks and ETFs\n- News and press release retrieval\n- Typed dataclasses for all API responses\n- Automatic data parsing and conversion\n- Proper financial data handling with units and currencies\n- Optimized data processing with pandas\n\n## Installation\n\n```bash\npip install nasdaq-public-api\n```\n\n## Quick Start\n\n```python\nfrom nasdaq import NASDAQDataIngestor\n\n# Initialize the data ingestor\ningestor = NASDAQDataIngestor()\n\n# Get company profile\nprofile = ingestor.fetch_company_profile(\"AAPL\")\nprint(profile)\n\n# Get historical stock prices\nhistorical_data = ingestor.fetch_historical_quotes(\"AAPL\", period=30)\nprint(historical_data)\n\n# Get earnings calendar\nearnings = ingestor.fetch_earnings_calendar(days_ahead=7)\nprint(earnings)\n```\n\n## Typed Data Models\n\nThe library includes comprehensive dataclasses for all NASDAQ API responses with automatic parsing and conversion:\n\n```python\nfrom nasdaq import NASDAQDataIngestor\nfrom nasdaq.models import CompanyProfile, HistoricalQuote, DividendRecord\n\n# Initialize the data ingestor\ningestor = NASDAQDataIngestor()\n\n# Get typed company profile\ncompany_data = ingestor.fetch_company_profile(\"AAPL\")\ncompany_profile = CompanyProfile.from_nasdaq_response(company_data, \"AAPL\")\nprint(company_profile)\n# CompanyProfile(symbol=AAPL, company_name=Apple Inc., ...)\n\n# Get typed historical quotes with automatic parsing\nhistorical_raw = ingestor.fetch_historical_quotes(\"AAPL\", period=5)\nquotes = [HistoricalQuote.from_nasdaq_row(row) for row in historical_raw.values()]\nprint(quotes[0])\n# HistoricalQuote(date=2023-01-15 00:00:00, open_price=175.4, ...)\n\n# Get typed dividend records with unit conversion\ndividends_raw = ingestor.fetch_dividend_history(\"AAPL\")\ndividends = [DividendRecord.from_nasdaq_row(row) for row in dividends_raw]\nprint(dividends[0])\n# DividendRecord(ex_or_eff_date=2023-02-10 00:00:00, amount=0.23, ...)\n```\n\n## Available Data Models\n\n### Financial Data\n- `CompanyProfile` - Company information and fundamentals\n- `RevenueEarningsQuarter` - Quarterly revenue and earnings\n- `HistoricalQuote` - Daily stock price data\n- `DividendRecord` - Dividend payment history\n- `FinancialRatio` - Financial ratios and metrics\n- `OptionChainData` - Call and put option chains\n\n### Ownership Data\n- `InsiderTransaction` - Corporate insider trading records\n- `InstitutionalHolding` - Institutional investor holdings\n- `ShortInterestRecord` - Short selling activity\n\n### Regulatory Data\n- `SECFiling` - SEC filing records\n- `EarningsCalendarEvent` - Earnings announcements\n- `MarketScreenerResult` - Stock and ETF screening results\n\n### News Data\n- `NewsArticle` - Financial news articles\n- `PressRelease` - Corporate press releases\n\n## Automatic Data Processing Features\n\n### Monetary Value Parsing\n```python\n# Automatically converts:\n\"$1.5B\" \u2192 1_500_000_000.0\n\"$2.3M\" \u2192 2_300_000.0\n\"5.5%\" \u2192 0.055\n\"(100,000)\" \u2192 -100000.0\n```\n\n### Date/Time Parsing\n```python\n# Automatically parses:\n\"01/15/2023\" \u2192 datetime(2023, 1, 15)\n\"Jan 15, 2023\" \u2192 datetime(2023, 1, 15)\n\"2023-01-15\" \u2192 datetime(2023, 1, 15)\n```\n\n### Unit Conversions\n```python\n# Automatically handles:\n\"M\" \u2192 Millions (1_000_000)\n\"B\" \u2192 Billions (1_000_000_000)\n\"T\" \u2192 Trillions (1_000_000_000_000)\n```\n\n## Requirements\n\n- Python 3.12+\n- Chrome browser (for cookie management)\n- ChromeDriver (automatically managed)\n\n## API Reference\n\n### NASDAQDataIngestor\n\n#### `fetch_company_profile(symbol: str) -> str`\nFetch company description for a given stock symbol.\n\n#### `fetch_revenue_earnings(symbol: str) -> list[dict]`\nFetch revenue and earnings data for the last 6 quarters.\n\n#### `fetch_historical_quotes(symbol: str, period: int = 5, asset_class: str = \"stock\") -> dict`\nFetch historical prices for a given stock symbol.\n\n#### `fetch_insider_trading(symbol: str) -> dict`\nFetch insider trading data for a given stock symbol.\n\n#### `fetch_institutional_holdings(symbol: str) -> dict`\nFetch institutional holdings data for a given stock symbol.\n\n#### `fetch_short_interest(symbol: str) -> list[dict]`\nFetch short interest data for a given stock symbol.\n\n#### `fetch_earnings_calendar(days_ahead: int = 7) -> pandas.DataFrame`\nFetch earnings calendar for upcoming days.\n\n#### `fetch_nasdaq_screener_data() -> pandas.DataFrame`\nFetch both NASDAQ stock and ETF data.\n\n#### `fetch_stock_news(symbol: str, days_back: int = 7) -> list[str]`\nFetch recent stock news for a given symbol.\n\n#### `fetch_press_releases(symbol: str, days_back: int = 15) -> list[str]`\nFetch recent press releases for a given symbol.\n\n#### `fetch_dividend_history(symbol: str) -> list[dict]`\nFetch dividend history data for the given stock symbol.\n\n#### `fetch_financial_ratios(symbol: str) -> dict`\nFetch financial ratios data for the given stock symbol.\n\n#### `fetch_option_chain(symbol: str, money_type: str = \"ALL\") -> dict`\nFetch option chain data for the given stock symbol.\n\n#### `fetch_sec_filings(symbol: str, filing_type: str = \"ALL\") -> list[dict]`\nFetch SEC filings data for the given stock symbol.\n\n## Data Processing Utilities\n\nThe package also includes optimized data processing utilities in the `data_processing` module:\n\n- `DataProcessing`: General data manipulation functions\n- `FinancialDataProcessor`: Specialized financial data aggregation\n- `TimeSeriesProcessor`: Time series-specific operations\n- `LargeDatasetProcessor`: Optimized processing for large datasets\n\n## Configuration\n\nThe library can be configured through environment variables:\n\n- `NASDAQ_COOKIE_REFRESH_INTERVAL`: Cookie refresh interval in seconds (default: 1800)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis library is for educational and research purposes only. Please obey all applicable laws and terms of service when using this library. The authors are not responsible for any misuse of this software.\n\n## Caveats\n\n\u26a0\ufe0f **Rate Limiting**: NASDAQ may impose rate limits on API access. Use responsibly.\n\n\u26a0\ufe0f **Data Accuracy**: This library provides access to publicly available data. Verify critical information through official sources.\n\n\u26a0\ufe0f **Terms of Service**: Ensure compliance with NASDAQ's terms of service when using this library.\n\n\u26a0\ufe0f **Browser Automation**: The library uses Selenium for cookie management, which requires Chrome and may be affected by browser updates.\n\n\u26a0\ufe0f **API Changes**: NASDAQ may change their API structure, potentially breaking functionality.\n\n\u26a0\ufe0f **Typed Models**: The new typed dataclasses are additive and don't change existing API behavior. They provide enhanced functionality for developers who want stronger typing and automatic data parsing.",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 r-bit-rry  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Minimal Nasdaq public API client for accessing market data. Automates cookie management and data retrieval.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/r-bit-rry/nasdaq-public-api",
        "Issues": "https://github.com/r-bit-rry/nasdaq-public-api/issues",
        "Repository": "https://github.com/r-bit-rry/nasdaq-public-api"
    },
    "split_keywords": [
        "api-client",
        " finance",
        " market-data",
        " nasdaq",
        " stocks"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "27396ec70a2196bad187077b612c958f311aab7dd64989d7fce3e382be313edc",
                "md5": "8fa5e7f57460eb830b7bfa5f6d18e379",
                "sha256": "b1079e75624cc1b949dc9aa6535eba40901d0e0b8dd1c07d89fd30ec484f1e3a"
            },
            "downloads": -1,
            "filename": "nasdaq_public_api-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fa5e7f57460eb830b7bfa5f6d18e379",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 39485,
            "upload_time": "2025-09-06T23:08:30",
            "upload_time_iso_8601": "2025-09-06T23:08:30.182321Z",
            "url": "https://files.pythonhosted.org/packages/27/39/6ec70a2196bad187077b612c958f311aab7dd64989d7fce3e382be313edc/nasdaq_public_api-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7e96e2f90bb5a3e25e4c22a631e52fd9f23b1fe2471496fa0533a3f905abac6b",
                "md5": "c6c2e63d8f23ef4519a3c5b60d455d24",
                "sha256": "6b39e1fc7dbea25e7ae056d3c3ee99d43714dc9ea1c132374531a7559b6507ed"
            },
            "downloads": -1,
            "filename": "nasdaq_public_api-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c6c2e63d8f23ef4519a3c5b60d455d24",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 37406,
            "upload_time": "2025-09-06T23:08:31",
            "upload_time_iso_8601": "2025-09-06T23:08:31.605436Z",
            "url": "https://files.pythonhosted.org/packages/7e/96/e2f90bb5a3e25e4c22a631e52fd9f23b1fe2471496fa0533a3f905abac6b/nasdaq_public_api-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-06 23:08:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "r-bit-rry",
    "github_project": "nasdaq-public-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nasdaq-public-api"
}
        
Elapsed time: 3.69645s