Skip to content

financialdatanet/backtrader-feed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

FinancialData.Net feed for Backtrader

End-of-day Data

Asset Class API Endpoint
stock get_stock_prices
international_stock get_international_stock_prices
etf get_etf_prices
commodity get_commodity_prices
otc get_otc_prices
crypto get_crypto_prices
forex get_forex_prices

Intraday Data

Asset Class API Endpoint
stock / etf get_minute_prices
crypto get_crypto_minute_prices
forex get_forex_minute_prices

Installation

pip install backtrader fdnpy

Usage Example

    import datetime as dt
    import backtrader as bt
    from feeds import FinancialDataNetData

    cerebro = bt.Cerebro()
    data = FinancialDataNetData(
        symbol='AAPL',
        api_key='YOUR_API_KEY',
        asset_class='stock',
        timeframe=bt.TimeFrame.Days,
        fromdate=dt.datetime(2020, 1, 1),
        todate=dt.datetime(2025, 12, 31),
    )

    cerebro.adddata(data)
    cerebro.run()
    cerebro.plot()

Notes

  • Resampling: Only 1-day and 1-minute bars are natively supported. Use Backtrader resampling for other timeframes.
  • Pagination: Historical minute queries are fetched day-by-day because the API endpoints are date-scoped.
  • Sorting: Rows are ordered oldest to newest automatically before loading.

Releases

No releases published

Packages

 
 
 

Contributors

Languages