コード例 #1
0
        public double getBidPriceOffset(IOrderbook_Agent ob)
        {
            processOrderbook(ob);
            double y = SingletonRandomGenerator.Instance.NextUniform(0.0, 1.0);

            return(-_SteadySpread / 2.0 - XSCALE * CDFinv(y));
        }
コード例 #2
0
        // receive a signal from the Matcher (via the Simulation, via the Population) that an order has been filled
        public void recvOrderNotification(IOrderbook_Agent ob, IOrderbookEvent evt)
        {
            // Fill order events
            if (evt is IOrderbookEvent_FillOrder)
            {
                IOrderbookEvent_FillOrder fillEvent = (IOrderbookEvent_FillOrder)evt;
                IOrder filledOrder = fillEvent.getOrder();

                SingletonLogger.Instance().InfoLog(typeof(AbstractAgent), "AbstractAgent " + GetName() + " Fill " + filledOrder + " @ " + Scheduler.GetTime());

                if (filledOrder.isBid())
                {
                    AccumulateHoldings(+1 * fillEvent.getVolume());
                }
                else
                {
                    AccumulateHoldings(-1 * fillEvent.getVolume());
                }

                if (fillEvent.orderFilled())
                {
                    RemoveFromOpenOrderList(filledOrder);
                    FilledOrderNotification(filledOrder, fillEvent.getExecutionPrice(), fillEvent.getVolume());
                }
                else
                {
                    PartialFilledOrderNotification(filledOrder, fillEvent.getExecutionPrice(), fillEvent.getVolume());
                }
            }
            // Add and Cancel events are not forwarded to agents by the Population class
        }
コード例 #3
0
 public double getBidPrice(IOrderbook_Agent ob)
 {
     processOrderbook(ob);
     if (isMarket(ob))
     {
         return(getMarketPrice(ob));
     }
     else
     {
         return(Price + getBidPriceOffset(ob));
     }
 }
コード例 #4
0
 public double getMarketPriceOffset(IOrderbook_Agent ob)
 {
     processOrderbook(ob);
     return(SingletonRandomGenerator.Instance.NextUniform(-_SteadySpread / 2.0 - _MarketPadding,
                                                          +_SteadySpread / 2.0 + _MarketPadding));
 }
コード例 #5
0
 public bool isMarket(IOrderbook_Agent ob)
 {
     processOrderbook(ob);
     return(SingletonRandomGenerator.Instance.NextDouble() <= MarketProb);
 }
コード例 #6
0
 private void processOrderbook(IOrderbook_Agent ob)
 {
     Price = ob.getPrice();
 }
コード例 #7
0
 public double getMarketPrice(IOrderbook_Agent ob)
 {
     processOrderbook(ob);
     return(Price + getMarketPriceOffset(ob));
 }