Ejemplo n.º 1
0
        void SimBroker_GotOrderCancel(string sym, bool side, uint id)
        {
            // if we get an order cancel notify from the broker, pass along to our clients
            tl.newOrderCancel(id);
            // send the updated book to our clients for same side as order
            Tick book = OrderToTick(h.SimBroker.BestBidOrOffer(sym, side));

            tl.newTick(book);
        }
Ejemplo n.º 2
0
        void tl_newOrderCancelRequest(uint number)
        {
            string result = "error";
            long   id;
            string orderid = "";

            if (idmap.TryGetValue(number, out id))
            {
                orderid = id.ToString();
            }
            api.TD_CancelOrder(api._accountid, orderid, _user.Text, _pass.Text, AmeritradeBrokerAPI.SOURCEID, APIVER, ref result);
            if (result == string.Empty)
            {
                tl.newOrderCancel(number);
            }
        }
Ejemplo n.º 3
0
 protected virtual int OnStockExecMsgCancel(UInt32 hStock, GTSession.GTCancel32 cancel)
 {
     // notify clients of cancel
     tl.newOrderCancel(cancel.dwTicketNo);
     return(0);
 }
Ejemplo n.º 4
0
        void tt_Tick(object sender, EventArgs e)
        {
            // orders
            while (or < oc)
            {
                STIOrder order = new STIOrder();
                if (or == oq.Length)
                {
                    or = 0;
                }
                Order o = oq[or++];
                order.LmtPrice    = (double)o.price;
                order.StpPrice    = (double)o.stopp;
                order.Destination = o.Exchange;
                order.Side        = o.side ? "B" : "S";
                order.Symbol      = o.symbol;
                order.Quantity    = o.UnsignedSize;
                string acct = accts.Count > 0 ? accts[0] : "";
                order.Account     = o.Account != "" ? o.Account : acct;
                order.Destination = o.Exchange != "" ? o.ex : "NYSE";
                order.Tif         = o.TIF;
                order.PriceType   = o.isMarket ? STIPriceTypes.ptSTIMkt : (o.isLimit ? STIPriceTypes.ptSTILmt : STIPriceTypes.ptSTISvrStp);
                order.ClOrderID   = o.id.ToString();
                int    err = order.SubmitOrder();
                string tmp = "";
                if ((err == 0) && (!idacct.TryGetValue(o.id, out tmp)))
                {
                    idacct.Add(o.id, order.Account);
                }
                if (err < 0)
                {
                    debug("Error sending order: " + Util.PrettyError(tl.newProviderName, err) + o.ToString());
                }
                if (err == -1)
                {
                    debug("Make sure you have set the account in sending program.");
                }
            }

            // quotes
            if (qc > qr)
            {
                foreach (string sym in symquotes.Split(','))
                {
                    stiQuote.RegisterQuote(sym, "*");
                }
                qr = qc;
            }

            // cancels
            if (ic > ir)
            {
                if (ir == idq.Length)
                {
                    ir = 0;
                }
                uint   number = idq[ir++];
                string acct   = "";
                if (idacct.TryGetValue(number, out acct))
                {
                    stiOrder.CancelOrder(acct, 0, number.ToString(), DateTime.Now.Ticks.ToString() + acct);
                    tl.newOrderCancel(number);
                }
                else
                {
                    debug("No record of id: " + number.ToString());
                }
            }
        }
Ejemplo n.º 5
0
        void m_OrderClient_OnRemove(MbtOpenOrder pOrd)
        {
            uint num = Convert.ToUInt32(pOrd.OrderNumber);

            tl.newOrderCancel((long)num);
        }