Tools

Yahoo! Finance

pyalgotrade.tools.yahoofinance.download_daily_bars(instrument, year, csvFile)

Download bars for a given year.

Parameters:
  • instrument (string.) – Instrument identifier.
  • year (int.) – The year.
  • csvFile (string.) – The path to the CSV file to write.

BarFeed resampling

pyalgotrade.tools.resample.resample_to_csv(barFeed, frequency, csvFile)

Resample a BarFeed into a CSV file grouping bars by a certain frequency. The resulting file can be loaded using pyalgotrade.barfeed.csvfeed.GenericBarFeed. The CSV file will have the following format:

Date Time,Open,High,Low,Close,Volume,Adj Close
2013-01-01 00:59:59,13.51001,13.56,13.51,13.56,273.88014126,13.51001
Parameters:
  • barFeed (pyalgotrade.barfeed.BarFeed) – The bar feed that will provide the bars. It should only hold bars from a single instrument.
  • frequency – The output frequency.
  • csvFile (string.) – The path to the CSV file to write.

Note

  • Datetimes are stored without timezone information.
  • Adj Close column may be empty if the input bar feed doesn’t have that info.
  • Valid frequency parameter values are:
  • pyalgotrade.barfeed.Frequency.MINUTE
  • pyalgotrade.barfeed.Frequency.HOUR
  • pyalgotrade.barfeed.Frequency.DAY

Table Of Contents

Previous topic

marketsession – Market sessions

Next topic

Event profiler

This Page