Unit GenericL1DataNode; { This provides an interface for the data with no thoughts on implementation. A client will just ask for an object of this type. A data provider will register as a provider of this type. Each is sperated from the other. If no data provider is registered, this class will provide a simple shell which doesn't fail, but never reports any data. Most of the realtime market data comes from the data provider through one of three interfaces. TGenericTosDataNode stores information related to prints. Each print will update this data node. Very little else will cause that data node to wake its listeners. This helps us keep track of print events. TGenericL1DataNode stores most of the data which changes more freely. This includes bid, ask, daily high/low, open, close, etc. We don't keep track of which specific fields changed each time. TGenericFundamentalDataNode stores most of the data which comes though the same channels but doesn't change as often. This is split up primarily for performance reasons. This includes things like the comapny name and the 52 week high/low. } Interface Uses DataNodes, Classes; Type TL1Data = Record BidPrice : Double; BidSize : Integer; // Shares BidExchange : String; AskPrice : Double; AskSize : Integer; // Shares AskExchange : String; Open : Double; High : Double; Low : Double; PrevClose : Double; PutVolume, CallVolume : Integer; NyseImbalance : Integer; End; PL1Data = ^TL1Data; TGenericL1DataNode = Class; TTGenericL1DataNode = Class Of TGenericL1DataNode; TGenericL1DataNode = Class(TDataNodeWithStringKey) Protected Class Function CreateNew(Data : String) : TDataNodeWithStringKey; Override; Public Class Procedure Find(Symbol : String; OnChange : TThreadMethod; Out Node : TGenericL1DataNode; Out Link : TDataNodeLink); Virtual; Function IsValid : Boolean; Virtual; Function GetCurrent : PL1Data; Virtual; Class Procedure SetImplementation(I : TTGenericL1DataNode); End; Implementation Var RealImplementation : TTGenericL1DataNode; Class Procedure TGenericL1DataNode.SetImplementation(I : TTGenericL1DataNode); Begin RealImplementation := I End; Class Function TGenericL1DataNode.CreateNew(Data : String) : TDataNodeWithStringKey; Begin Result := Create End; Class Procedure TGenericL1DataNode.Find(Symbol : String; OnChange : TThreadMethod; Out Node : TGenericL1DataNode; Out Link : TDataNodeLink); Var TempNode : TDataNodeWithStringKey; Begin If Assigned(RealImplementation) Then RealImplementation.Find(Symbol, OnChange, Node, Link) Else Begin FindCommon(TGenericL1DataNode, '' {Symbol}, Nil {OnChange}, TempNode, Link); Node := TempNode As TGenericL1DataNode End End; Function TGenericL1DataNode.IsValid : Boolean; Begin Result := False End; Function TGenericL1DataNode.GetCurrent : PL1Data; Begin Result := Nil End; End.