unit Myc.Trade.DataServer; interface uses System.SysUtils, Myc.Lazy, Myc.Signals, Myc.Futures; type // Represents a generic data server capable of providing sequential data chunks. // The type parameter T specifies the type of data points served. IDataServer = interface ['{A6E246A2-E84E-49AB-A63E-333E561E488C}'] // Provides a TMutable that indicates if the server is currently // serving live data (true) or historical data (false). function GetIsLiveData: TMutable; // Retrieves a chunk of data into the provided dynamic array. // Returns the number of items successfully read into the array. function GetChunk(var Data: array of T): Integer; property IsLiveData: TMutable read GetIsLiveData; end; // Abstract base class for IDataServer implementations. TDataServer = class(TInterfacedObject, IDataServer) protected function GetIsLiveData: TMutable; virtual; abstract; function GetChunk(var Data: array of T): Integer; virtual; abstract; end; // Represents a factory for creating IDataServer instances. // The type parameter T specifies the type of data points the created server will provide. IDataServerNode = interface ['{DA3531F1-158E-4A63-8E5A-34089C537B1B}'] // Creates and returns a new instance of an IDataServer. function CreateDataServer: IDataServer; end; // Abstract base class for IDataServerNode implementations. TDataServerNode = class(TInterfacedObject, IDataServerNode) public // Factory method to create the actual data server instance. function CreateDataServer: IDataServer; virtual; abstract; end; implementation uses System.IOUtils; end.