Files
Michael Schimmel 06ec0db105 1st commit
2025-05-23 12:51:32 +02:00

67 lines
2.1 KiB
ObjectPascal

program TickLoader;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
System.Math, // Added for Min function
Myc.TickLoader in 'Myc.TickLoader.pas';
var
TickData: TArray<TTickData>;
DataFile: string;
I: Integer; // Loop counter
RecordsToDisplay: Integer;
begin
ReportMemoryLeaksOnShutdown := True;
DataFile := 'C:\Users\Brummel\Documents\cAlgo\TickDataBacktests\Pep_GER40_2017.tab';
try
WriteLn('Attempting to load tick data from: ', DataFile);
TickData := LoadTickDataSeries(DataFile);
WriteLn(Format('%d tick data records loaded.', [Length(TickData)]));
WriteLn(''); // Add a blank line for better readability
if Length(TickData) > 0 then
begin
WriteLn('--- Sample Tick Data Output ---');
WriteLn('Index | OADateTime | Ask | Bid');
WriteLn('------------------------------------');
// Determine how many records to display, e.g., first 10 or all if fewer than 10
RecordsToDisplay := Min(Length(TickData), 10); // Display up to the first 10 records
for I := 0 to RecordsToDisplay - 1 do // Iterate through the selected number of records
begin
// Output each field of the TTickData record, formatted for alignment
WriteLn(Format('%-5d | %-14.5f | %-8.5f | %.5f', [
I,
TickData[I].OADateTime,
TickData[I].Ask,
TickData[I].Bid
]));
end;
WriteLn('------------------------------------');
if Length(TickData) > RecordsToDisplay then
begin
WriteLn(Format('(Showing first %d of %d records)', [RecordsToDisplay, Length(TickData)]));
end;
end
else
begin
WriteLn('No tick data loaded to display.');
end;
except
on E: Exception do
begin
WriteLn(Format('Error: %s', [E.Message]));
end;
end;
WriteLn('');
WriteLn('Press Enter to exit.');
ReadLn;
end.