|
momet
2019-05-08 15:06:50
0
|
|
Hi Guys, i want to export historical data from an indicator. what should i do for it?
|
|
|
|
|
GS
2021-12-31 23:44:17
0
|
|
Hello QS,
With reference to this script:
Symbol[] symbols = Symbols.GetSymbols();
System.Text.StringBuilder text = new System.Text.StringBuilder("");
for(int i=0;i < symbols.Length;i++)
{
Symbol sym = symbols[i];
HistoricalQuotes quotes = Quotes.GetHistoricalQuotes(sym.Name);
for(int j=0;j < quotes.Close.Length;j++)
{
text.AppendLine(sym.Name + ";" + quotes.Date[j].ToString("dd/MM/yyyy") + ";" + quotes.Close[j]+ ";" + quotes.Open[j] + ";" + quotes.High[j] + ";" + quotes.Low[j] + ";" + quotes.Volume[j]);
}
}
System.IO.File.WriteAllText(@"c:\quotes.csv", text.ToString());
Would it be possible for me to export Open Interest Data also (I have it in my historical database)? I tried the following modification but it did not work:
text.AppendLine(sym.Name + ";" + quotes.Date[j].ToString("dd/MM/yyyy") + ";" + quotes.Close[j]+ ";" + quotes.Open[j] + ";" + quotes.High[j] + ";" + quotes.Low[j] + ";" + quotes.Volume[j] + ";" + quotes.OpenInt[j]);
Looking forward to seeing your quick response.
Thanks and best regards
Ghanshyam
|
|
|
|
R P
2024-01-07 07:23:41
0
|
|
@Quantshare
How can I export Last few months update? for example if I want to export just the last one month update only? How do I do that?
Thanks in advance!!
|
|
|
|
QuantShare
2024-01-08 23:31:33
0
|
|
You need to add a condition after the "for" statement
Something like
if(DateTime.Now.Subtract(quotes.Date[j].Year).Days < 31)
{
text.AppendLine(sym.Name + ";" + quotes.Date[j].ToString("dd/MM/yyyy") + ";" + quotes.Close[j]+ ";" + quotes.Open[j] + ";" + quotes.High[j] + ";" + quotes.Low[j] + ";" + quotes.Volume[j]);
}
|
|
|
|
R P
2024-01-09 14:16:00
0
|
|
I will try this!! Thanks!
|
|
|
|