private Order(Order orig) { _ID = orig._ID; _isbid = orig._isbid; _price = orig._price; _volume = orig._volume; _owner = orig._owner; _cancelled = orig._cancelled; _filled = orig._filled; _capital = orig._capital; }
public Order(bool isbid, double price, int volume, IOrderOwner owner) { _ID = _nextID; _isbid = isbid; _price = price; _volume = volume; _owner = owner; _cancelled = false; _filled = false; _capital = 0; _nextID++; }
// delegate signals from the Simulation to appropriate agents public void recvSimulationNotification(ISimulationParameters sim, ISimulationEvent se) { if (se.OrderbookEvent == null) { // start and end events go to all agents if (se is ISimulationStart) { foreach (IAgent ag in _agents) { ag.recvSimulationNotification(sim, se); } } else if (se is ISimulationEnd) { foreach (IAgent ag in _agents) { ag.recvSimulationNotification(sim, se); } } } else { // fill events go to the order owner only if (se.OrderbookEvent is IOrderbookEvent_FillOrder) { IOrderbookEvent_FillOrder fillEvent = (IOrderbookEvent_FillOrder)se.OrderbookEvent; IOrderOwner owner = fillEvent.getOrder().getOwner(); if (_agents.Contains((IAgent)owner)) { owner.recvOrderNotification(sim.Orderbook, fillEvent); } else { throw new Exception("Population is attempting to forward signal to an unrecognized IAgent"); } } // Add and Cancel events are ignored by the Population class } }