image thumbnail
from Order book simulation by Dimitri Shvorob
(a naive artificial stock market)

TradeConfirmation
classdef TradeConfirmation
    
    properties (SetAccess = private)
        Side
        Size
        Price
        Time
    end         
    
    methods
        
        function[obj] = TradeConfirmation(side,size,price,time) 
            obj.Side  = side;
            obj.Size  = size;
            obj.Price = price;
            obj.Time  = time;
        end
                     
        function[out] = char(obj)             
            out = sprintf('TradeConfirmation: %s %d at %6.2f, time %s',obj.Side,obj.Size,obj.Price,datestr(obj.Time,13));
        end
        
        function disp(obj)             
            disp(class(obj))
            disp(struct('Side',obj.Side, ...
                        'Size',obj.Size, ...
                        'Price',obj.Price, ...
                        'Time',datestr(obj.Time,13)))         
        end
            
    end   
    
end

Contact us at files@mathworks.com