Example #1
0
        public Order(MDEntryGroup entryGroup, double quantity)
        {
            int propIndex = -1;
            SecurityEntry ownerEntry = entryGroup.OwnerEntry;
            propIndex = ownerEntry.GetGroupIndex(entryGroup);

            weakCopy = entryGroup.OwnerEntry.WeakClone();
            currentMDGroup = weakCopy.GetGroup((uint)propIndex);

            OrderMessage = FixApplication.Current.NewOrder(entryGroup, quantity);
        }
Example #2
0
        public Order(IProposal proposal, double quantity)
        {
            int propIndex = -1;
            SecurityEntry ownerEntry = ((MDEntryGroup) proposal).OwnerEntry;
            propIndex = ownerEntry.GetGroupIndex((MDEntryGroup)proposal);

            weakCopy = ((Proposal) proposal).OwnerEntry.WeakClone();
            currentMDGroup = weakCopy.GetGroup((uint) propIndex);

            OrderMessage = FixApplication.Current.NewOrder(proposal, quantity);
        }
Example #3
0
        public void UpdateGrid(SpreadMatrixData smd, SecurityEntry entry)
        {
            if (!smd.Values.Contains(entry))
                return;

            MDDatePair datePair = entry.GetDatePair();

            int dMonth1 = GetDeltaMonth(smd.MinYearMonth, datePair.GetMinDate());
            int dMonth2 = GetDeltaMonth(smd.MinYearMonth, datePair.GetMaxDate());
            int r = dMonth1 - 1;
            int c = dMonth2 - 1;

            SpreadMatrixDataCell cell = (SpreadMatrixDataCell)cellPosDictionary.GetValue(r, c);

            if(cell==null)
            {
                cell = new SpreadMatrixDataCell { Width = CellWidth, Height = CellHeight };

                cell.MouseDown += cell_MouseDown;

                Grid.SetRow(cell, r == c ? r + 1 : r);
                Grid.SetColumn(cell, c);

                cellPosDictionary.SetValue(r, c, cell);
                grid.Children.Add(cell);
            }

            cell.FillData(entry);
        }
Example #4
0
        public void FillGrid(SpreadMatrixData smd, SecurityEntry entry)
        {
            int dMonth = GetDeltaMonth(smd.MinYearMonth, smd.MaxYearMonth);

            if (grid.ColumnDefinitions.Count != dMonth)
                CreateGrid(smd);
            else
                UpdateGrid(smd, entry);
        }
Example #5
0
        void AddEntryData(SecurityEntry entry)
        {
            if (entry.SubContractCount > 2)
                return;

            securityEntries.Add(entry.SecurityID, entry);

            /*
            SecurityEntry securityEntry = spreadMatrixEntries.GetValue(datePair.Date1, datePair.Date2);
            if (securityEntry != null)
                securityEntry.Dispose();
            */

            if (entry.HasFutureContract())
            {
                MDDatePair datePair = entry.GetDatePair();

                spreadMatrixEntries.SetValue(datePair.Date1, datePair.Date2, entry);

                SetMinYearMonth(datePair);
                SetMaxYearMonth(datePair);
            }
        }
Example #6
0
 public void Add(SecurityEntry entry)
 {
     lock (LockObject)
     {
         AddEntryData(entry);
         RaizeChanged(entry);
     }
 }
Example #7
0
 void InsertSubContract(uint index, SecurityDefinition.NoRelatedSym group)
 {
     subcontracts[index] = new SecurityEntry(group, this);
 }
Example #8
0
        public SecurityEntry WeakClone()
        {
            SecurityEntry weakClone = new SecurityEntry();

            Utils.CopyPropertiesAndFields(this, weakClone);

            weakClone.MDEntryGroups = new MDEntryGroup[weakClone.MDGroupCount];
            for (uint i = 0; i < weakClone.MDGroupCount; i++)
                weakClone.MDEntryGroups[i] = GetGroup(i).Clone(weakClone);

            weakClone.subcontracts = new SecurityEntry[weakClone.SubContractCount];
            for (uint i = 0; i < weakClone.SubContractCount; i++)
            {
                weakClone.subcontracts[i] = GetSubContract(i).WeakClone();
                weakClone.subcontracts[i].OwnerEntry = weakClone;
            }

            return weakClone;
        }
