integrated TFuture
This commit is contained in:
@@ -4,6 +4,7 @@ interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Classes, System.Generics.Collections, System.StrUtils,
|
||||
Myc.Futures,
|
||||
Myc.TickLoader, Myc.OHLCCache; // OHLCCache for TOHLC, IGenericCandleBuilder, TF_ constants
|
||||
|
||||
type
|
||||
@@ -62,26 +63,25 @@ const
|
||||
{ TChartDataController }
|
||||
|
||||
constructor TChartDataController.Create(AMemoTarget: TStrings);
|
||||
var
|
||||
I: Integer; // Standard loop variable
|
||||
begin
|
||||
inherited Create;
|
||||
FMemoLog := AMemoTarget;
|
||||
FGenericBuilders := TDictionary<string, IGenericCandleBuilder>.Create;
|
||||
|
||||
InitializeBaseTimeframeSettings; // This populates FTimeframeSettingsArray
|
||||
|
||||
FOHLCCacheList := TList<TOHLC>.Create; // Create the TList object
|
||||
// Add nil placeholders for each timeframe setting defined in FTimeframeSettingsArray
|
||||
// This ensures FOHLCCacheList is parallel to FTimeframeSettingsArray from the start.
|
||||
for I := 0 to High(FTimeframeSettingsArray) do
|
||||
begin
|
||||
FOHLCCacheList.Add(nil); // Add a nil item to the list
|
||||
end;
|
||||
|
||||
SetLength(FTickDataArray, 0);
|
||||
if FMemoLog <> nil then
|
||||
FMemoLog.Add('TChartDataController instance created. Base timeframes initialized.');
|
||||
var
|
||||
I: Integer; // Standard loop variable
|
||||
begin
|
||||
inherited Create;
|
||||
FMemoLog := AMemoTarget;
|
||||
FGenericBuilders := TDictionary<string, IGenericCandleBuilder>.Create;
|
||||
|
||||
InitializeBaseTimeframeSettings; // This populates FTimeframeSettingsArray
|
||||
|
||||
FOHLCCacheList := TList<TOHLC>.Create; // Create the TList object
|
||||
// Add nil placeholders for each timeframe setting defined in FTimeframeSettingsArray
|
||||
// This ensures FOHLCCacheList is parallel to FTimeframeSettingsArray from the start.
|
||||
for I := 0 to High(FTimeframeSettingsArray) do
|
||||
begin
|
||||
FOHLCCacheList.Add(nil); // Add a nil item to the list
|
||||
end;
|
||||
|
||||
if FMemoLog <> nil then
|
||||
FMemoLog.Add('TChartDataController instance created. Base timeframes initialized.');
|
||||
end;
|
||||
|
||||
destructor TChartDataController.Destroy;
|
||||
@@ -211,16 +211,15 @@ procedure TChartDataController.LoadTickDataSeries(const AFileName: string);
|
||||
begin
|
||||
ClearAllDataAndCaches();
|
||||
try
|
||||
FTickDataArray := Myc.TickLoader.LoadTickDataSeries(AFileName);
|
||||
FTickDataArray := Myc.TickLoader.LoadTickDataSeries(AFileName).WaitFor;
|
||||
if FMemoLog <> nil then
|
||||
FMemoLog.Add(Format('DataController: Loaded %d tick records from series: %s',
|
||||
[Length(FTickDataArray), AFileName]));
|
||||
FMemoLog.Add(Format('DataController: Loading tick records from series: %s',
|
||||
[AFileName]));
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
if FMemoLog <> nil then
|
||||
FMemoLog.Add(Format('DataController: Error loading tick data from %s - %s', [AFileName, E.Message]));
|
||||
SetLength(FTickDataArray, 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user