You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Quantopian平台的公开数据集导入本地Python脚本?

Can I Import Quantopian Datasets into a Local Python Script?

First off, let's get the hard truth out there: Quantopian shut down its core services back in 2020, so all official APIs—including the dataset import tools you’re hoping to use—are completely non-functional now. The quantopian PyPI package never existed, and quantopian-tools was deprecated long ago with no remaining access to the original databases. Those paths are dead ends.

That said, you have solid alternatives to get similar data for your local Python scripts:

  • Leverage public or third-party data sources
    Most of Quantopian’s datasets came from public or commercial providers that you can access directly. For example:

    • Free options: Yahoo Finance, Alpha Vantage, or Federal Reserve Economic Data (FRED). Use libraries like pandas-datareader to pull this data into your local environment easily:
      import pandas_datareader.data as web
      from datetime import datetime
      
      start_date = datetime(2021, 1, 1)
      end_date = datetime(2024, 1, 1)
      # Pull Apple stock data from Yahoo Finance
      stock_data = web.DataReader("AAPL", "yahoo", start_date, end_date)
      
    • Paid options: If you need professional-grade data (like the CRSP/Compustat datasets Quantopian used), providers like Nasdaq Data Link (formerly Quandl), Polygon.io, or FactSet offer APIs that integrate seamlessly with Python.
  • Check community-backed backups
    Some developers backed up subsets of Quantopian’s datasets before the platform shut down, which you might find on GitHub or other code hosting platforms. Critical note: Always verify the data’s license before using it—many of Quantopian’s datasets had restricted usage rights, so you can’t use backups for commercial purposes without explicit permission.

  • Recreate custom datasets locally
    If the dataset you want was a derived factor (like custom moving averages or volatility metrics), you can rebuild it yourself using raw market data and Python libraries like pandas or NumPy. For example, calculate a 50-day moving average once you have daily price data for your target assets.

Just to recap: There’s no direct way to pull Quantopian’s original datasets into a local script anymore, but these alternatives should get you close to matching your original needs.

内容的提问来源于stack exchange,提问作者KOB

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:27:36