Hi Alphatect,

I used below script. All you have to do is to create an assetList containing all of your stock symbols and save as csv. Afterwards change following line in below code.

assetList("HistorySP500AssetsSP500.csv");

This will convert all of your csv files into t6 very quickly.


#define SPLIT // split into separate years


string Format = "+%d/%m/%Y,f3,f1,f2,f4,f6,f5";

int n;

function convert(string InName, string OutName)
{
int Records = dataParse(n,Format,InName);
printf("n%d lines read",Records);

#ifndef SPLIT
if(Records) dataSave(n,OutName);
#else

int i, Start = 0, Year, LastYear = 0;
for(i=0; i<Records; i++)
{
Year = atoi(strdate("%Y",dataVar(n,i,0)));
if(!LastYear) LastYear = Year;
if(i == Records-1)
{ // end of file
LastYear = Year; Year = 0;
}
if(Year != LastYear)
{
string NewName = strf("%s_%4i.t6",strxc(OutName,'.',0),LastYear);
printf("n%s",NewName);
dataSave(n,NewName,Start,i-Start);
Start = i;
LastYear = Year;
}
}
#endif
}

function main()
{
int x = assetList("HistorySP500AssetsSP500.csv");
int i;
n=1;

for(i=0; i<x; i++)
{
string down = Assets[i];
convert(down,down);
n++;
}
}