private void StartRealTime(Quote_ViewModel quote_vm) { // send real time request for symbol: int reqId = TwsData.DataFeeder.RequestRealTime(quote_vm.ContractDetails.Contract); quote_vm.ReqId = reqId; QuotesRealTimeStarted?.Invoke(this, new Quote_EventArgs(quote_vm)); }
private void Border_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { Quote_ViewModel vm = DataContext as Quote_ViewModel; if (vm == null) { return; } vm.IsMouseOver = false; }
private async Task <Quote_ViewModel> PushQuoteToList(ContractDetails_ViewModel cd_vm, List <Bar> closePricesList) { Quote_ViewModel retQuote_vm; retQuote_vm = new Quote_ViewModel(0, cd_vm); retQuote_vm.SetClosedValues(closePricesList); QuoteAdded?.Invoke(this, new Quote_EventArgs(retQuote_vm)); await Task.CompletedTask; return(retQuote_vm); }
private async void PipelineStartup_AddQuote(object sender, Quote_EventArgs e) { await dispatcher.InvokeAsync(() => { Quote_ViewModel qVM = QuotesList.FirstOrDefault(s => s.Symbol == e.Quote_VM.Symbol); if (qVM != null) { // We have to remove the already existing quote with the same symbol: QuotesList.Remove(qVM); if (SymbolsList.ContainsKey(qVM.ReqId)) { SymbolsList.Remove(qVM.ReqId); } } QuotesList.Add(e.Quote_VM); }); }
private void Quote_ViewModel_ContractRemoved_Event(object sender, EventArgs e) { Quote_ViewModel qvm = sender as Quote_ViewModel; if (qvm == null) { return; } Quote_ViewModel symVM = QuotesList.FirstOrDefault(s => s == qvm); if (symVM != null) { // First cancel the old: TwsData.DataFeeder.CancelRealTime(symVM.ReqId); lock (symbolsList_Lock) { SymbolsList.Remove(symVM.ReqId); QuotesList.Remove(symVM); } } }
private void TradingHours_StatisticsNeedReset_Event(object sender, StatisticsReset_EventArgs e) { Task task = Task.Factory.StartNew(() => { foreach (string uniqueName in e.UniqueNames_List) { lock (symbolsList_Lock) { Quote_ViewModel symVM = QuotesList.FirstOrDefault(s => s.UniqueName == uniqueName); if (symVM != null) { symVM.RenewPreviousClose(); TradingHours.Instance.RemoveSymbol(uniqueName); } } break; } }); task.Wait(); }
public Quote_EventArgs(Quote_ViewModel qVM) { this.Quote_VM = qVM; }