For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Multiple Symbols in one CSV file

  • Hi All. I know this may sound very easy but does anyone have any idea how to load multiple symbols with multiple time frames from only one csv file? I have been looking around for a while now and I cant seem to find a suitable example for this application. I usually come across examples using either an external feed and/or multiple symbols coming from different files. Im a bit new to this library and it would be very helpful for me to at least load my own data so that I can start exploring more of the library. please see below sample format (it has more symbols/timeframe in the csv file.

    $FORMAT  Ticker,Date_YMD,Time,Open,High,Low,Close,Volume

  • Are you expecting multiple time frames for the same symbol to be in the same CSV file ? ( in that case how do you know which time frame each line is associated with ?

  • I think the easiest way is to separate tickets with the external script and get set of files/DatsFrames suitable for bt. Otherwise it requires writing of the new data feed class.

  • administrators

    Your best approach:

    • Load it with pandas.read_csv

    • Separate by symbol by using, for example, the clause where (that is, you create a mask that considers only the name of a ticker)

    • Write the result of each mask to a separate csv file.

    The last step can actually be forfeited, because you end up with several pandas.DataFrames which can be directly fed to cerebro via PandasData

Log in to reply