private void btnTestDiluter_Click(object sender, EventArgs e) { try { DBDiluter dbDiluter = new DBDiluter(); dbDiluter.DiluteFromAllUnLs(); //DateTime startDate = new DateTime(2017, 8, 21); //DateTime endDate = new DateTime(2017, 8, 22); //var count = dbDiluter.DiluteOptionsFromAllUnLs(startDate, endDate); MessageBox.Show($"Records were diluted!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DoWorkAfterTradingEnding() { try { DBDiluter dbDiluter = new DBDiluter(); dbDiluter.DiluteFromAllUnLs(); } catch (Exception ex) { Logger.Error(ex.Message, ex); } //Save the parameter in one minute from now, and then 'Net Liquidition' will be stable! GeneralTimer.GeneralTimerInstance.AddTask(TimeSpan.FromMinutes(1), () => { SavedPatametersManager.SaveLastNetLiquiditionParameter(AccountManager.NetLiquidation); }, false); //Save UNL data using (var session = DBSessionFactory.Instance.OpenSession()) { foreach (var simpleBaseLogic in UNLManagerDic.Values) { var unlManager = (UNLManager)simpleBaseLogic; var managedSecurity = session.Query <ManagedSecurity>().FirstOrDefault(ms => ms.Symbol == unlManager.Symbol); if (managedSecurity == null) { continue; } managedSecurity.LastDayPnL = unlManager.UnlTradingData.PnLTotal; session.SaveOrUpdate(managedSecurity); } session.Flush(); } }