Refactoring
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<ProjectVersion>20.3</ProjectVersion>
|
||||
<FrameworkType>FMX</FrameworkType>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Config Condition="'$(Config)'==''">Release</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">AuraTrader</ProjectName>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
|
||||
@@ -89,7 +89,7 @@ object Form1: TForm1
|
||||
Size.Height = 311.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
Viewport.Width = 796.00000000000000000
|
||||
Viewport.Height = 311.00000000000000000
|
||||
Viewport.Width = 792.00000000000000000
|
||||
Viewport.Height = 307.00000000000000000
|
||||
end
|
||||
end
|
||||
|
||||
+32
-28
@@ -217,37 +217,41 @@ begin
|
||||
var currPathData := TMutable<IObjectRef<TPathData>>.CreateWriteable.Protect;
|
||||
var currLog := TMutable<String>.CreateWriteable.Protect;
|
||||
|
||||
const width = 1000;
|
||||
const incsize = 100;
|
||||
const width = 3000;
|
||||
|
||||
var done := TaskManager.RunTask(
|
||||
nil,
|
||||
function: TState
|
||||
begin
|
||||
var arr := TDataSeries<TAskBidItem>.CreateWriteable(width);
|
||||
Result :=
|
||||
FServer.ProcessData(
|
||||
Symbol,
|
||||
FTerminate.Signal,
|
||||
procedure(const Values: TArray<TDataPoint<TAskBidItem>>; const Terminated: TState)
|
||||
begin
|
||||
arr.Add(Values);
|
||||
currLog.Value := arr.TotalCount.ToString;
|
||||
|
||||
var PathData := TPathData.Create;
|
||||
var Prices := arr;
|
||||
if Prices.Count > 0 then
|
||||
var done :=
|
||||
TaskManager.RunTask(
|
||||
nil,
|
||||
function: TState
|
||||
begin
|
||||
var Prices := TDataSeries<TAskBidItem>.CreateWriteable(width);
|
||||
Result :=
|
||||
FServer.ProcessData(
|
||||
Symbol,
|
||||
FTerminate.Signal,
|
||||
procedure(const Values: TArray<TDataPoint<TAskBidItem>>; const Terminated: TState)
|
||||
begin
|
||||
PathData.MoveTo(PointF(Prices.Count - 1, Prices[0].Data.Ask));
|
||||
for var i := 1 to Prices.Count - 1 do
|
||||
PathData.LineTo(PointF(Prices.Count - i - 1, Prices[i].Data.Ask));
|
||||
end;
|
||||
Prices.Add(Values);
|
||||
currLog.Value := Prices.TotalCount.ToString;
|
||||
|
||||
currPathData.Value := TObjectRef<TPathData>.Create(PathData);
|
||||
end
|
||||
);
|
||||
end
|
||||
);
|
||||
var PathData := TPathData.Create;
|
||||
if Prices.Count > 0 then
|
||||
begin
|
||||
var n := Prices.Count;
|
||||
PathData.MoveTo(PointF(n - 1, Prices[0].Data.Ask));
|
||||
for var i := 1 to n - 1 do
|
||||
PathData.LineTo(PointF(n - i - 1, Prices[i].Data.Ask));
|
||||
|
||||
for var i := n - 1 downto 0 do
|
||||
PathData.LineTo(PointF(n - i - 1, Prices[i].Data.Bid));
|
||||
end;
|
||||
PathData.ClosePath;
|
||||
|
||||
currPathData.Value := TObjectRef<TPathData>.Create(PathData);
|
||||
end
|
||||
);
|
||||
end
|
||||
);
|
||||
|
||||
FLoadDone := TState.All([FLoadDone, done]);
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ begin
|
||||
begin
|
||||
try
|
||||
cProc.Signal.Subscribe(Done);
|
||||
cProc := nil;
|
||||
except
|
||||
Done.Notify;
|
||||
raise;
|
||||
|
||||
Reference in New Issue
Block a user