Example #1
0
        //public CountAll()


        public static List <InstrumentPosition> Trades2(String S)
        {
            var instruments      = S.Split(';', '|');
            var n                = instruments.Count();
            var p                = 0;
            var Name             = "";
            var Size             = "";
            var Price            = "";
            var tradeInstruments = new List <InstrumentPosition>();

            foreach (var i in instruments)
            {
                n--;
                if (p == 0)
                {
                    Name = i;
                    p++;
                }
                else if (p == 1)
                {
                    Price = i;
                    p++;
                }
                else
                {
                    Size = i;
                    var tradeInstrument = new InstrumentPosition(Name, Price, Size);
                    tradeInstruments.Add(tradeInstrument);
                    p = 0;
                }
            }
            return(tradeInstruments);
        }
Example #2
0
 public BookPosition(InstrumentPosition pos)
 {
     Book              = pos.Book;
     RealisedPnl       = pos.RealisedPnl;
     YtdRealisedPnl    = pos.YtdRealisedPnl;
     UnrealisedPnl     = pos.UnrealisedPnl;
     FairUnrealisedPnl = pos.FairUnrealisedPnl;
 }
Example #3
0
        public void LoadCurrentDeals(Dictionary <string, InstrumentPosition> posDico)
        {
            Deal[] currentDeals = _dbManager.GetAllDeals();

            foreach (var deal in currentDeals)
            {
                InstrumentPosition pos;
                if (!posDico.TryGetValue(deal.InstrumentId, out pos))
                {
                    InstrumentPosition newPos = new InstrumentPosition(deal);
                    posDico.Add(deal.InstrumentId, newPos);
                    continue;
                }
                Pnl.ComputeInstrumentPosition(pos, deal);
            }
        }