Example #1
0
        /// <summary>
        /// Updates the publisher price
        /// </summary>
        /// <param name="myPub"></param>
        /// <param name="e"></param>
        private void UpdatePrice(KaiTrade.Interfaces.TradableProduct product, AxTWSLib._DTwsEvents_tickPriceEvent e)
        {
            try
            {

                KaiTrade.TradeObjects.PXUpdateBase pxupdate = new KaiTrade.TradeObjects.PXUpdateBase(m_ID);
                pxupdate.Mnemonic = product.Mnemonic;
                pxupdate.DepthOperation = KaiTrade.Interfaces.PXDepthOperation.none;

                switch (e.tickType)
                {
                    case 1:
                        pxupdate.BidPrice = (decimal)e.price;
                        break;
                    case 2:
                        pxupdate.OfferPrice = (decimal)e.price;
                        break;
                    case 4:
                        pxupdate.TradePrice = (decimal)e.price;
                        break;
                    case 6:
                        pxupdate.DayHigh = (decimal)e.price;
                        break;
                    case 7:
                        pxupdate.DayLow = (decimal)e.price;
                        break;
                }
                //myPub.APIUpdateTime = DateTime.Now;
                ApplyPriceUpdate(pxupdate);
            }
            catch (Exception myE)
            {
                _log.Error("UpdateMDSubjectPrice", myE);

            }
        }
Example #2
0
        /// <summary>
        /// Update the publisher size
        /// </summary>
        /// <param name="mySubject"></param>
        /// <param name="e"></param>
        private void UpdateSize(KaiTrade.Interfaces.TradableProduct product, AxTWSLib._DTwsEvents_tickSizeEvent e)
        {
            KaiTrade.TradeObjects.PXUpdateBase pxupdate = new KaiTrade.TradeObjects.PXUpdateBase(m_ID);
            pxupdate.Mnemonic = product.Mnemonic;

            switch (e.tickType)
            {
                case 0:
                    pxupdate.BidSize = e.size * product.PriceFeedQuantityMultiplier;
                    break;
                case 3:
                    pxupdate.OfferSize = e.size * product.PriceFeedQuantityMultiplier;

                    break;
                case 5:
                    pxupdate.TradeVolume = e.size * product.PriceFeedQuantityMultiplier;

                    break;
            }
            ApplyPriceUpdate(pxupdate);
        }
Example #3
0
        private void updateMktDepth(int myId, int myRow, string marketMaker, int operation, int mySide, double price, int size)
        {
            try
            {
                if (m_IBReqIDProductMap.ContainsKey(myId))
                {
                    KaiTrade.TradeObjects.PXUpdateBase pxupdate = new KaiTrade.TradeObjects.PXUpdateBase(m_ID);
                    pxupdate.Mnemonic = m_IBReqIDProductMap[myId].Mnemonic;
                    pxupdate.DepthPosition = myRow;
                    pxupdate.DepthOperation = GetDepthOperation(operation);

                    pxupdate.DepthMarket = marketMaker;
                    pxupdate.Ticks = DateTime.Now.Ticks;
                    switch (mySide)
                    {
                        case 0:
                            //ASK
                            pxupdate.OfferPrice = (decimal)price;
                            pxupdate.OfferSize = (decimal)size;

                            break;
                        case 1:
                            //BID
                            pxupdate.BidPrice = (decimal)price;
                            pxupdate.BidSize = (decimal)size;

                            break;
                        default:
                            break;
                    }
                    //myPub.APIUpdateTime = DateTime.Now;
                    ApplyPriceUpdate(pxupdate);

                }

            }
            catch (Exception myE)
            {
                _log.Error("updateMktDepth", myE);
            }
        }