private void AutoSendTask0(DSSERVERLib.GMsgQuoteS msg) { while (!info.Contains("has been added")) { msg.Send(out info); } }
private static void FillMsgQuote() { Loger.Write("OfferSender", "Fill msg quote", true); msgQuote = new DSSERVERLib.GMsgQuoteS(); msgQuote.Msg_action = 78; msgQuote.Id = 0; msgQuote.type = 65; msgQuote.FirmID = Tables.GetBrokers().FirstOrDefault(b => b.brokerCode == scenaryLot.brokerCode).id; inSearch = true; while (inSearch) { var lotsList = Tables.GetLots(); if (lotsList != null && lotsList.Count > 0) { var lotId = lotsList.FirstOrDefault(l => l.lotCode.ToLower() == scenaryLot.lotCode.ToLower()); if (lotId != null) { scenaryLot.id = lotId.id; inSearch = false; } } } msgQuote.IssueID = scenaryLot.id; msgQuote.Issue_name = scenaryLot.lotCode.ToUpper(); msgQuote.Type_wks = 1; msgQuote.Price = scenaryLot.priceOffer; msgQuote.Qty = 1; msgQuote.Paycond = 84; msgQuote.Dcc = ""; msgQuote.Delivery_days = 10; msgQuote.Settl_pair = scenaryLot.clientCode; msgQuote.Mm = 0; msgQuote.Leave = 1; msgQuote.E_s = 0; }
// Параметры заявки private void FillMsgQout() { msgQuotes = new DSSERVERLib.GMsgQuoteS(); msgQuotes.Msg_action = 78; msgQuotes.Id = 0; msgQuotes.type = 65; msgQuotes.IssueID = SelectedIssue.id; msgQuotes.Issue_name = SelectedIssue.name; msgQuotes.Type_wks = 1; msgQuotes.Price = SelectedIssue.nominal; msgQuotes.Qty = 1; msgQuotes.Paycond = 84; msgQuotes.Dcc = ""; msgQuotes.Delivery_days = 10; msgQuotes.Settl_pair = SelectedClient.settlPair; msgQuotes.Mm = 0; msgQuotes.Leave = 1; msgQuotes.E_s = 0; }
private void AutoSendTask(DSSERVERLib.GMsgQuoteS msg, String tWhen = "", decimal price = 0) { if (modeType == 1) { while (!info.Contains("has been added")) { msg.Send(out info); isBusy = false; } } else if (modeType == 3) { while (isBusy) { if (Convert.ToInt32(tWhen.Substring(0, 2)) <= Convert.ToInt32(DateTime.Now.Hour)) { if (Convert.ToInt32(tWhen.Substring(3, 2)) <= Convert.ToInt32(DateTime.Now.Minute)) { if (Convert.ToInt32(tWhen.Substring(6, 2)) <= Convert.ToInt32(DateTime.Now.Second)) { msg.Send(out info); ServerLogsTxt += "\n" + tWhen + " - " + info; if (info.Contains("has been added")) { statusId = 1; } else { statusId = 2; } isBusy = false; } } } } } }
private void LotsPass(List <ProcessedLot> plots) { DSSERVERLib.GMsgQuoteS[] msgQuotes = new DSSERVERLib.GMsgQuoteS[plots.Count]; Task[] timerTask = new Task[plots.Count]; Task[] baseTask = new Task[4]; int iCount = 0, iTask = 0; foreach (var plot in plots) { isBusy = true; decimal tmpPrice = 0; statusId = 0; if (modeType == 1) { tmpPrice = GetPrice(plot.startPrice, plot.percent); } msgQuotes[iCount] = GetNewMsg(plot.lotNo, tmpPrice.ToString(), plot.clientCode, plot.brokerId); if (modeType == 1) { timerTask[iCount] = new Task(() => AutoSendTask(msgQuotes[iCount])); } timerTask[iCount].Start(); while (isBusy) { ; } iCount++; } }
private DSSERVERLib.GMsgQuoteS GetNewMsg(String lotNo, String price, String clientCode, int brokerId) { DSSERVERLib.GMsgQuoteS msg = new DSSERVERLib.GMsgQuoteS(); msg.Msg_action = 78; msg.Id = 0; msg.type = 65; msg.IssueID = restrictedDB.GetIssueId(lotNo); msg.Issue_name = lotNo; msg.Type_wks = 1; msg.Price = price; msg.Qty = 1; msg.Paycond = 84; msg.Dcc = ""; msg.Delivery_days = 10; msg.Settl_pair = clientCode; msg.Mm = 0; msg.Leave = 1; msg.E_s = 0; msg.FirmID = brokerId; return(msg); }
private void LotsPass(List <ProcessedLot> plots) { DSSERVERLib.GMsgQuoteS[] msgQuotes = new DSSERVERLib.GMsgQuoteS[plots.Count]; Task[] timerTask = new Task[plots.Count]; Task[] baseTask = new Task[4]; int iCount = 0, iTask = 0; foreach (var plot in plots) { isBusy = true; decimal tmpPrice = 0; statusId = 0; if (modeType == 1) { tmpPrice = GetPrice(plot.startPrice, plot.percent); } if (modeType == 3) { tmpPrice = plot.startPrice; } msgQuotes[iCount] = GetNewMsg(plot.lotNo, tmpPrice.ToString(), plot.clientCode, plot.brokerId); if (modeType == 1) { timerTask[iCount] = new Task(() => AutoSendTask(msgQuotes[iCount])); } if (modeType == 3) { timerTask[iCount] = new Task(() => AutoSendTask(msgQuotes[iCount], plot.timeWhen, plot.startPrice)); } timerTask[iCount].Start(); while (isBusy) { ; } if (modeType == 3) { foreach (var item in ScenaryOrdersVM.ScenaryOrders) { if (item.TimeWhen == plot.timeWhen && item.LotNumber.ToUpper() == plot.lotNo.ToUpper() && item.PriceTo == plot.startPrice) { switch (statusId) { case 0: break; case 1: item.Comments = "added"; break; case 2: item.Comments = "error"; break; } } } } iCount++; } }