Пример #1
0
 public void RemoveDeal(int dealId)
 {
     using (var db = new DevDbContext())
     {
         var deal = db.Deal.First(i => i.DealId == dealId);
         deal.Status = "Deleted";
         db.SaveChanges();
     }
     log.Info($"Remove deal ID: {dealId}");
 }
Пример #2
0
        public void AddVolParameter(VolParam newVolparam)
        {
            using (var db = new DevDbContext())
            {
                db.VolParam.Add(newVolparam);
                db.SaveChanges();
            }

            log.Info($"Add New Vol product: {newVolparam.Product} price: {newVolparam.MaturityDate}");
        }
Пример #3
0
        public void AddDeal(Deal newDeal)
        {
            using (var db = new DevDbContext())
            {
                db.Deal.Add(newDeal);
                db.SaveChanges();
            }

            log.Info($"New deal instru: {newDeal.InstrumentId} price: {newDeal.ExecPrice} " +
                     $"quantity: {newDeal.Quantity} by: {newDeal.UserProfil}");
        }
Пример #4
0
        public void AddInstruments(List <Instrument> newInstruments)
        {
            using (var db = new DevDbContext())
            {
                foreach (var price in newInstruments)
                {
                    db.Instrument.Add(price);
                }

                db.SaveChanges();
            }

            log.Info($"{newInstruments.Count} new instruments inserted");
        }
Пример #5
0
        public void AddClosePrice(List <HistoricalPrice> priceCollection)
        {
            using (var db = new DevDbContext())
            {
                foreach (var price in priceCollection)
                {
                    db.HistoricalPrice.Add(price);
                }

                db.SaveChanges();
            }

            log.Info($"{priceCollection.Count} Closing prices inserted");
        }
Пример #6
0
        public void UpdateVolParams(VolParam updatedParam)
        {
            using (var db = new DevDbContext())
            {
                VolParam param = db.VolParam.First(i => i.MaturityDate == updatedParam.MaturityDate && i.ProductId == updatedParam.ProductId);
                param.A     = updatedParam.A;
                param.B     = updatedParam.B;
                param.Sigma = updatedParam.Sigma;
                param.Rho   = updatedParam.Rho;
                param.M     = updatedParam.M;
                db.SaveChanges();
            }

            log.Info($"Volatility parameters updated for maturity: {updatedParam.MaturityDate} product: {updatedParam.ProductId}");
            log.Info($"New parameters:  A={updatedParam.A} B={updatedParam.B} Sigma={updatedParam.Sigma} Rho={updatedParam.Rho} M={updatedParam.M}");
        }
Пример #7
0
        public void UpdateDeal(Deal updatedDeal)
        {
            using (var db = new DevDbContext())
            {
                Deal deal = db.Deal.First(i => i.DealId == updatedDeal.DealId);
                deal.TraderId        = updatedDeal.TraderId;
                deal.Quantity        = updatedDeal.Quantity;
                deal.ExecPrice       = updatedDeal.ExecPrice;
                deal.BookId          = updatedDeal.BookId;
                deal.InstrumentId    = updatedDeal.InstrumentId;
                deal.ClearingFee     = updatedDeal.ClearingFee;
                deal.TransactionFee  = updatedDeal.TransactionFee;
                deal.Broker          = updatedDeal.Broker;
                deal.Counterparty    = updatedDeal.Counterparty;
                deal.Comment         = updatedDeal.Comment;
                deal.Status          = updatedDeal.Status;
                deal.ForwardLevel    = updatedDeal.ForwardLevel;
                deal.VolatilityLevel = updatedDeal.VolatilityLevel;
                db.SaveChanges();
            }

            log.Info($"Update deal instru: {updatedDeal.InstrumentId} price: {updatedDeal.ExecPrice} " +
                     $"quantity: {updatedDeal.Quantity} by: {updatedDeal.TraderId}");
        }