1st Aura Project Layout
This commit is contained in:
@@ -6,7 +6,9 @@ uses
|
||||
FMX.Forms,
|
||||
MainForm in 'MainForm.pas' {Form1},
|
||||
Myc.Trade.Core.DataPoint in '..\Src\Myc.Trade.Core.DataPoint.pas',
|
||||
Myc.Trade.Ticker in '..\Src\Myc.Trade.Ticker.pas';
|
||||
Myc.Trade.Ticker in '..\Src\Myc.Trade.Ticker.pas',
|
||||
Myc.Aura.Module in '..\Src\Myc.Aura.Module.pas',
|
||||
Myc.Aura.Parameter in '..\Src\Myc.Aura.Parameter.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
||||
@@ -135,6 +135,8 @@
|
||||
</DCCReference>
|
||||
<DCCReference Include="..\Src\Myc.Trade.Core.DataPoint.pas"/>
|
||||
<DCCReference Include="..\Src\Myc.Trade.Ticker.pas"/>
|
||||
<DCCReference Include="..\Src\Myc.Aura.Module.pas"/>
|
||||
<DCCReference Include="..\Src\Myc.Aura.Parameter.pas"/>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
|
||||
+64
-41
@@ -11,85 +11,108 @@ object Form1: TForm1
|
||||
OnDestroy = FormDestroy
|
||||
DesignerMasterStyle = 0
|
||||
object Panel1: TPanel
|
||||
Align = Top
|
||||
Align = Client
|
||||
Size.Width = 796.00000000000000000
|
||||
Size.Height = 529.00000000000000000
|
||||
Size.Height = 616.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 2
|
||||
object RandomButton: TButton
|
||||
Position.X = 697.00000000000000000
|
||||
Position.Y = 38.00000000000000000
|
||||
TabOrder = 0
|
||||
Text = 'Random'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = RandomButtonClick
|
||||
end
|
||||
object Path1: TPath
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
Position.X = 8.00000000000000000
|
||||
Position.Y = 8.00000000000000000
|
||||
Size.Width = 261.00000000000000000
|
||||
Size.Height = 513.00000000000000000
|
||||
object Layout: TFlowLayout
|
||||
Align = Client
|
||||
Size.Width = 627.00000000000000000
|
||||
Size.Height = 616.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
Justify = Left
|
||||
JustifyLastLine = Left
|
||||
FlowDirection = LeftToRight
|
||||
HorizontalGap = 2.00000000000000000
|
||||
VerticalGap = 2.00000000000000000
|
||||
OnResized = LayoutResized
|
||||
end
|
||||
object SymbolsComboBox: TComboBox
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 493.00000000000000000
|
||||
Position.Y = 8.00000000000000000
|
||||
Size.Width = 217.00000000000000000
|
||||
Position.X = 608.00000000000000000
|
||||
Position.Y = 16.00000000000000000
|
||||
Size.Width = 177.00000000000000000
|
||||
Size.Height = 22.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 5
|
||||
end
|
||||
object RandomBox: TCheckBox
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 609.00000000000000000
|
||||
Position.Y = 46.00000000000000000
|
||||
TabOrder = 2
|
||||
Text = 'Random'
|
||||
end
|
||||
object LoadButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 718.00000000000000000
|
||||
Position.Y = 8.00000000000000000
|
||||
Position.X = 641.00000000000000000
|
||||
Position.Y = 86.00000000000000000
|
||||
Size.Width = 47.00000000000000000
|
||||
Size.Height = 22.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
TabOrder = 6
|
||||
Text = 'Load'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = LoadButtonClick
|
||||
end
|
||||
object FlowLayout: TFlowLayout
|
||||
Position.X = 304.00000000000000000
|
||||
Position.Y = 104.00000000000000000
|
||||
Size.Width = 449.00000000000000000
|
||||
Size.Height = 361.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 5
|
||||
Justify = Left
|
||||
JustifyLastLine = Left
|
||||
FlowDirection = LeftToRight
|
||||
object RandomButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 705.00000000000000000
|
||||
Position.Y = 86.00000000000000000
|
||||
TabOrder = 3
|
||||
Text = 'Random'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = RandomButtonClick
|
||||
end
|
||||
object ChartButton: TButton
|
||||
Position.X = 712.00000000000000000
|
||||
Position.Y = 72.00000000000000000
|
||||
TabOrder = 6
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 665.00000000000000000
|
||||
Position.Y = 130.00000000000000000
|
||||
TabOrder = 8
|
||||
Text = 'ChartButton'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = ChartButtonClick
|
||||
end
|
||||
object StopButton: TButton
|
||||
Position.X = 720.00000000000000000
|
||||
Position.Y = 96.00000000000000000
|
||||
TabOrder = 8
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 665.00000000000000000
|
||||
Position.Y = 160.00000000000000000
|
||||
TabOrder = 10
|
||||
Text = 'StopButton'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = StopButtonClick
|
||||
end
|
||||
object TreeView1: TTreeView
|
||||
Align = Left
|
||||
Size.Width = 161.00000000000000000
|
||||
Size.Height = 616.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 0
|
||||
Viewport.Width = 157.00000000000000000
|
||||
Viewport.Height = 612.00000000000000000
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Align = Left
|
||||
Cursor = crHSplit
|
||||
MinSize = 20.00000000000000000
|
||||
Position.X = 161.00000000000000000
|
||||
Size.Width = 8.00000000000000000
|
||||
Size.Height = 616.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
end
|
||||
object LogMemo: TMemo
|
||||
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
|
||||
DataDetectorTypes = []
|
||||
Align = Client
|
||||
Align = Bottom
|
||||
Position.Y = 616.00000000000000000
|
||||
Size.Width = 796.00000000000000000
|
||||
Size.Height = 311.00000000000000000
|
||||
Size.Height = 224.00000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
Viewport.Width = 792.00000000000000000
|
||||
Viewport.Height = 307.00000000000000000
|
||||
Viewport.Height = 220.00000000000000000
|
||||
end
|
||||
end
|
||||
|
||||
+59
-28
@@ -34,25 +34,30 @@ uses
|
||||
Myc.Signals.FMX,
|
||||
Myc.TaskManager,
|
||||
FMX.ListBox,
|
||||
FMX.Layouts;
|
||||
FMX.Layouts,
|
||||
FMX.MultiView,
|
||||
FMX.TreeView;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
LogMemo: TMemo;
|
||||
Panel1: TPanel;
|
||||
RandomButton: TButton;
|
||||
Path1: TPath;
|
||||
Layout: TFlowLayout;
|
||||
SymbolsComboBox: TComboBox;
|
||||
RandomBox: TCheckBox;
|
||||
LoadButton: TButton;
|
||||
FlowLayout: TFlowLayout;
|
||||
RandomButton: TButton;
|
||||
ChartButton: TButton;
|
||||
StopButton: TButton;
|
||||
TreeView1: TTreeView;
|
||||
Splitter1: TSplitter;
|
||||
procedure RandomButtonClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure LoadButtonClick(Sender: TObject);
|
||||
procedure ChartButtonClick(Sender: TObject);
|
||||
procedure StopButtonClick(Sender: TObject);
|
||||
procedure LayoutResized(Sender: TObject);
|
||||
private
|
||||
const
|
||||
cnt = 20;
|
||||
@@ -70,6 +75,8 @@ type
|
||||
FRandom: TList<TRndItem>;
|
||||
FTerminate: TEvent;
|
||||
FLoadDone: TState;
|
||||
function SelectedSymbol: String;
|
||||
function SelectedStream: IDataStream<TAskBidItem>;
|
||||
public
|
||||
{ Public declarations }
|
||||
published
|
||||
@@ -102,7 +109,7 @@ begin
|
||||
|
||||
FSymbols := FServer.EnumerateSymbols;
|
||||
|
||||
SymbolsComboBox.AddIdleHandler(
|
||||
SymbolsComboBox.ProcessSignal(
|
||||
FSymbols.Done.Signal,
|
||||
procedure
|
||||
begin
|
||||
@@ -130,10 +137,14 @@ begin
|
||||
FSymbols.WaitFor;
|
||||
FTerminate.Notify;
|
||||
TaskManager.WaitFor(FLoadDone);
|
||||
Application.OnIdle := nil;
|
||||
FRandom.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.LayoutResized(Sender: TObject);
|
||||
begin
|
||||
LogMemo.Lines.Add('resize');
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadButtonClick(Sender: TObject);
|
||||
begin
|
||||
if SymbolsComboBox.ItemIndex < 0 then
|
||||
@@ -142,7 +153,11 @@ begin
|
||||
var Stream := FServer.CreateStream(FSymbols.WaitFor[SymbolsComboBox.ItemIndex]);
|
||||
var Data := TDataStreamProvider.Create<TAskBidItem>(30000, 10000, Stream);
|
||||
|
||||
Path1.AddIdleHandler(
|
||||
var path := TPath.Create(Self);
|
||||
path.Parent := Layout;
|
||||
path.Align := TAlignLayout.None;
|
||||
|
||||
path.ProcessSignal(
|
||||
Data.Changed,
|
||||
procedure
|
||||
begin
|
||||
@@ -150,14 +165,14 @@ begin
|
||||
|
||||
if Prices.Count > 0 then
|
||||
begin
|
||||
Path1.BeginUpdate;
|
||||
path.BeginUpdate;
|
||||
try
|
||||
Path1.Data.Clear;
|
||||
Path1.Data.MoveTo(PointF(Path1.Width - 1, Prices[0].Data.Ask));
|
||||
path.Data.Clear;
|
||||
path.Data.MoveTo(PointF(path.Width - 1, Prices[0].Data.Ask));
|
||||
for var i := 1 to Prices.Count - 1 do
|
||||
Path1.Data.LineTo(PointF(Path1.Width - i - 1, Prices[i].Data.Ask));
|
||||
path.Data.LineTo(PointF(path.Width - i - 1, Prices[i].Data.Ask));
|
||||
finally
|
||||
Path1.EndUpdate;
|
||||
path.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@@ -168,12 +183,11 @@ procedure TForm1.RandomButtonClick(Sender: TObject);
|
||||
begin
|
||||
var rnd: TRndItem;
|
||||
|
||||
var ass := FSymbols.WaitFor;
|
||||
rnd.Stream := FServer.CreateStream(ass[Random(Length(FSymbols.WaitFor))]);
|
||||
rnd.Stream := FServer.CreateStream(FSymbols.WaitFor[Random(Length(FSymbols.WaitFor))]);
|
||||
rnd.Data := TDataStreamProvider.Create<TAskBidItem>(3000, 1000, rnd.Stream);
|
||||
|
||||
rnd.Labl := TLabel.Create(Self);
|
||||
rnd.Labl.Parent := FlowLayout;
|
||||
rnd.Labl.Parent := Layout;
|
||||
rnd.Labl.Align := TAlignLayout.None;
|
||||
rnd.Labl.WordWrap := false;
|
||||
rnd.Labl.Width := 300;
|
||||
@@ -185,7 +199,7 @@ begin
|
||||
begin
|
||||
FRandom[idx]
|
||||
.Labl
|
||||
.AddIdleHandler(
|
||||
.ProcessSignal(
|
||||
FRandom[idx].Data.Changed,
|
||||
procedure
|
||||
begin
|
||||
@@ -209,15 +223,14 @@ end;
|
||||
|
||||
procedure TForm1.ChartButtonClick(Sender: TObject);
|
||||
begin
|
||||
if SymbolsComboBox.ItemIndex < 0 then
|
||||
var Symbol := SelectedSymbol;
|
||||
if Symbol = '' then
|
||||
exit;
|
||||
|
||||
var Symbol := FSymbols.WaitFor[SymbolsComboBox.ItemIndex];
|
||||
var currPathData := TWriteable<IObjectRef<TPathData>>.CreateWriteable.Protect;
|
||||
var currLog := TWriteable<String>.CreateWriteable.Protect;
|
||||
|
||||
var currPathData := TMutable<IObjectRef<TPathData>>.CreateWriteable.Protect;
|
||||
var currLog := TMutable<String>.CreateWriteable.Protect;
|
||||
|
||||
const width = 3000;
|
||||
const width = 300;
|
||||
|
||||
var done :=
|
||||
TaskManager.RunTask(
|
||||
@@ -255,18 +268,36 @@ begin
|
||||
|
||||
FLoadDone := TState.All([FLoadDone, done]);
|
||||
|
||||
LogMemo.AddIdleHandler(currLog.Changed, procedure begin LogMemo.Lines.Add(Symbol + ': ' + currLog.Value); end);
|
||||
var path := TPath.Create(Self);
|
||||
path.Parent := Layout;
|
||||
path.Align := TAlignLayout.None;
|
||||
|
||||
Path1.AddIdleHandler(
|
||||
path.ProcessSignal(
|
||||
currPathData.Changed,
|
||||
procedure
|
||||
procedure(out IsDone: Boolean)
|
||||
begin
|
||||
if currPathData.Value <> nil then
|
||||
begin
|
||||
Path1.Data.Assign(currPathData.Value.Obj);
|
||||
end;
|
||||
path.Data.Assign(currPathData.Value.Obj);
|
||||
IsDone := done.IsSet;
|
||||
end
|
||||
);
|
||||
end;
|
||||
|
||||
function TForm1.SelectedStream: IDataStream<TAskBidItem>;
|
||||
begin
|
||||
var sym := SelectedSymbol;
|
||||
if sym = '' then
|
||||
exit(nil);
|
||||
Result := FServer.CreateStream(sym);
|
||||
end;
|
||||
|
||||
function TForm1.SelectedSymbol: String;
|
||||
begin
|
||||
Result := '';
|
||||
if RandomBox.IsChecked then
|
||||
Result := FSymbols.WaitFor[Random(Length(FSymbols.WaitFor))]
|
||||
else if SymbolsComboBox.ItemIndex >= 0 then
|
||||
Result := FSymbols.WaitFor[SymbolsComboBox.ItemIndex];
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user