public VolManagerVM(IMarketFeed marketFeed, IDbManager dbManager) { var currentThread = Thread.CurrentThread; currentThread.Name = "UI Thread"; LoadVolCmd = new RelayCommand(LoadData); FitCurveCmd = new RelayCommand(FitCurve); WindowsLoadedCmd = new RelayCommand(WindowLoaded); InsertNewParamsCmd = new RelayCommand(InsertParamToDb); BeforeCloseCmd = new RelayCommand(ExecuteBeforeClose); ImpliedVolPoints = new ObservableCollection <Point>(); ModelVolPoints = new ObservableCollection <Point>(); AvailableMaturity = new ObservableCollection <DateTime>(); _strikeList = new List <double>(); _instrumentPriceSafeDico = new ConcurrentDictionary <string, double>(); _fwdBaseOffsetDico = new Dictionary <string, double>(); _dispatcher = Dispatcher.CurrentDispatcher; _marketFeed = marketFeed; _dbManager = dbManager; SelectedMinStrike = 2000; SelectedMaxStrike = 5000; AppTitle = $"Volatility Manager {_version} {_environment}"; }
public DealManagerVM(IMarketFeed marketFeed, IDbManager dbManager) { _marketFeed = marketFeed; _dbManager = dbManager; OpenDealFormCmd = new RelayCommand(OpenDealForm); InsertDealCmd = new RelayCommand(InsertDealIntoDb); UpdateDealCmd = new RelayCommand(UpdateDeal); RemoveDealCmd = new RelayCommand(RemoveDeal); BeforeCloseCommand = new RelayCommand(ExecuteBeforeClose); WindowsLoadedCmd = new RelayCommand(WindowLoaded); OpenSettleDealCmd = new RelayCommand(OpenSettleDealForm); ObsDeals = new ObservableCollection <Deal>(); ObsPositions = new ObservableCollection <ObsInstruPosition>(); ObsBookPosition = new ObservableCollection <ObsBookPosition>(); InstrumentNames = new ObservableCollection <string>(); Maturitys = new ObservableCollection <DateTime>(); _currentPosDico = new Dictionary <string, ObsInstruPosition>(); _expiredPosDico = new Dictionary <string, ObsInstruPosition>(); _bookPositionDico = new Dictionary <string, ObsBookPosition>(); _volParamDico = new Dictionary <string, VolParam>(); _fwdBaseOffsetDico = new Dictionary <string, double>(); _instruInfoDico = new Dictionary <string, Instrument>(); _instrumentPriceSafeDico = new ConcurrentDictionary <string, double>(); RowDoubleClickCmd = new DelegateCommand <object>(DisplayUpdateRmFormWin); InstruViewClickCmd = new DelegateCommand <object>(DisplayDealView); AppTitle = $"Deal Manager {_version} {_environment}"; }
// connection state Callback from market feed service private void ConnectionStatusHandler(IMarketFeed sender, string connectionState) { if (connectionState == "Connection_Succeed") { marketConnectionUp = true; } else if (connectionState == "Connection_Down") { marketConnectionUp = false; } }
static void Main(string[] args) { IKernel kernel = new StandardKernel(); kernel.Load(Assembly.GetExecutingAssembly()); IMarketFeed marketFeed = kernel.Get <IMarketFeed>(); IDbManager dbManager = kernel.Get <IDbManager>(); log.Info("Pipe started"); if (args == null || args.Length != 1) { log.Error("Wrong arguments specified"); } else { IProcess process; if (args[0] == _closePriceSnap) { log.Info("Close price snapshot in progress..."); process = new CloseSnapshot(marketFeed, dbManager); } else if (args[0] == _newInstruSnap) { log.Info("New instruments snapshot in progress..."); process = new NewInstruSnapshot(marketFeed, dbManager); } else if (args[0] == _instruReportSnap) { log.Info("Instrument Reporting in progress..."); process = new InstrumentReport(dbManager); } else if (args[0] == _dealReportSnap) { log.Info("Deal Reporting in progress..."); process = new DealReport(dbManager); } else { log.Error($"Argument: {args[0]} doesn't exist"); _snapshotInProgress = false; return; } process.Start(); while (process.IsRunning) { Thread.Sleep(1000); } } log.Info("Pipe closed"); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); DevExpress.Xpf.Core.ApplicationThemeHelper.UpdateApplicationThemeName(); IKernel kernel = new StandardKernel(); kernel.Load(Assembly.GetExecutingAssembly()); IMarketFeed marketFeed = kernel.Get <IMarketFeed>(); IDbManager dbManager = kernel.Get <IDbManager>(); DealManagerWin dealManagerWindow = new DealManagerWin(); DealManagerVM dealManagerVm = new DealManagerVM(marketFeed, dbManager); dealManagerWindow.DataContext = dealManagerVm; dealManagerWindow.Show(); }
private void ConnectionStatusHandler(IMarketFeed sender, string connectionState) { if (connectionState == "Connection_Succeed") { marketConnectionUp = true; if (databaseDataReady && marketConnectionUp) { SuscribeToInstrumentPrices(); } } else if (connectionState == "Connection_Down") { marketConnectionUp = false; } }
private void ConnectionStatusHandler(IMarketFeed sender, string connectionState) { if (connectionState == "Connection_Down") { IsRunning = false; } else if (connectionState == "Connection_Succeed") { Product[] products = _dbManager.GetAllProducts(); foreach (var product in products) { _marketFeed.SuscribeToProductInfo(product.ProductType, product.Id, product.Market); } } }
private void ConnectionStatusHandler(IMarketFeed sender, string connectionState) { if (connectionState == "Connection_Down") { IsRunning = false; } else if (connectionState == "Connection_Succeed") { _delay = DateTime.Now.AddSeconds(_delayTime); _instruCollection = _dbManager.GetAllInstruments(Option.PreviousWeekDay(DateTime.Today)); foreach (var instru in _instruCollection) { _marketFeed.SuscribeToInstrumentPrice(instru.TtCode, instru.Product.ProductType, instru.ProductId, instru.Product.Market, "Close"); } } }
private void DataUpdateHandler(IMarketFeed sender, string instrumentName, DateTime maturity, int strike, string optionType, string optionDescription, string productType, string productName) { _delay = DateTime.Now.AddSeconds(_delayTime); if (productType == "FUTURE") { DateTime nextMaturity = DateTime.Today.AddMonths(_nbOfExpi + 4); if (maturity > nextMaturity) { return; } string reutersCode = Option.BuildForwardId("STXE", maturity); var newInstru = new Instrument() { MaturityDate = maturity, TtCode = instrumentName, Id = reutersCode, ProductId = productName, FullName = optionDescription, }; _instruInfoSafeDico[reutersCode] = newInstru; } else if (productType == "OPTION") { DateTime nextMaturity = DateTime.Today.AddMonths(_nbOfExpi); if (maturity > nextMaturity) { return; } string reutersCode = Option.BuildOptionId(optionType, maturity, "STXE" + (strike * 10), ".EX"); string forwardId = Option.BuildForwardId("STXE", maturity); string futureId = Option.GetNextFutureTtCode("FESX", maturity); var newInstru = new Instrument() { MaturityDate = maturity, TtCode = instrumentName, Id = reutersCode, OptionType = optionType, Strike = strike, ProductId = productName, FullName = optionDescription, RefForwardId = forwardId, RefFutureId = futureId }; _instruInfoSafeDico[reutersCode] = newInstru; } else { log.Error($"Instruments: {instrumentName} not recognize"); } }
private void PriceUpdateHandler(IMarketFeed sender, string instrumentName, double midPrice) { _instrumentPriceSafeDico[instrumentName] = midPrice; _delay = DateTime.Now.AddSeconds(_delayTime); }
public CloseSnapshot(IMarketFeed marketFeed, IDbManager dbManager) { _marketFeed = marketFeed; _dbManager = dbManager; _instrumentPriceSafeDico = new ConcurrentDictionary <string, double>(); }
// price update Callback from market feed service private void PriceUpdateHandler(IMarketFeed sender, string instrumentName, double midPrice) { _instrumentPriceSafeDico[instrumentName] = midPrice; }
public NewInstruSnapshot(IMarketFeed marketFeed, IDbManager dbManager) { _marketFeed = marketFeed; _dbManager = dbManager; _instruInfoSafeDico = new ConcurrentDictionary <string, Instrument>(); }