Types

StockMarketABM.Types keeps numerical representations fast and predictable. Constants define the scalar types used across the project, while enumerations capture categorical domains such as order side or time-in-force instructions.

StockMarketABM.Types.CashType
const Cash = Int64

Cash balance measured in the same minimal currency unit as Price. The signed representation allows tracking both assets and liabilities.

source
StockMarketABM.Types.EventTypeType
@enum EventType::UInt8 begin
    OrderNew = 1
    OrderCancel = 2
    OrderExpire = 3
    Trade = 4
end

Classification for matching-engine events. Distinguishing event types keeps the event log compact and simplifies reporting.

source
StockMarketABM.Types.OrderTypeType
@enum OrderType::UInt8 begin
    Market = 1
    Limit = 2
end

Type of order submitted to the market. A market order executes immediately at the best available price, while a limit order specifies a price threshold.

source
StockMarketABM.Types.PriceType
const Price = Int32

Price expressed in the smallest currency unit (for example cents). Using a fixed-width integer keeps arithmetic fast and deterministic.

source
StockMarketABM.Types.QtyType
const Qty = UInt32

Number of instruments in an order or trade. Quantities are non-negative and stored as whole units.

source
StockMarketABM.Types.SideType
@enum Side::UInt8 begin
    Buy = 1
    Sell = 2
end

Side of the order or position. The UInt8 backing type keeps the representation compact for storage within larger structs.

source
StockMarketABM.Types.TIFType
@enum TIF::UInt8 begin
    GTC = 1
    IOC = 2
    FOK = 3
    GTT = 4
end

Time-in-force instructions that control order lifetimes:

  • GTC — Good Till Cancelled
  • IOC — Immediate Or Cancel
  • FOK — Fill Or Kill
  • GTT — Good Till Time (requires explicit expiry)
source
StockMarketABM.Types.TickSizeType
const TickSize = Int32

Minimal price increment supported by the market. All limit prices must be expressible as multiples of this value.

source
StockMarketABM.Types.TimeType
const Time = Int64

Discrete timestamp used by the simulator to order events. The value represents integer ticks rather than wall-clock time so the unit is project specific.

source
StockMarketABM.Types.side_signMethod
side_sign(side::Side) -> Int

Return +1 for a buy side and -1 for a sell side. Useful for converting quantities into signed deltas when updating cash or positions.

source