# Python financial data libraries

Python financial data libraries pull stock prices, crypto quotes, economic series, and company fundamentals into Python code. A client wraps a market data API or exchange feed and returns each series as a DataFrame or typed records. These libraries let trading bots, research notebooks, and AI agents work from current and historical market data.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [yfinance](#yfinance) | 17.0M | 25.9K | Nov 2026 | Apache-2.0 |
| [CCXT](#ccxt) | 2.7M | 44.9K | Nov 2026 | MIT |
| [Databento](#databento) | 1.4M | 314 | Nov 2026 | Apache-2.0 |
| [Alpaca-py](#alpaca-py) | 1.4M | 1.6K | Nov 2026 | Apache-2.0 |
| [AKShare](#akshare) | 1.2M | 23.4K | Nov 2026 | MIT |
| [fredapi](#fredapi) | 1.1M | 1.7K | May 2024 | Apache-2.0 |
| [wbdata](#wbdata) | 981.7K | 214 | Oct 2025 | GPL-2.0 |
| [ib_async](#ib-async) | 769.2K | 1.8K | Dec 2025 | BSD-2-Clause |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[yfinance](#yfinance) has the most monthly downloads in this comparison, at 17.0M.

## Capabilities

| Library | Intraday OHLCV | Native live client |
| --- | --- | --- |
| [yfinance](#yfinance) | Yes | Yes |
| [CCXT](#ccxt) | Yes | Yes |
| [Databento](#databento) | Yes | Yes |
| [Alpaca-py](#alpaca-py) | Yes | Yes |
| [AKShare](#akshare) | Yes | Undocumented |
| [fredapi](#fredapi) | No | No |
| [wbdata](#wbdata) | No | No |
| [ib_async](#ib-async) | Yes | Yes |

## Libraries

### yfinance

[GitHub](https://github.com/ranaroussi/yfinance) · [PyPI](https://pypi.org/project/yfinance) · [Docs](https://ranaroussi.github.io/yfinance/)

Retrieves market data, ticker information, and financial statements from Yahoo Finance.

- Downloads / mo: 17.0M
- Stars: 25.9K
- Last release: 1.8.0
- License: Apache-2.0
- Capabilities: [From the yfinance docs](https://ranaroussi.github.io/yfinance/)

**Strengths**

- **Downloads several tickers together.** Retrieve market data for a list of ticker symbols.
- **Combines prices and financial statements.** Use a Ticker for price history and quarterly income statements.

**Watch out for**

- **Intraday history has limited retention.** Use another source when intraday data must extend beyond the retained window.
- **Prices adjust automatically by default.** Disable auto_adjust when the workflow requires unadjusted price columns.

```sh
pip install yfinance
```

**Fincept-Corporation/FinceptTerminal** (33.9K stars)

[Fincept-Corporation/FinceptTerminal](https://github.com/Fincept-Corporation/FinceptTerminal) 

```python
def get_historical(symbol, start_date, end_date, interval='1d'):
    """Fetch historical data for a symbol with specified interval

    Args:
        symbol: Stock symbol (e.g., 'AAPL')
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)
        interval: Data interval - valid values: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo
                  Note: Intraday data (< 1d) is only available for last 60 days
    """
    try:
        import io, contextlib
        ticker = yf.Ticker(symbol)
        _buf = io.StringIO()
        with contextlib.redirect_stdout(_buf):
            hist = ticker.history(start=start_date, end=end_date, interval=interval,
                                  timeout=_NET_TIMEOUT)

        if hist.empty:
            return []

        historical_data = []
        for index, row in hist.iterrows():
            # Guard every conversion the way get_batch_quotes already does — a
            # single NaN bar must not take the whole series with it.
            close = _num(row['Close'])
            if close is None:
                continue  # a bar with no close is not a price point
            historical_data.append({
                "symbol": symbol,
                "timestamp": int(index.timestamp()),
                "open": _num(row['Open']),
                "high": _num(row['High']),
                "low": _num(row['Low']),
                "close": close,
                "volume": _int(row['Volume'], 0),
                "adj_close": close
            })

        return historical_data
    except Exception as e:
        return {"error": str(e), "symbol": symbol}

```

[fincept-qt/scripts/yfinance_data.py](https://github.com/Fincept-Corporation/FinceptTerminal/blob/68691b7577ce642009cdf2c1b4b0766ca9e37999/fincept-qt/scripts/yfinance_data.py#L157-L198) · [More projects using yfinance →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20yfinance%20for%20historical%20price%20and%20economic%20data%20retrieval&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import yfinance as yf
dat = yf.Ticker("MSFT")
dat.history(period='1mo')

```

From [yfinance.md](https://ranaroussi.github.io/yfinance/)

### CCXT

[GitHub](https://github.com/ccxt/ccxt) · [PyPI](https://pypi.org/project/ccxt) · [Docs](https://docs.ccxt.com/)

Trades and reads market data on more than 100 cryptocurrency exchanges through one API.

- Downloads / mo: 2.7M
- Stars: 44.9K
- Last release: 4.5.93
- License: MIT
- Capabilities: [From the CCXT docs](https://docs.ccxt.com/)

```sh
pip install ccxt
```

**freqtrade/freqtrade** (56.9K stars)

[freqtrade/freqtrade](https://github.com/freqtrade/freqtrade) 

```python
@retrier
def fetch_bids_asks(self, symbols: list[str] | None = None, *, cached: bool = False) -> dict:
    """
    :param symbols: List of symbols to fetch
    :param cached: Allow cached result
    :return: fetch_bids_asks result
    """
    if not self.exchange_has("fetchBidsAsks"):
        return {}
    if cached:
        with self._cache_lock:
            tickers = self._fetch_tickers_cache.get("fetch_bids_asks")
        if tickers:
            return tickers
    try:
        tickers = self._api.fetch_bids_asks(symbols)
        with self._cache_lock:
            self._fetch_tickers_cache["fetch_bids_asks"] = tickers
        return tickers
    except ccxt.NotSupported as e:
        raise OperationalException(
            f"Exchange {self._api.name} does not support fetching bids/asks in batch. "
            f"Message: {e}"
        ) from e
    except ccxt.DDoSProtection as e:
        raise DDosProtection(e) from e
    except (ccxt.OperationFailed, ccxt.ExchangeError) as e:
        raise TemporaryError(
            f"Could not load bids/asks due to {e.__class__.__name__}. Message: {e}"
        ) from e
    except ccxt.BaseError as e:
        raise OperationalException(e) from e

```

[freqtrade/exchange/exchange.py](https://github.com/freqtrade/freqtrade/blob/b6d30da09b6745065bf60d464286ebb1b889ccbe/freqtrade/exchange/exchange.py#L2101-L2132) · [More projects using CCXT →](https://dashboard.exa.ai/playground/search?q=ccxt%20GitHub%20projects)

**Quickstart**

```python
import ccxt
exchange = ccxt.kraken()
exchange.fetch_ticker('BTC/USD')

```

From [README.md](https://github.com/ccxt/ccxt/blob/master/README.md)

### Databento

[GitHub](https://github.com/databento/databento-python) · [PyPI](https://pypi.org/project/databento) · [Docs](https://databento.com/docs)

Provides the official Python client for Databento.

- Downloads / mo: 1.4M
- Stars: 314
- Last release: 0.90.0
- License: Apache-2.0
- Capabilities: [From the Databento docs](https://databento.com/docs)

```sh
pip install -U databento
```

**nautechsystems/nautilus_trader** (31.7K stars)

[nautechsystems/nautilus_trader](https://github.com/nautechsystems/nautilus_trader) 

```python
def databento_data(
    symbols: list[str],
    start_time: str,
    end_time: str,
    schema: str,
    file_prefix: str,
    *folders: str,
    dataset: str = "GLBX.MDP3",
    to_catalog: bool = True,
    base_path: Path | None = None,
    use_exchange_as_venue: bool = True,
    load_databento_files_if_exist: bool = False,
    as_legacy_cython: bool = False,
    **kwargs: Any,
) -> dict[str, Any]:
    """
    Download and save Databento data and definition files, and optionally save the data
    to a catalog.

    Parameters
    ----------
    symbols : list[str]
        The symbols to retrieve data for.
    start_time : str
        The start time of the data in ISO 8601 format.
    end_time : str
        The end time of the data in ISO 8601 format.
    schema : str
        The data schema to retrieve, either "definition" or another valid schema.
    file_prefix : str
        The prefix to use for the downloaded data files.
    *folders : str
        Additional folders to create in the data path.
    dataset : str, optional
        The Databento dataset to use, defaults to "GLBX.MDP3".
    to_catalog : bool, optional
        Whether to save the data to a catalog, defaults to True.
    base_path : Path, optional
        The base path to use for the data folder, defaults to None.
    use_exchange_as_venue : bool, optional
        Whether to use actual exchanges for instrument ids or GLBX, defaults to True.
    load_databento_files_if_exist : bool, optional
        Whether to load Databento files if they already exist, defaults to False.
    as_legacy_cython : bool, optional
        Whether to use legacy Cython format, defaults to False.
    **kwargs : Any
        Additional keyword arguments to pass to the Databento API.

    Returns
    -------
    dict[str, Any]
        A dictionary containing the downloaded data and metadata with keys:
        - symbols: The list of symbols
        - dataset: The dataset name
        - schema: The schema name
        - start: The start time
        - end: The end time
        - databento_definition_file: Path to definition file
        - databento_data_file: Path to data file (if schema != "definition")
        - databento_definition: Definition data object
        - databento_data: Data object (if schema != "definition")
        - catalog: Catalog object (if to_catalog=True)
        - nautilus_definition: Processed definition data (if to_catalog=True)
        - nautilus_data: Processed market data (if to_catalog=True)

    Notes
    -----
    If schema is equal to 'definition' then no data is downloaded or saved to the catalog.

    """
    used_path = create_data_folder(*folders, "databento", base_path=base_path)
    definition_start_date, definition_end_date = databento_definition_dates(start_time, end_time)
    definition_file_name = f"{file_prefix}_definition.dbn.zst"
    definition_file = used_path / definition_file_name
    if not definition_file.exists():
        if client is None:
            raise ValueError(
                "Databento client not initialized. Call init_databento_client() first.",
            )

        definition = client.timeseries.get_range(
            schema="definition",
            dataset=dataset,
            symbols=symbols,
            start=definition_start_date,
            end=definition_end_date,
            path=definition_file,
            **kwargs,
        )
    else:
        definition = load_databento_data(definition_file) if load_databento_files_if_exist else None

    data = None
    used_start_time = start_time.replace(":", "-").replace(".", "-")
    used_end_time = end_time.replace(":", "-").replace(".", "-")
    data_file_name = f"{file_prefix}_{schema}_{used_start_time}_{used_end_time}.dbn.zst"
    data_file = used_path / data_file_name

    if schema != "definition":
        if not data_file.exists():
            if client is None:
                raise ValueError(
                    "Databento client not initialized. Call init_databento_client() first.",
                )

            data = client.timeseries.get_range(
                schema=schema,
                dataset=dataset,
                symbols=symbols,
                start=start_time,
                end=end_time,
                path=data_file,
                **kwargs,
            )
        else:
            data = load_databento_data(data_file) if load_databento_files_if_exist else None

    result = {
        "symbols": symbols,
        "dataset": dataset,
        "schema": schema,
        "start": start_time,
        "end": end_time,
        "databento_definition_file": definition_file,
        "databento_data_file": data_file if schema != "definition" else None,
        "databento_definition": definition,
        "databento_data": data,
    }

    if schema == "definition":
        del result["databento_data_file"]
        del result["databento_data"]

    if to_catalog:
        catalog_data = save_data_to_catalog(
            *folders,
            definition_file=definition_file,
            data_file=data_file,
            base_path=base_path,
            use_exchange_as_venue=use_exchange_as_venue,
            as_legacy_cython=as_legacy_cython,
        )
        result.update(catalog_data)

    return result

```

[nautilus_trader/adapters/databento/data_utils.py](https://github.com/nautechsystems/nautilus_trader/blob/81cc70a2e4bc852376466eadae19d7de6053fab9/nautilus_trader/adapters/databento/data_utils.py#L98-L242) · [More projects using Databento →](https://dashboard.exa.ai/playground/search?q=databento%20GitHub%20projects)

**Quickstart**

```python
import databento as db

client = db.Historical('YOUR_API_KEY')
data = client.timeseries.get_range(
    dataset='GLBX.MDP3',
    symbols='ES.FUT',
    stype_in='parent',
    start='2022-06-10T14:30',
    end='2022-06-10T14:40',
)

```

From [README.md](https://github.com/databento/databento-python/blob/main/README.md)

### Alpaca-py

[GitHub](https://github.com/alpacahq/alpaca-py) · [PyPI](https://pypi.org/project/alpaca-py) · [Docs](https://alpaca.markets/sdks/python/)

Provides the official Python SDK for Alpaca APIs.

- Downloads / mo: 1.4M
- Stars: 1.6K
- Last release: 0.45.0
- License: Apache-2.0
- Capabilities: [From the Alpaca-py docs](https://alpaca.markets/sdks/python/)

```sh
pip install alpaca-py
```

**alpacahq/alpaca-mcp-server** (1.1K stars)

[alpacahq/alpaca-mcp-server](https://github.com/alpacahq/alpaca-mcp-server) 

```python
@mcp.tool()
async def get_stock_latest_quote(
    symbol_or_symbols: Union[str, List[str]],
    feed: Optional[DataFeed] = None,    
    currency: Optional[SupportedCurrencies] = None
    ) -> str:
    """
    Retrieves and formats the latest quote for one or more stocks.

    Args:
        symbol_or_symbols (Union[str, List[str]]): Stock ticker symbol(s) (e.g., 'AAPL' or ['AAPL', 'MSFT'])
        feed (Optional[DataFeed]): Data feed source (IEX or SIP)
        currency (Optional[SupportedCurrencies]): Currency for prices (default: USD)

    Returns:
        str: Latest bid/ask prices, sizes, and timestamp for each symbol
    """
    _ensure_clients()
    try:
        # Validate input before making API call
        symbols = [symbol_or_symbols] if isinstance(symbol_or_symbols, str) else list(symbol_or_symbols)
        if not symbols:
            return "No symbols provided."

        request_params = StockLatestQuoteRequest(
            symbol_or_symbols=symbol_or_symbols,
            feed=feed,
            currency=currency
        )

        quotes = stock_historical_data_client.get_stock_latest_quote(request_params)

        results: List[str] = []
        for symbol in symbols:
            quote = quotes.get(symbol)
            if not quote:
                results.append(f"No quote data found for {symbol}.")
                continue

            timestamp_value = getattr(quote, "timestamp", None)
            timestamp = timestamp_value.isoformat() if hasattr(timestamp_value, "isoformat") else timestamp_value or "N/A"

            results.extend([
                f"Symbol: {symbol}",
                f"Ask Price: ${quote.ask_price:.2f}",
                f"Bid Price: ${quote.bid_price:.2f}",
                f"Ask Size: {quote.ask_size}",
                f"Bid Size: {quote.bid_size}",
                f"Timestamp: {timestamp}",
                "",
            ])

        return "\n".join(results).strip()
    except Exception as e:
        symbols = [symbol_or_symbols] if isinstance(symbol_or_symbols, str) else list(symbol_or_symbols)
        requested = ", ".join(symbols) if symbols else ""
        return f"Error fetching quote for {requested}: {str(e)}"

```

[src/alpaca_mcp_server/server.py](https://github.com/alpacahq/alpaca-mcp-server/blob/101e57987a8d80e2c63e71edc83dbfb4e55d79d4/src/alpaca_mcp_server/server.py#L1252-L1308) · [More projects using Alpaca-py →](https://dashboard.exa.ai/playground/search?q=alpaca-py%20GitHub%20projects)

**Quickstart**

```python
from alpaca.data.historical import CryptoHistoricalDataClient
from alpaca.data.requests import CryptoBarsRequest
from alpaca.data.timeframe import TimeFrame
from datetime import datetime

# no keys required for crypto data
client = CryptoHistoricalDataClient()

request_params = CryptoBarsRequest(
                        symbol_or_symbols=["BTC/USD", "ETH/USD"],
                        timeframe=TimeFrame.Day,
                        start=datetime(2022, 7, 1)
                 )

bars = client.get_crypto_bars(request_params)

```

From [README.md](https://github.com/alpacahq/alpaca-py/blob/master/README.md)

### AKShare

[GitHub](https://github.com/akfamily/akshare) · [PyPI](https://pypi.org/project/akshare) · [Docs](https://akshare.akfamily.xyz/)

Provides a financial data interface library for Python.

- Downloads / mo: 1.2M
- Stars: 23.4K
- Last release: 1.20.65
- License: MIT
- Capabilities: [From the AKShare docs](https://akshare.akfamily.xyz/)

```sh
pip install akshare --upgrade
```

**akfamily/akquant** (2.6K stars)

[akfamily/akquant](https://github.com/akfamily/akquant) 

```python
def fetch_etf_history(
    symbol: str,
    start_date: str = "20200101",
    end_date: str = "20251231",
) -> pd.DataFrame:
    """获取单只 ETF 历史行情并标准化为 AKQuant 可直接回测的列结构.

    使用新浪数据源 ``fund_etf_hist_sina``（东方财富接口 ``fund_etf_hist_em``
    近期常被断开连接）。新浪接口一次返回全部历史、不支持日期区间与复权参数，
    这里在本地按日期截取。价格为不复权价格，除息日会有小幅跳空；
    正式研究请自行复权。
    """
    try:
        import akshare as ak

        df = ak.fund_etf_hist_sina(symbol=to_sina_etf_symbol(symbol))
        if df.empty:
            raise ValueError("返回空表")
    except Exception as exc:  # noqa: BLE001 - 示例容错，任何取数问题都回退
        # 未安装 AKShare、断网、接口改名等: 改用合成数据，保证示例能跑通
        print(f"警告: AKShare 取数失败（{type(exc).__name__}: {exc}），改用合成数据")
        df = synthetic_daily(symbol, start_date, end_date)

    required_columns = ["date", "open", "high", "low", "close", "volume"]
    missing_columns = [col for col in required_columns if col not in df.columns]
    if missing_columns:
        raise ValueError(
            f"ETF data for {symbol} is missing columns: {missing_columns}. "
            f"Available columns: {df.columns.tolist()}"
        )

    df = df[required_columns].copy()
    df["date"] = pd.to_datetime(df["date"])
    in_range = df["date"].between(pd.Timestamp(start_date), pd.Timestamp(end_date))
    df = df.loc[in_range].copy()
    for col in ["open", "high", "low", "close", "volume"]:
        df[col] = pd.to_numeric(df[col], errors="coerce")
    df = df.dropna(subset=["date", "open", "high", "low", "close", "volume"])
    df["symbol"] = symbol
    return cast(pd.DataFrame, df.sort_values("date").reset_index(drop=True))

```

[examples/59_akshare_etf_rotation.py](https://github.com/akfamily/akquant/blob/cef0dc8f3845cb80ea0eed26518f5f4347ee7df1/examples/59_akshare_etf_rotation.py#L55-L94) · [More projects using AKShare →](https://dashboard.exa.ai/playground/search?q=akshare%20GitHub%20projects)

**Quickstart**

```python
import akshare as ak

stock_df = ak.stock_zh_a_hist_tx(
    symbol="sz000001", start_date="20261020", end_date="20261027", adjust="qfq"
)
print(stock_df)

```

From [tutorial.md](https://github.com/akfamily/akshare/blob/main/docs/tutorial.md)

### fredapi

[GitHub](https://github.com/mortada/fredapi) · [PyPI](https://pypi.org/project/fredapi)

Retrieves Federal Reserve Economic Data from the St. Louis Fed.

- Downloads / mo: 1.1M
- Stars: 1.7K
- Last release: 0.5.2
- License: Apache-2.0
- Capabilities: [From the fredapi docs](https://github.com/mortada/fredapi)

```sh
pip install fredapi
```

**RUC-NLPIR/FinSight** (279 stars)

[RUC-NLPIR/FinSight](https://github.com/RUC-NLPIR/FinSight) 

```python
async def api_function(self, start: str = None):
    fred = _get_fred()
    if fred is None:
        return [ToolResult(
            name=self.name, description="FRED_API_KEY not set",
            data=None, source="FRED: CPIAUCSL",
        )]
    try:
        if start is None:
            import datetime
            start = (datetime.date.today() - datetime.timedelta(days=365 * 10)).isoformat()
        series = fred.get_series("CPIAUCSL", observation_start=start)
        data = pd.DataFrame({"date": series.index, "CPI": series.values})
    except Exception as e:
        print(f"Failed to fetch FRED CPI: {e}")
        data = None
    return [ToolResult(
        name=self.name, description="US CPI (All Urban, SA)",
        data=data, source="FRED: CPIAUCSL — https://fred.stlouisfed.org/series/CPIAUCSL",
    )]

```

[src/tools/macro/us_macro.py](https://github.com/RUC-NLPIR/FinSight/blob/8fc5bce28ac201c713219a47d30367c6a84342f4/src/tools/macro/us_macro.py#L48-L67) · [More projects using fredapi →](https://dashboard.exa.ai/playground/search?q=fredapi%20GitHub%20projects)

**Quickstart**

```python
from fredapi import Fred
fred = Fred(api_key='insert api key here')
data = fred.get_series('SP500')

```

From [README.md](https://github.com/mortada/fredapi/blob/master/README.md)

### wbdata

[GitHub](https://github.com/OliverSherouse/wbdata) · [PyPI](https://pypi.org/project/wbdata) · [Docs](https://wbdata.readthedocs.io/)

Accesses World Bank data.

- Downloads / mo: 981.7K
- Stars: 214
- Last release: 1.1.0
- License: GPL-2.0
- Capabilities: [From the wbdata docs](https://wbdata.readthedocs.io/)

```sh
pip3 install -U wbdata
```

**charliedream1/ai_quant_trade** (6.8K stars)

[charliedream1/ai_quant_trade](https://github.com/charliedream1/ai_quant_trade) 

```python
def demo_wbdata():
    """使用 wbdata 包获取数据"""
    import wbdata

    # 1. 查询国家列表
    print("=" * 60)
    print("1. 查询国家列表（前10个）")
    print("=" * 60)
    countries = wbdata.get_countries()
    for c in countries[:10]:
        print(f"  {c['id']}: {c['name']}")

    # 2. 获取中国GDP
    print("\n" + "=" * 60)
    print("2. 中国GDP（2010-2023）")
    print("=" * 60)
    result = wbdata.get_data('NY.GDP.MKTP.CD', country='CHN',
                            date=('2010', '2023'))
    # get_data 返回 Result 对象，可直接转为 DataFrame
    df = pd.DataFrame(result)
    if 'value' in df.columns:
        df['value'] = pd.to_numeric(df['value'], errors='coerce')
    print(df[['date', 'value']].sort_values('date') if 'date' in df.columns else df)

    # 3. 多国多指标对比
    print("\n" + "=" * 60)
    print("3. 中美日 GDP与人口对比")
    print("=" * 60)
    indicators = {
        'NY.GDP.MKTP.CD': 'GDP(美元)',
        'SP.POP.TOTL': '人口',
        'NY.GDP.PCAP.CD': '人均GDP(美元)'
    }
    # wbdata.get_dataframe 在某些版本中传入 country 列表会报
    # TypeError: unhashable type: dict，改为逐国获取后合并
    frames = []
    for country_code in ['CHN', 'USA', 'JPN']:
        df_c = wbdata.get_dataframe(indicators, country=country_code)
        df_c['country'] = country_code
        frames.append(df_c.reset_index())
    df = pd.concat(frames, ignore_index=True)
    df = df.sort_values(['country', 'date'], ascending=[True, False])
    print(df.head(20))

```

[egs_data/宏观经济/world_bank/world_bank_demo.py](https://github.com/charliedream1/ai_quant_trade/blob/f209fb360f02d3883ca0b4e010e44f1a3eac0089/egs_data/宏观经济/world_bank/world_bank_demo.py#L40-L82) · [More projects using wbdata →](https://dashboard.exa.ai/playground/search?q=wbdata%20GitHub%20projects)

**Quickstart**

```python
import wbdata
wbdata.get_sources()

```

From [index.md](https://github.com/OliverSherouse/wbdata/blob/master/docs/index.md)

### ib_async

[GitHub](https://github.com/ib-api-reloaded/ib_async) · [PyPI](https://pypi.org/project/ib_async) · [Docs](https://ib-api-reloaded.github.io/ib_async/)

Provides a sync and async framework for the Interactive Brokers API.

- Downloads / mo: 769.2K
- Stars: 1.8K
- Last release: 2.1.0
- License: BSD-2-Clause
- Capabilities: [From the ib_async docs](https://ib-api-reloaded.github.io/ib_async/)

```sh
pip install ib_async
```

**Quickstart**

```python
from ib_async import *
# util.startLoop()  # uncomment this line when in a notebook

ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)

# Request historical data
contract = Forex('EURUSD')
bars = ib.reqHistoricalData(
    contract, endDateTime='', durationStr='30 D',
    barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)

# Convert to pandas dataframe (pandas needs to be installed):
df = util.df(bars)
print(df.head())

ib.disconnect()

```

From [README.md](https://github.com/ib-api-reloaded/ib_async/blob/main/README.md) · [Find projects using ib_async →](https://dashboard.exa.ai/playground/search?q=ib_async%20GitHub%20projects)

## FAQ

### Which Python financial data library should I use?

[yfinance](#yfinance) suits research on stock prices and fundamentals from Yahoo Finance. [CCXT](#ccxt) suits cryptocurrency exchanges through one unified API. [Databento](#databento) and [Alpaca-py](#alpaca-py) suit licensed historical and live market data.

### What is yfinance?

[yfinance](#yfinance) retrieves market data, ticker information, and financial statements from Yahoo Finance. The code license of the library and the terms for using the data are separate.

### What is Databento?

[Databento](#databento) is the official Python client for the Databento market data service. Historical data and live streams use separate clients, and each needs an API key and dataset permissions.

### What is AKShare?

[AKShare](#akshare) is a financial data interface library that returns pandas DataFrames from many sources, including Chinese equity, ETF, and macroeconomic series.

### What is CCXT?

[CCXT](#ccxt) is a cryptocurrency trading API that covers many exchanges through one interface. It fetches market data and candles where an exchange supports them, and its Pro version adds WebSocket streams.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python financial data libraries yfinance pandas-datareader alpha-vantage finnhub-python code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
