예제 #1
0
        protected virtual int OnStockExecMsgTrade(UInt32 hStock, GTSession.GTTrade32 trade)
        {
            // map a trade object
            Trade t = new TradeImpl(trade.szStock, (decimal)trade.dblExecPrice, trade.nExecShares);

            // map remaining fields
            t.Account = trade.szAccountID;
            t.id      = (uint)trade.dwTicketNo;
            t.side    = trade.chExecSide == 'B';
            t.xdate   = trade.nExecDate;
            t.xtime   = trade.nExecTime;
            // notify clients
            tl.newFill(t);

            return(0);
        }
예제 #2
0
        public void FillTests()
        {
            // no executions yet
            Assert.That(fills == 0, fills.ToString());

            // have to subscribe to a stock to get notified on fills for said stock
            c.Subscribe(new BasketImpl(new SecurityImpl(SYM)));

            // prepare and send an execution from client to server
            TradeImpl t = new TradeImpl(SYM, 100, 300, DateTime.Now);

            s.newFill(t);

            // make sure client received and counted it
            Assert.That(fills == 1, fills.ToString());

            // make sure fill was copied
            Assert.AreEqual(fills, copyfills);
        }
예제 #3
0
        void stiEvents_OnSTITradeUpdate(ref structSTITradeUpdate t)
        {
            Trade f = new TradeImpl();

            f.symbol  = t.bstrSymbol;
            f.Account = t.bstrAccount;
            uint id = 0;

            if (!uint.TryParse(t.bstrClOrderId, out id))
            {
                f.id = id;
            }
            f.xprice = (decimal)t.fExecPrice;
            f.xsize  = t.nQuantity;
            long now  = Convert.ToInt64(t.bstrUpdateTime);
            int  xsec = (int)(now % 100);
            long rem  = (now - xsec) / 100;

            f.side  = t.bstrSide == "B";
            f.xtime = ((int)(rem % 10000)) * 100 + xsec;
            f.xdate = (int)((now - f.xtime) / 1000000);
            tl.newFill(f);
        }
예제 #4
0
 void SimBroker_GotFill(Trade t)
 {
     tl.newFill(t, true);
 }