read asset price history directly from CSV?

Posted By: Gloria

read asset price history directly from CSV? - 09/18/17 08:43

Hi,

I wonder whether I can read an asset's price history directly from a CSV file. The point is to avoid first converting from CSV to .t6 and instead directly feed a CSV into a series(..) array.

The context of my question is the following. My strategy trades a futures contract on minute bars. The current contract changes once every three months.

But I want to use the 200-day (> 3 months) moving average in my strategy. Therefore, some external program that I already have, concatenates the various futures contracts according to some roll schedule and provides a single time series in CSV format. From this time series, I'd like to compute the 200-day moving average on which my strategy depends.

From what I have read so far, I'd guess the best way of dealing with this issue in Zorro would be to base the strategy on two assets:
+ the current futures contract on minute bars that is traded
+ the coninuous daily time series read in from the CSV file that has no life ticks and that is not traded

So my question is how can I set up an asset(..) with history(..) in my run() function that gets the external daily CSV time series directly into a series(...)?

Thank you in advance for your help. Kind regards,

Gloria
Posted By: jcl

Re: read asset price history directly from CSV? - 09/18/17 11:24

I would either scan the CSV file directly f.i. with the file_content function, or use the dataParse function for parsing it into a dataset.
Posted By: Gloria

Re: read asset price history directly from CSV? - 09/19/17 13:28

Thanks, I figured out how to read the data into a dataset.

Is there any way I can run a Zorro strategy with two different assets whose historical data have different bar periods? (i.e. the current contract with minute bars and an external time series with daily bars) Is that explained anywhere in the manual or in the forum? If yes, I would simply put my CSV time series into a separate asset and could apply the usual indicators. If not, is there any way of working with the dataset that avoids re-implementing all the indicators?

Kind regards and thanks for your help.

Gloria
© 2024 lite-C Forums