
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Minimal Nasdaq public API client for accessing market data. Automates cookie management and data retrieval.
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.
pip install nasdaq-public-api
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)
The library includes comprehensive dataclasses for all NASDAQ API responses with automatic parsing and conversion:
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, ...)
CompanyProfile
- Company information and fundamentalsRevenueEarningsQuarter
- Quarterly revenue and earningsHistoricalQuote
- Daily stock price dataDividendRecord
- Dividend payment historyFinancialRatio
- Financial ratios and metricsOptionChainData
- Call and put option chainsInsiderTransaction
- Corporate insider trading recordsInstitutionalHolding
- Institutional investor holdingsShortInterestRecord
- Short selling activitySECFiling
- SEC filing recordsEarningsCalendarEvent
- Earnings announcementsMarketScreenerResult
- Stock and ETF screening resultsNewsArticle
- Financial news articlesPressRelease
- Corporate press releases# Automatically converts:
"$1.5B" → 1_500_000_000.0
"$2.3M" → 2_300_000.0
"5.5%" → 0.055
"(100,000)" → -100000.0
# Automatically parses:
"01/15/2023" → datetime(2023, 1, 15)
"Jan 15, 2023" → datetime(2023, 1, 15)
"2023-01-15" → datetime(2023, 1, 15)
# Automatically handles:
"M" → Millions (1_000_000)
"B" → Billions (1_000_000_000)
"T" → Trillions (1_000_000_000_000)
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.
The package also includes optimized data processing utilities in the data_processing
module:
DataProcessing
: General data manipulation functionsFinancialDataProcessor
: Specialized financial data aggregationTimeSeriesProcessor
: Time series-specific operationsLargeDatasetProcessor
: Optimized processing for large datasetsThe library can be configured through environment variables:
NASDAQ_COOKIE_REFRESH_INTERVAL
: Cookie refresh interval in seconds (default: 1800)This project is licensed under the MIT License - see the LICENSE file for details.
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.
⚠️ 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.
FAQs
Minimal Nasdaq public API client for accessing market data. Automates cookie management and data retrieval.
We found that nasdaq-public-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.