// Подача заявки private void PreviouslyFunc() { // Данные заявки msgQuotes.FirmID = SelectedFirmBroker.id; msgQuotes.Settl_pair = SelectedClient.settlPair; msgQuotes.IssueID = SelectedIssue.id; msgQuotes.Issue_name = SelectedIssue.name; // Проверка минимальной цены if (BottomPrice > LastPrice) { proc = false; MessageBox.Show("Минимальная цена больше стартовой"); } else { string info; msgQuotes.Price = LastPrice; bool rez = msgQuotes.Send(out info); if (info.Contains("has been added")) { // Определение ранга в торгах Place = 1; } } }
private void AutoSendTask0(DSSERVERLib.GMsgQuoteS msg) { while (!info.Contains("has been added")) { msg.Send(out info); } }
public static bool SendPriceOffer(ScenaryLot scenaryLotItem, int sleepSeconds) { Loger.Write("OfferSender", "Prepare price offer", true); scenaryLot = scenaryLotItem; FillMsgQuote(); DateTime waitTime = DateTime.Now.AddSeconds(sleepSeconds); Loger.Write("OfferSender", "Wait for pause until time is not " + waitTime.ToShortTimeString(), true); while (waitTime > DateTime.Now) { } Loger.Write("OfferSender", "Sending price offer", true); bool result = msgQuote.Send(out info); Loger.Write("OfferSender", "Get request from server ETS: " + info, true); if (info.Contains("has been added")) { return(true); } MessageBox.Show("Ошибка подачи: " + info); return(false); }
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 SendOrder(int type) { Random rnd = new Random(); if (type != 2) { LastPrice = CurrentPrice - rnd.Next(Convert.ToInt32(Step) + 1); if (LastPrice < BottomPrice) { LastPrice = BottomPrice; } } else { proc = false; StartCmdName = "Запуск"; } msgQuotes.Price = LastPrice; DateTime curTime = DateTime.Now; bool rez = msgQuotes.Send(out info); if (info.Contains("not allowed")) { MessageBox.Show("Клиент не допущен на данный торг"); } else if (info.Contains("quotes") && info.Contains("range") && info.Contains("16:00")) { MessageBox.Show("Биржевая сессия завершена"); } else if (!info.Contains("been added")) { MessageBox.Show($"Ошибка (сообщение с биржи): {info}"); } logWriter = new Task(() => LogWriter(1, curTime.ToString("dd.MM.yyyy hh:mm:ss:fff"))); logWriter.Start(); if (PauseTime == null || PauseTime == 0) { PauseTime = 3000; } Thread.Sleep(PauseTime); }