73 lines
1.8 KiB
ObjectPascal
73 lines
1.8 KiB
ObjectPascal
unit Myc.Trade.Ticker;
|
|
|
|
interface
|
|
|
|
uses
|
|
Myc.Lazy;
|
|
|
|
type
|
|
TMycLogger = reference to procedure(const Msg: String);
|
|
|
|
IMycTradeObject = interface
|
|
end;
|
|
|
|
TMycTradeObject = class(TInterfacedObject, IMycTradeObject)
|
|
private
|
|
FCaption: string;
|
|
FLog: TMycLogger;
|
|
function GetCaption: string;
|
|
public
|
|
constructor Create(const ACaption: string; ALog: TMycLogger);
|
|
property Caption: string read GetCaption;
|
|
property Log: TMycLogger read FLog;
|
|
end;
|
|
|
|
IMycTime = interface
|
|
{$REGION 'property access'}
|
|
function GetTimeStamp: TDateTime;
|
|
{$ENDREGION}
|
|
property TimeStamp: TDateTime read GetTimeStamp;
|
|
end;
|
|
|
|
IMycTick = interface
|
|
{$REGION 'property access'}
|
|
function GetAsk: Double;
|
|
function GetBid: Double;
|
|
function GetTime: IMycTime;
|
|
function GetVolume: Double;
|
|
{$ENDREGION}
|
|
property Ask: Double read GetAsk;
|
|
property Bid: Double read GetBid;
|
|
property Time: IMycTime read GetTime;
|
|
property Volume: Double read GetVolume;
|
|
end;
|
|
|
|
IMycTicker = interface(IMycTradeObject)
|
|
{$REGION 'property access'}
|
|
function GetLastTick: TLazy<IMycTick>;
|
|
function GetCurrentTime: IMycTime;
|
|
{$ENDREGION}
|
|
property LastTick: TLazy<IMycTick> read GetLastTick;
|
|
property CurrentTime: IMycTime read GetCurrentTime;
|
|
end;
|
|
|
|
IMycHistoryTicker = interface(IMycTicker)
|
|
|
|
end;
|
|
|
|
implementation
|
|
|
|
constructor TMycTradeObject.Create(const ACaption: string; ALog: TMycLogger);
|
|
begin
|
|
inherited Create;
|
|
FCaption := ACaption;
|
|
FLog := procedure(const Msg: String) begin ALog('[' + FCaption + '] ' + Msg); end;
|
|
end;
|
|
|
|
function TMycTradeObject.GetCaption: string;
|
|
begin
|
|
Result := FCaption;
|
|
end;
|
|
|
|
end.
|