Example #9
0
        internal SecurityEntry(SecurityDefinition.NoRelatedSym noRelatedSym, SecurityEntry owner)
        {
            IsMDUpdated = false;
            OwnerEntry = owner;

            SecurityID = noRelatedSym.getUnderlyingSecurityID().getValue();
            Symbol = noRelatedSym.getUnderlyingSymbol().getValue();
            SecurityExchange = noRelatedSym.getUnderlyingSecurityExchange().getValue();
            SecurityType = noRelatedSym.getUnderlyingSecurityType().getValue();

            if (noRelatedSym.isSetUnderlyingMaturityMonthYear())
                MaturityMonthYear = noRelatedSym.getUnderlyingMaturityMonthYear().getValue();

            Side = noRelatedSym.getSide().getValue();
            SubContractCount = 0;
            subcontracts = new SecurityEntry[SubContractCount];
        }
Example #10
0
 protected override void DoDispose()
 {
     OwnerEntry = null;
 }
Example #11
0
        internal MDEntryGroup Clone(SecurityEntry newOwner)
        {
            MDEntryGroup newGroup = new MDEntryGroup(newOwner);

            Utils.CopyPropertiesAndFields(this, newGroup);

            return newGroup;
        }
Example #12
0
        public MDEntryGroup(MarketDataSnapshotFullRefresh.NoMDEntries group, SecurityEntry owner)
        {
            OwnerEntry = owner;

            MDEntryType = group.getMDEntryType().getValue();
            MDEntryPx = group.getMDEntryPx().getValue();
            MDEntrySize = group.getMDEntrySize().getValue();
        }
Example #13
0
 public MDEntryGroup(SecurityEntry owner)
 {
     OwnerEntry = owner;
 }
Example #14
0
        public void FillData(SecurityEntry entry)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>
                                                  {
                                                      {"bPx", String.Empty},
                                                      {"bCount", String.Empty},
                                                      {"aPx", String.Empty},
                                                      {"aCount", String.Empty}
                                                  };

            for (uint i = 0; i < entry.MDGroupCount; i++)
                FillData(entry.GetGroup(i), ref dict);

            MDDatePair datePair = entry.GetDatePair();
            CellType = SpreadMatrixCellType.Future;

            if (datePair.Date1 != datePair.Date2)
                CellType = SpreadMatrixCellType.Spread;

            AskPx = dict["aPx"];
            AskCount = dict["aCount"];
            BidPx = dict["bPx"];
            BidCount = dict["bCount"];

            InvalidateVisual();
        }
Example #15
0
        private void ProccessOrder(SecurityEntry entry)
        {
            for (int i = 0; i < entry.MDGroupCount; i++)
            {
                MDEntryGroup group = entry.GetGroup((uint) i);

                Message ord = NewOrder((IProposal)group, group.MDEntrySize);
                Session.sendToTarget(ord, GetOrderSession());
            }
        }
Example #16
0
        public override void onMessage(QuickFix42.SecurityDefinition securityDefinition, SessionID sessionID)
        {
            AddText("securityDefinition " + securityDefinition + Environment.NewLine);

            try
            {
                SecurityExchange securityExchange = new SecurityExchange();
                securityDefinition.getField(securityExchange);

                Symbol symbol = new Symbol();
                securityDefinition.getField(symbol);

                SecurityType securityType = new SecurityType();
                securityDefinition.getField(securityType);

                SpreadMatrixData smd = SpreadMatrixCollection.Get(securityExchange.getValue(), symbol.getValue());

                if (smd != null)
                {
                    SecurityEntry entry = new SecurityEntry(securityDefinition);
                    smd.Add(entry);
                    MarketDataRequest(securityDefinition);
                }
            }
            catch (Exception exception)
            {
                AddText(exception.Message + Environment.NewLine);
                throw;
            }
        }