예제 #1
0
        void dofillupdate(ref structSTITradeUpdate t)
        {
            Trade f = new TradeImpl();

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

            if (long.TryParse(t.bstrClOrderId, out id))
            {
                f.id = id;
            }
            else
            {
                f.id = t.nOrderRecordId;
            }
            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);
            f.ex    = t.bstrDestination;
            pt.Adjust(f);
            tl.newFill(f);
            if (VerboseDebugging)
            {
                debug("new trade sent: " + f.ToString() + " " + f.id);
            }
        }
예제 #2
0
 void stiEvents_OnSTITradeUpdate(ref structSTITradeUpdate t)
 {
     if (UseXmlMode)
     {
         return;
     }
     dofillupdate(ref t);
 }
예제 #3
0
 void stiEvents_OnSTITradeUpdateXML(ref string bstrTrade)
 {
     try
     {
         XmlSerializer        xs = new XmlSerializer(typeof(SterlingLib.structSTITradeUpdate));
         structSTITradeUpdate q  = (structSTITradeUpdate)xs.Deserialize(new System.IO.StringReader(bstrTrade));
         dofillupdate(ref q);
     }
     catch (Exception ex)
     {
         debug("Error deserializing fill: " + bstrTrade);
         debug(ex.Message + ex.StackTrace);
     }
 }
예제 #4
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);
        }
예제 #5
0
 void stiEvents_OnSTITradeUpdate(ref structSTITradeUpdate t)
 {
     if (UseXmlMode) return;
     dofillupdate(ref t);
 }
예제 #6
0
 void dofillupdate(ref structSTITradeUpdate t)
 {
     Trade f = new TradeImpl();
     f.symbol = t.bstrSymbol;
     f.Account = t.bstrAccount;
     long id = 0;
     if (long.TryParse(t.bstrClOrderId, out id))
         f.id = id;
     else
         f.id = t.nOrderRecordId;
     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);
     f.ex = t.bstrDestination;
     pt.Adjust(f);
     tl.newFill(f);
     if (VerboseDebugging)
         debug("new trade sent: " + f.ToString() + " " + f.id);
 }
예제 #7
0
 void dofillupdate(ref structSTITradeUpdate t)
 {
     Trade f = new TradeImpl();
     string ssym = t.bstrSymbol;
     if (UseSubscribedSymbolForNotify)
     {
         int idx = getlongsymbolidx(ssym);
         // check for error
         if ((idx < 0) || (idx >= syms.Length))
         {
             debug(ssym + " fill ack error identifying symbol idx: " + idx + " symbols: " + string.Join(",", syms));
             f.symbol = ssym;
         }
         else
             f.symbol = syms[idx];
     }
     else
         f.symbol = ssym;
     
     f.Account = t.bstrAccount;
     long id = 0;
     if (long.TryParse(t.bstrClOrderId, out id))
         f.id = id;
     else
         f.id = t.nOrderRecordId;
     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);
     f.ex = t.bstrDestination;
     pt.Adjust(f);
     if (RegSHOShorts)
         sho.GotFill(f);
     tl.newFill(f);
     if (VerboseDebugging)
         debug("new trade sent: " + f.ToString() +" pos: "+pt[f.symbol,f.Account]);
 }
예제 #8
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);
 }