Skip to main content

# AlpaxaQuant

Project description

AlpaxaQuant

PyPI version License Downloads

AlpaxaQuant is a comprehensive quantitative finance and data acquisition library that unifies financial, macroeconomic, insider, and market-structure data from multiple APIs — including EODHD, FINRA, and FRED — into one modular Python package.

It is designed for quantitative analysts, researchers, and developers who want clean access to financial datasets for model training, signal generation, and econometric analysis.


Table of Contents


Installation

pip install alpaxa_quant

or install directly from source:

git clone https://github.com/Joanmascastella/AlpaxaQuant.git
cd AlpaxaQuant
pip install .

Package Overview

utils

Utility functions and request handlers used internally across the package.

  • make_safe_request() — robust, retry-aware HTTP request wrapper with timeout and structured DataFrame return.
  • request_util() — generic API request helper for GET/POST calls.
  • make_yf_request() — lightweight Yahoo Finance helper for quick ticker data retrieval.

eodhd

Wrapper around the EODHD API, offering market-wide coverage of financial and sentiment data for all global tickers.

Key functions include:

  • get_historical_ticker_price() – OHLCV data retrieval for any ticker
  • get_financials(), get_balance_sheet(), get_cash_flow() – full fundamental statements
  • get_earnings() – historical and forward EPS data
  • get_technicals() – moving averages, oscillators, and technical indicators
  • fetch_news_sentiment() – sentiment analysis scores and metadata from recent news
  • get_analyst_ratings() – aggregated analyst buy/hold/sell recommendations

insider_trades

High-performance scraper and API interface for U.S. insider trading data.

  • get_insider_trades() – retrieves Form 4 insider transactions for all U.S.-listed tickers.

  • Supports filtering by:

    • Transaction type (Buy, Sell, Option Exercise)
    • Date range
    • Position (Officer, Director, Major Shareholder)
    • Minimum transaction value or share size

finra

Comprehensive interface for FINRA’s fixed-income and equity market datasets — covering everything from short interest to block trading and debt market breadth.

Highlights:

  • Market Structure Data

    • get_blocks_summary() – aggregated ATS trades
    • get_otc_block_summary() – OTC-block transaction data
    • get_weekly_summary() / get_monthly_summary() – market-wide summary data
  • Short Interest

    • get_consolidated_short_interest() – historical short positions per ticker
  • Debt Markets

    • get_corporate_debt_market_sentiment()
    • get_agency_debt_market_breadth()
    • get_corporate_and_agency_capped_volume()
  • Treasury & Fixed Income

    • get_treasury_daily_aggregates()
    • get_treasury_monthly_aggregates()

fred

Extensive collection of macroeconomic, monetary, and commodity data via the Federal Reserve (FRED) API.

Organized by category for clarity:

  • Housing: get_homeownership_rate(), get_median_house_sale_price(), etc.
  • Commodities: get_daily_crude_oil_prices(), get_daily_gold_prices(), get_avg_beef_prices(), etc.
  • Inflation & Recession: get_monthly_cpi(), get_financial_stress(), get_sahm_rule_recession_indicator()
  • Labour Market: get_job_openings(), get_unemployed_rate(), get_labour_participation_rate()
  • Fiscal & Monetary Policy: get_federal_surplus_deficit(), get_m1_supply(), get_m2_velocity()
  • Foreign Exchange: get_daily_US_vs_EURO_rate(), get_JPY_vs_US(), get_yuan_vs_US()
  • Yields & Credit Spreads: get_ICE_BofA_H_Y_effective_yield(), get_daily_moodys_seasoned_BAA_corp_yield()
  • Treasury Yields: get_ten_yield_us(), get_twenty_yield_us(), get_thirty_yield_us()
  • GDP & Growth: get_real_gdp_growth()
  • Volatility & Sentiment (VIX): get_VIX(), get_equity_market_VIX_sentiment(), get_oil_VIX()

Example Usage

import alpaxa_quant as aq
import pandas as pd
from dotenv import load_dotenv
import os

load_dotenv(".env")

# --- EODHD Example ---
base_endpoint = os.getenv('EXAMPLE_BASE_ENDPOINT')
api_key = os.getenv('EXAMPLE_API_KEY')

df_prices = aq.eodhd.get_historical_ticker_price(
    base_endpoint=base_endpoint,
    api_token=api_key,
    ticker='AAPL',
    fmt='json',
    period='d',
    order='a',
    from_date='2020-01-01',
    to_date='2025-01-01',
    verbose=False
)
print(df_prices.head())

# --- Insider Trades Example ---
config = {
    "scraping": {
        "start_year": 2024,
        "start_month": 6,
        "max_workers": 5,
        "retry_attempts": 3,
        "timeout": 30
    },
    "filters": {
        "min_transaction_value": 10000,
        "transaction_types": ["P", "S"],
        "exclude_companies": [],
        "include_companies": ["TSLA", "NVDA"],
        "min_shares_traded": 500
    },
    "cache": {
        "enabled": True,
        "directory": ".cache",
        "max_age": 12
    }
}
insiders = aq.insider_trades.get_insider_trades(config)
print(insiders.head())

# --- FINRA Example ---
finra_client_id = os.getenv('FINRA_CLIENT_ID')
finra_secret = os.getenv('FINRA_CLIENT_SECRET')

jwt, _ = aq.finra.get_bearer_token(client_id=finra_client_id, client_secret=finra_secret)
short_interest = aq.finra.get_consolidated_short_interest(jwt_token=jwt, ticker="TSLA")
print(short_interest.head())

# --- FRED Example ---
fred_endpoint = os.getenv('FRED_ENDPOINT')
fred_api = os.getenv('FRED_API_KEY')

cpi = aq.fred.get_monthly_cpi(api_key=fred_api, base_url=fred_endpoint, start_date='2020-01-01', end_date='2021-01-01', verbose=False)
print(cpi.tail())

License

Apache License 2.0 © 2025 Joan Mas Castella

You may freely use, modify, and distribute AlpaxaQuant under the terms of the Apache 2.0 license.


Contributing

Contributions are welcome. If you’d like to add new endpoints, fix bugs, or improve documentation:

git clone https://github.com/Joanmascastella/AlpaxaQuant.git
git checkout -b feature/new-endpoint

Then submit a Pull Request describing your change.


Connect


AlpaxaQuant — bridging financial data, macroeconomic insight, and quantitative modeling into one unified Python toolkit.

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

alpaxa_quant-1.0.0.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

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

alpaxa_quant-1.0.0-py3-none-any.whl (53.6 kB view details)

Uploaded Python 3

File details

Details for the file alpaxa_quant-1.0.0.tar.gz.

File metadata

  • Download URL: alpaxa_quant-1.0.0.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for alpaxa_quant-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fe0946b7a39954cdb7412921bb77dbcd3b77a0b77981c9ed6129b105c7d59bdf
MD5 8ada82f2967721a6f29085ad53db5cbb
BLAKE2b-256 7ffd58ec4b6f7d697ee2f8a39de506cb45a95aff508feaef1d1cad5141373ce3

See more details on using hashes here.

Provenance

The following attestation bundles were made for alpaxa_quant-1.0.0.tar.gz:

Publisher: publish.yml on Joanmascastella/AlpaxaQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file alpaxa_quant-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: alpaxa_quant-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 53.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for alpaxa_quant-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51e5b937de8aa603bd3b12e9609cb6434074376799351c5ac988312e58bf54d1
MD5 1054100b5b1e2688ca4ab54dee2e1a18
BLAKE2b-256 8caeab0a75b0b48f0e3a788d0fe5d7a74914f5a6a765b2c477254cede3a55409

See more details on using hashes here.

Provenance

The following attestation bundles were made for alpaxa_quant-1.0.0-py3-none-any.whl:

Publisher: publish.yml on Joanmascastella/AlpaxaQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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