private async void AnimateResultText() { int last = Convert.ToInt32(CurrentTime.ToString()[CurrentTime.ToString().Length - 1].ToString()); string ending = string.Empty; if (last == 1) { ending = "у"; } else if (last >= 2 && last <= 4) { ending = "и"; } string resultText = string.Format(ResultTextFormat, UserName, CurrentTime, ending); foreach (var letter in resultText) { await Task.Delay(20); UserResultText += letter; } }
public async void WriteEntry_WritesEntryUsingCorrectAbsoluteExpiration_ReadAfterExpirationTime() { const string cacheKey = "test-cache-key"; const string value = "test-value"; DateTime absoluteExpiration = new DateTime(year: 2018, month: 3, day: 17, hour: 8, minute: 0, second: 0); using (IMemoryCache memoryCache = GetMemoryCache()) { MemoryCacheAdapter memoryCacheAdapter = new MemoryCacheAdapter(memoryCache, slidingExpiration: TimeSpan.FromDays(10)); using (CurrentTime.UseMockUtcNow(absoluteExpiration.AddHours(-1))) { await memoryCacheAdapter.WriteEntry(cacheKey, new CacheEntry <string>(value, absoluteExpiration)); } using (CurrentTime.UseMockUtcNow(absoluteExpiration.AddSeconds(1))) { CacheEntry <string> cacheEntry = memoryCache.Get <CacheEntry <string> >(cacheKey); Assert.Null(cacheEntry); } } }
public void Update(GameTime gameTime) { _accumulator += gameTime.ElapsedGameTime.TotalMilliseconds; if (_accumulator > OneMinutePassesEveryXMilliseconds) { CurrentTime = CurrentTime.AddMinutes(1); if (CurrentTime.Hour >= 19) { var minuteChange = 255d / (5d * 60d); int minute = CurrentTime.Minute + (CurrentTime.Hour - 19) * 60; int calculatedAmbientColor = 255 - (int)(minute * minuteChange); _penumbra.AmbientColor = Color.FromNonPremultiplied(calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor); } else if (CurrentTime.Hour >= 4) { var minuteChange = 255d / (2d * 60d); int minute = CurrentTime.Minute + (CurrentTime.Hour - 4) * 60; int calculatedAmbientColor = (int)(minute * minuteChange); if (calculatedAmbientColor >= 255) { calculatedAmbientColor = 255; } _penumbra.AmbientColor = Color.FromNonPremultiplied(calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor); } _accumulator = 0; } }
//----- params ----- //----- field ----- //----- property ----- //----- method ----- private void SetNotify() { foreach (var info in notifications.Values) { var time = info.UnixTime.UnixTimeToDateTime() - CurrentTime.UnixTimeToDateTime(); var notification = new iOSNotification() { Identifier = info.Identifier.ToString(), Title = info.Title, Body = info.Message, ShowInForeground = false, Badge = info.BadgeCount, Trigger = new iOSNotificationTimeIntervalTrigger { TimeInterval = time, Repeats = false, } }; iOSNotificationCenter.ScheduleNotification(notification); } }
protected void this_MouseMove(object sender, MouseEventArgs e) { if (IsMouseDown) { Cursor = Cursors.Hand; Point p = e.GetPosition(this); double dist = (_LastMouseDownPosition.X - p.X); if (_MinimumDragDistance <= Math.Abs(dist)) { _LastMouseDownPosition = p; TimeUnits tu = (RowsPresenter.Children[RowsPresenter.Children.Count - 1] as TimespanHeaderRow).TimeUnit; if (tu == TimeUnits.Hours) { CurrentTime = CurrentTime.AddType(TimeUnits.Hours, dist / GetWidth(CurrentTime, TimeUnits.Hours)); } else { CurrentTime = CurrentTime.AddType(TimeUnits.Days, ConvertDistanceToDays(dist)); } } } }
public override void Update(GameTime gameTime) { if (TimeReached && !Loop) { return; } else { TimeReached = false; } CurrentTime = CurrentTime.Subtract(gameTime.ElapsedGameTime); if (CurrentTime.TotalMilliseconds <= 0) { NotifyTick(); TimeReached = true; if (Loop) { CurrentTime = Length; } } base.Update(gameTime); }
private void OnSessionOrderExecuted(Execution execution) { var transactionId = TryParseTransactionId(execution.Order.InstructionId); if (transactionId == null) { return; } SendOutMessage(new ExecutionMessage { SecurityId = new SecurityId { Native = execution.Order.InstrumentId }, OriginalTransactionId = transactionId.Value, TradeId = execution.ExecutionId, TradePrice = execution.Price, Volume = execution.Quantity.Abs(), ExecutionType = ExecutionTypes.Trade, Side = execution.Order.Quantity > 0 ? Sides.Buy : Sides.Sell, Commission = execution.Order.Commission, ServerTime = CurrentTime.Convert(TimeZoneInfo.Utc) }); }
private static async Task <double> CalculateScore(AStarCity start, AStarCity end) { var startLocation = GetLocation(start); var endLocation = GetLocation(end); await GetTravelInfo(startLocation, endLocation); while (Result == null) { await Task.Delay(25); } double distanceScore = 1 / (double)Result.distance.value; CurrentTime = CurrentTime.AddSeconds(Result.duration.value); if (CurrentTime > end.City.ArrivingTime) { return(0); } double timeScore = (1 / (end.City.ArrivingTime.Subtract(CurrentTime).TotalSeconds)) * _timeImportanceCoeficient; Result = null; return(distanceScore + timeScore); }
} //Seznam názvů uložených souborů, které se dají do typu PositionedText public static bool PauseGameMenu() { ///Shrnutí ///Základní metoda PauseMenu, která vrátí boolean podle toho, zda hráč chce pokračovat ve hře nebo zda chce hru ukončit if (((Console.LargestWindowWidth - 5) > Console.WindowWidth) || ((Console.LargestWindowHeight - 3) > Console.WindowHeight)) //Nejprve se ověří, zda je hra na celou obrazovku, protože jinak by se mohly vytvořit grafiky na chybných pozicích { Program.WaitForFix(); //Počká se tedy, než hráč dá hru na celou obrazovku } Console.BackgroundColor = ConsoleColor.Black; Console.Clear(); //Obrazovka se smaže CurrentTime = GameControls.CompletionTime; //Načte se uběhlý čas ze hry Border PauseBigBorder = new Border(0, 1, Console.WindowHeight - 1, Console.WindowWidth, ConsoleColor.Black, ConsoleColor.Gray, false); Border PauseSmallBorder = new Border(Console.WindowWidth / 2 - 30, 18, 9, 60, ConsoleColor.Black, ConsoleColor.Gray, false); PositionedText PausedGame = new PositionedText("Game is paused", ConsoleColor.Black, Console.WindowWidth / 2 - 7, 20); PositionedText Unpause = new PositionedText("Continue", ConsoleColor.Black, Console.WindowWidth / 2 - 27, 24); PositionedText SaveGame = new PositionedText("Save game", ConsoleColor.Black, Console.WindowWidth / 2 - 16, 24); PositionedText LoadGame = new PositionedText("Load game", ConsoleColor.Black, Console.WindowWidth / 2 - 4, 24); PositionedText BackToMenu = new PositionedText("Back to Menu", ConsoleColor.Black, Console.WindowWidth / 2 + 8, 24); PositionedText Quit = new PositionedText("Quit", ConsoleColor.Black, Console.WindowWidth / 2 + 23, 24); string time = "Current time: " + CurrentTime.ToString(); PositionedText Time = new PositionedText(time, ConsoleColor.Black, (Console.WindowWidth - time.Length) / 2, 22); //Vytvoří se všechny grafiky Labels = new IGraphic[4]; Labels[0] = PauseBigBorder; Labels[1] = PauseSmallBorder; Labels[2] = PausedGame; Labels[3] = Time; SwitchableLabels = new PositionedText[5]; SwitchableLabels[0] = Unpause; SwitchableLabels[1] = SaveGame; SwitchableLabels[2] = LoadGame; SwitchableLabels[3] = BackToMenu; SwitchableLabels[4] = Quit; //A grafiky se uloží do svých arrayů. Tlačítka do SwitchableLabels, zbytek do Labels ChosenLabel = 0; //Nastaví se vybrané tlačítko na nulu (Continue – Pokračovat) for (int x = 0; x < 4; x++) //Vytisknou se grafické objekty { Labels[x].Print(x < 2, Reprint); //Oba obdélníky se vytisnou se silnými svislými liniemi. Pokud při tištění není hra nastavena na celou obrazovku, počká se na opravu od uživatele, vymaže se Console a toto menu se vytiskne znovu } ConsoleKey keypressed = 0; //Nyní budeme opět číst klávesu while (true) //Začíná nekonečný while cyklus, který se dá opustit pouze tím, že hráč vrátí true (pokračovat ve hře), false (vrátit se do menu) nebo ukončí program { for (int x = 0; x < 5; x++) //Před stisknutím klávesy se vytisknou všechna tlačítka { SwitchableLabels[x].Print(x == ChosenLabel, Reprint); //Pokud je tlačítko na vybrané pozici, tak se vytiskne bílou barvou (zvýrazněně). Pokud při tištění není hra nastavena na celou obrazovku, počká se na opravu od uživatele, vymaže se Console a toto menu se vytiskne znovu } keypressed = Console.ReadKey(true).Key; //Nyní se přečte klávesa od uživatele switch (keypressed) { case ConsoleKey.RightArrow: //Pokud uživatel zmáčkne šipku doprava tak se pokusíme posunout o jedno doprava (tedy zvýšit číslo o jedna) if (ChosenLabel != 4) //Stane se tak pokud již nejsme na maximální hodnotě 4 (tedy Quit – Ukončit) { ChosenLabel++; } break; case ConsoleKey.LeftArrow: //Pokud uživatel zmáčkne šipku doleva tak se pokusíme posunout o jedno doleva (tedy snížit číslo o jedna) if (ChosenLabel != 0) //Stane se tak pokud již nejsme na svém minimu 0 (tedy Continue – pokračovat) { ChosenLabel--; } break; case ConsoleKey.Escape: //Pokud uživatel zmáčkne Escape, tak se okamžitě vrátí do hry (Escapem pauzu zapne i ukončí) return(true); case ConsoleKey.Enter: //Enterem hráč potvrdí svoji volbu switch (ChosenLabel) { case 0: //Pokud je vybráno tlačítko Continue (Pokračovat), tak se vrátí true a pokračuje se ve hře return(true); case 1: //Pokud je vybráno tlačítko Save game (Uložit hru), tak se hra uloží pomocí metody SaveTheGame() SaveTheGame(); Console.BackgroundColor = ConsoleColor.Black; //Když se hráč vrátí zpěrt Console.Clear(); //Vymaží se grafiky ukládání for (int x = 0; x < 4; x++) //A znovu se vytisknou grafické objekty kromě tlačítek (tlačítka se vytisknou poté na začátku další fáze while cyklu) { Labels[x].Print(x < 2, Reprint); //Oba obdélníky se vytisnou se silnými svislými liniemi. Pokud při tištění není hra nastavena na celou obrazovku, počká se na opravu od uživatele, vymaže se Console a toto menu se vytiskne znovu } break; case 2: //Pokud je vybráno tlačítko Load game (Načíst hru), tak se zavolá metoda LoadTheGame(), která vrací bool. Tento bool určuje zda hráč skutečně hru načetl nebo si to v průběhu rozmyslel/nebyly žádné hry k načtení if (LoadTheGame()) //Pokud se hra úspěšně načetla { Console.BackgroundColor = ConsoleColor.Black; //Smaže se současné vytisklé menu Console.Clear(); return(true); //Vrátí se true, protože chceme pokračovat ve hře. Nicméně metoda LoadTheGame() ji změnila právě na hru ze souborui } else //Pokud hra nebyla úspěšně načtena { Console.BackgroundColor = ConsoleColor.Black; Console.Clear(); //Smaží se grafiky načítání hry for (int x = 0; x < 4; x++) //A znovu se vytisknou grafické objekty kromě tlačítek (tlačítka se vytisknou poté na začátku další fáze while cyklu) { Labels[x].Print(x < 2, Reprint); //Oba obdélníky se vytisnou se silnými svislými liniemi. Pokud při tištění není hra nastavena na celou obrazovku, počká se na opravu od uživatele, vymaže se Console a toto menu se vytiskne znovu } break; } case 3: //Pokud je vybráno tlačítko Back to menu { Console.BackgroundColor = ConsoleColor.Black; Console.Clear(); //Smaže se současné menu return(false); //Vrátí se false, což v GameControls nastaví GameAbported na true a vrátí nás do prvního menu } case 4: //Pokud je vybráno tlačítko Quit Environment.Exit(0); //Program se ukončí s číselným kódem 0 break; } break; case ConsoleKey.R: //Pokud uživatel zmáčkne R zavolá se metoda Reprint try { Reprint(); //Pokusí se vymazat menu a vytisknout jej znovu } catch (ArgumentOutOfRangeException) //Pokud nastane situace, že něco by se mělo tisknout mimo obrazovku { Program.WaitForFix(); //Vyzve uživatele, aby zvětšil hru na celou obrazovku a nepustí ho dál dokud tak neučiní Reprint(); //Znovu se pokusí vymazat menu a vytisknout jej znovu } break; } } }
public string GetTime() { return(CurrentTime.ToShortTimeString()); }
protected void btnNewSchedule_Click(object sender, EventArgs e) { Button btnNewSchedule = sender as Button; GridViewRow row = (GridViewRow)btnNewSchedule.NamingContainer; gvUniqueID = row.UniqueID; GridViewRow gvMasterRow = (GridViewRow)row.Parent.Parent; string DaySelected = ((Label)(gvAdvisorSetSchedule.Rows[row.RowIndex].FindControl("lblDay"))).Text; double MinutesPerSlot = 30; DateTime CurrentTime; DataRow[] AvailableDays = AdvisorWeekSchedulesData.Copy().Select("Day='" + DaySelected + "'"); List <String> lstAdvisorTimeSlots = new List <string>(); foreach (DataRow days in AvailableDays) { DateTime StartTime = Convert.ToDateTime(days["StartTime"].ToString()); DateTime EndTime = Convert.ToDateTime(days["EndTime"].ToString()).AddMinutes(-MinutesPerSlot); CurrentTime = StartTime; while (CurrentTime <= EndTime) { lstAdvisorTimeSlots.Add(CurrentTime.ToString("hh:mm tt")); CurrentTime = CurrentTime.AddMinutes(MinutesPerSlot); } } DateTime DayStartTime = Convert.ToDateTime("8:00 AM"); DateTime DayEndTime = Convert.ToDateTime("5:00 PM"); DayEndTime = DayEndTime.AddMinutes(-MinutesPerSlot); CurrentTime = DayStartTime; ddlStartTime.Items.Clear(); ddlEndTime.Items.Clear(); while (CurrentTime <= DayEndTime) { if ((lstAdvisorTimeSlots.IndexOf(CurrentTime.ToShortTimeString())) == -1) { ListItem timeSlot = new ListItem(CurrentTime.ToString("hh:mm tt")); ListItem timeEndSlot = new ListItem(CurrentTime.ToString("hh:mm tt")); if (!(ddlStartTime.Items.Contains(timeSlot))) { ddlStartTime.Items.Add(timeSlot); ddlEndTime.Items.Add(timeEndSlot); } } CurrentTime = CurrentTime.AddMinutes(MinutesPerSlot); } this.lbAdvisorScheduleID.Text = "-1";; lblDayName.Text = DaySelected; this.lblDate.Text = GetSchedule.DayInWeekDate(DaySelected, Convert.ToInt32(ddlWeek.Text.ToString()), Convert.ToInt32(ddlYear.Text.ToString())).ToString("dd-MMM-yyyy"); this.btnSave.Visible = (Convert.ToInt32(GetSchedule.WeekNumber(DateTime.Now).ToString()) > Convert.ToInt32(this.ddlWeek.SelectedValue.ToString().Trim())) ? false: true; if (this.btnSave.Visible == true) { this.btnSave.Visible = (DateTime.Now.Year >= Convert.ToInt32(this.ddlYear.SelectedValue.ToString().Trim())) ? true: false; } mpeScheduleMaintenance.Show(); //show the modal popup extender }
public void ToSecond() { SecondFormat = (CurrentTime.ToString("d", CultureInfo.CreateSpecificCulture("en-US"))) + " " + (CurrentTime.ToString("t", CultureInfo.CreateSpecificCulture("en-US"))); }
public void ToFirst() { FirstFormat = (CurrentTime.ToString("d", CultureInfo.CreateSpecificCulture("en-NZ"))) + " " + (CurrentTime.ToString("t", CultureInfo.CreateSpecificCulture("hr-HR"))); }
private void SearchSecurities(string secCode, long transactionId, ICollection <Instrument> instruments, bool hasMoreResults) { if (secCode.IsEmpty()) { throw new ArgumentNullException(nameof(secCode), LocalizedStrings.Str3391); } if (instruments == null) { throw new ArgumentNullException(nameof(instruments)); } foreach (var instrument in instruments) { SecurityTypes type; var typeName = instrument.Underlying.AssetClass.ToUpperInvariant(); switch (typeName) { case "COMMODITY": type = SecurityTypes.Commodity; break; case "CURRENCY": type = SecurityTypes.Currency; break; case "INDEX": type = SecurityTypes.Index; break; default: SendOutError(LocalizedStrings.Str2140Params.Put(typeName)); continue; } var securityId = new SecurityId { SecurityCode = instrument.Underlying.Symbol, BoardCode = ExchangeBoard.Lmax.Code, Native = instrument.Id }; SendOutMessage(new SecurityMessage { SecurityId = securityId, Name = instrument.Name, PriceStep = instrument.OrderBook.PriceIncrement, VolumeStep = instrument.OrderBook.QuantityIncrement, Multiplier = instrument.Contract.ContractSize, Currency = instrument.Contract.Currency.To <CurrencyTypes>(), ExpiryDate = instrument.Calendar.ExpiryTime == null ? (DateTimeOffset?)null : instrument.Calendar.ExpiryTime.Value.ApplyTimeZone(TimeZoneInfo.Utc), SecurityType = type, OriginalTransactionId = transactionId, }); SendOutMessage( new Level1ChangeMessage { SecurityId = securityId, ServerTime = CurrentTime.Convert(TimeZoneInfo.Utc), } .TryAdd(Level1Fields.StepPrice, instrument.Contract.UnitPrice)); } if (hasMoreResults) { _session.SearchInstruments(new SearchRequest(secCode, instruments.Count), (i, h) => SearchSecurities(secCode, transactionId, i, h), CreateErrorHandler("SearchInstruments")); } else { SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = transactionId }); } }
private void OnSessionOrderChanged(LmaxOrder lmaxOrder) { var transactionId = TryParseTransactionId(lmaxOrder.InstructionId); if (transactionId == null) { return; } LmaxOrderCondition condition = null; decimal price = 0; OrderTypes orderType; switch (lmaxOrder.OrderType) { case OrderType.MARKET: orderType = OrderTypes.Market; break; case OrderType.LIMIT: orderType = OrderTypes.Limit; if (lmaxOrder.LimitPrice == null) { throw new ArgumentException(LocalizedStrings.Str3394Params.Put(transactionId), nameof(lmaxOrder)); } price = (decimal)lmaxOrder.LimitPrice; break; case OrderType.STOP_ORDER: case OrderType.STOP_LOSS_MARKET_ORDER: case OrderType.STOP_PROFIT_LIMIT_ORDER: orderType = OrderTypes.Conditional; if (lmaxOrder.StopPrice == null) { throw new ArgumentException(LocalizedStrings.Str3395Params.Put(transactionId), nameof(lmaxOrder)); } price = (decimal)lmaxOrder.StopPrice; condition = new LmaxOrderCondition { StopLossOffset = lmaxOrder.StopLossOffset, TakeProfitOffset = lmaxOrder.StopProfitOffset, }; break; case OrderType.CLOSE_OUT_ORDER_POSITION: case OrderType.CLOSE_OUT_POSITION: case OrderType.SETTLEMENT_ORDER: case OrderType.OFF_ORDERBOOK: case OrderType.REVERSAL: case OrderType.UNKNOWN: orderType = OrderTypes.Execute; break; default: throw new ArgumentOutOfRangeException(); } DateTimeOffset?expiryDate = null; var tif = StockSharpTimeInForce.PutInQueue; switch (lmaxOrder.TimeInForce) { case LmaxTimeInForce.FillOrKill: tif = StockSharpTimeInForce.MatchOrCancel; break; case LmaxTimeInForce.ImmediateOrCancel: tif = StockSharpTimeInForce.CancelBalance; break; case LmaxTimeInForce.GoodForDay: expiryDate = DateTime.Today.ApplyTimeZone(TimeZoneInfo.Utc); break; case LmaxTimeInForce.GoodTilCancelled: break; case LmaxTimeInForce.Unknown: throw new NotSupportedException(LocalizedStrings.Str3396Params.Put(lmaxOrder.TimeInForce, transactionId.Value, lmaxOrder.OrderId)); default: throw new InvalidOperationException(LocalizedStrings.Str3397Params.Put(lmaxOrder.TimeInForce, transactionId.Value, lmaxOrder.OrderId)); } var msg = new ExecutionMessage { SecurityId = new SecurityId { Native = lmaxOrder.InstrumentId }, OriginalTransactionId = transactionId.Value, OrderType = orderType, OrderPrice = price, Condition = condition, OrderVolume = lmaxOrder.Quantity.Abs(), Side = lmaxOrder.Quantity > 0 ? Sides.Buy : Sides.Sell, Balance = lmaxOrder.Quantity - lmaxOrder.FilledQuantity, PortfolioName = lmaxOrder.AccountId.To <string>(), TimeInForce = tif, ExpiryDate = expiryDate, OrderStringId = lmaxOrder.OrderId, ExecutionType = ExecutionTypes.Transaction, Commission = lmaxOrder.Commission, ServerTime = CurrentTime.Convert(TimeZoneInfo.Utc), HasOrderInfo = true, }; msg.OrderState = lmaxOrder.CancelledQuantity > 0 ? OrderStates.Done : (msg.Balance == 0 ? OrderStates.Done : OrderStates.Active); //msg.Action = lmaxOrder.CancelledQuantity > 0 // ? ExecutionActions.Canceled // : (lmaxOrder.FilledQuantity == 0 ? ExecutionActions.Registered : ExecutionActions.Matched); SendOutMessage(msg); }
private void OnSecurityChanged(string smartId, Tuple <decimal?, decimal?, DateTime> lastTrade, decimal?open, decimal?high, decimal?low, decimal?close, decimal?volume, QuoteChange bid, QuoteChange ask, decimal?openInt, Tuple <decimal?, decimal?> goBuySell, Tuple <decimal?, decimal?> goBase, Tuple <decimal?, decimal?> limits, int tradingStatus, Tuple <decimal?, decimal?> volatTheorPrice) { var secId = new SecurityId { Native = smartId }; var message = new Level1ChangeMessage { SecurityId = secId, ExtensionInfo = new Dictionary <object, object> { { SmartComExtensionInfoHelper.SecurityOptionsMargin, goBase.Item1 }, { SmartComExtensionInfoHelper.SecurityOptionsSyntheticMargin, goBase.Item2 } }, ServerTime = CurrentTime.Convert(TimeHelper.Moscow), }; message.TryAdd(Level1Fields.LastTradePrice, lastTrade.Item1); message.TryAdd(Level1Fields.LastTradeVolume, lastTrade.Item2); message.Add(Level1Fields.LastTradeTime, lastTrade.Item3.ApplyTimeZone(TimeHelper.Moscow)); var prevQuotes = _bestQuotes.TryGetValue(secId); if (bid.Price != 0) { message.Add(Level1Fields.BestBidPrice, bid.Price); if (prevQuotes != null && prevQuotes.First != null && prevQuotes.First.Item1 == bid.Price) { message.Add(Level1Fields.BestBidVolume, prevQuotes.First.Item2); } } if (ask.Price != 0) { message.Add(Level1Fields.BestAskPrice, ask.Price); if (prevQuotes != null && prevQuotes.Second != null && prevQuotes.Second.Item1 == ask.Price) { message.Add(Level1Fields.BestAskVolume, prevQuotes.Second.Item2); } } message.TryAdd(Level1Fields.BidsVolume, bid.Volume); message.TryAdd(Level1Fields.AsksVolume, ask.Volume); message.TryAdd(Level1Fields.OpenPrice, open); message.TryAdd(Level1Fields.LowPrice, low); message.TryAdd(Level1Fields.HighPrice, high); message.TryAdd(Level1Fields.ClosePrice, close); message.TryAdd(Level1Fields.MinPrice, limits.Item1); message.TryAdd(Level1Fields.MaxPrice, limits.Item2); message.TryAdd(Level1Fields.MarginBuy, goBuySell.Item1); message.TryAdd(Level1Fields.MarginSell, goBuySell.Item2); message.TryAdd(Level1Fields.OpenInterest, openInt); message.TryAdd(Level1Fields.ImpliedVolatility, volatTheorPrice.Item1); message.TryAdd(Level1Fields.TheorPrice, volatTheorPrice.Item2); message.TryAdd(Level1Fields.Volume, volume); message.Add(Level1Fields.State, tradingStatus == 0 ? SecurityStates.Trading : SecurityStates.Stoped); SendOutMessage(message); }
/// <summary> /// Return a text representation of this object. /// </summary> public override String ToString() => String.Concat(Status, " (", CurrentTime.ToIso8601(), ", ", Interval.TotalSeconds, " sec(s))");
private void btnYearLast_BtnClick(object sender, EventArgs e) { panSelectYear.Visible = false; panSelectMonth.Visible = false; CurrentTime = CurrentTime.AddYears(-1); }
private void btnMouthNext_BtnClick(object sender, EventArgs e) { panSelectYear.Visible = false; panSelectMonth.Visible = false; CurrentTime = CurrentTime.AddMonths(1); }
private void dispatcherTimer_Tick(object sender, EventArgs e) { CurrentTime = CurrentTime.Subtract(_oneSecond); Debug.WriteLine(CurrentTime.Seconds); }
/// <summary> /// Return a text representation of this object. /// </summary> public override String ToString() => CurrentTime.ToIso8601();
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() => CurrentTime.GetHashCode();
protected int defaultOpenTimes = 179; //每人销售的期数 protected void Page_Load(object sender, EventArgs e) { try { string GameName = ub.GetSub("GameName", xmlPath); DateTime GameBeginTime, GameEndTime, CurrentTime; int GameOpenTimes, SaleTimes, OpenTimes, ValidDays; int StopSec = defaultStopSec; bool AutoCalc = false; #region 读取配置项,并初始化变量 try { int.TryParse(ub.GetSub("StopSaleSec", xmlPath), out StopSec); if (StopSec <= defaultStopSecMin) { StopSec = defaultStopSec; } // string ct1 = ub.GetSub("GameBeginTime", xmlPath); string ct2 = ub.GetSub("GameEndTime", xmlPath); GameBeginTime = Convert.ToDateTime(ct1); GameEndTime = Convert.ToDateTime(ct2); CurrentTime = DateTime.Now; GameOpenTimes = int.Parse(ub.GetSub("GameOpenTimes", xmlPath)); //游戏每天开奖期数 SaleTimes = int.Parse(ub.GetSub("SaleTimes", xmlPath)); //每期游戏开售分钟数 OpenTimes = int.Parse(ub.GetSub("OpenTimes", xmlPath)); //每期游戏开奖分钟数(在上期停售后N秒后开奖) ValidDays = int.Parse(ub.GetSub("ValidDays", xmlPath)); //当期的兑奖有效日期天数 myOpenTimes = OpenTimes; mySaleTimes = SaleTimes; myValidDays = ValidDays; int autocalc = int.Parse(ub.GetSub("AutoCalc", xmlPath)); if (autocalc == 1) { AutoCalc = true; } } catch (Exception ex) { Response.Write("error1“读取配置项并初始化变量”出错!!!" + "</br>"); Response.Write(ex.Message.Replace("\n", "</br>")); return; } #endregion Response.Write("PK10每天的销售时间为" + GameBeginTime.ToShortTimeString() + "至" + GameEndTime.ToShortTimeString() + ",每" + SaleTimes.ToString() + "分钟一期,每天" + GameOpenTimes.ToString().Trim() + "期" + "<br/>"); // PK10_Base _base = new PK10().GetSaleBase(); #region 判断是否已有初始化(tb_PK10_Base表添加一行ID=0的记录) if (_base == null) { Response.Write("ok1 没有初始化游戏数据" + "<br/>"); return; } #endregion if (_base.CurrentSaleDate < DateTime.Parse(CurrentTime.ToShortDateString())) { int newNo = new PK10().GetTodayFistCreateNo(); if (newNo > 0) { #region 初始化新的一天数据 //新的一天,从网页抓取正在开售的期 Response.Write("初始化新的一天数据...." + "<br/>"); string html = new PK10().GetHtmlByURL(); PK10_List list = new PK10().GetCurrentSaleDataByHtml(html); if (list != null) { //初始化当天销售数据(生成将要开售的期号) string cInitFlag = new PK10().InitSaleData(GameBeginTime, newNo, mySaleTimes, myValidDays, GameOpenTimes, StopSec); if (cInitFlag == "") { GetLatestOpenDatas(html, "0");//获取当天已经开奖的数据(补填当天的销售记录)(从百度彩票抓,可以抓到整日的数据) } else { Response.Write("error1 :初始化当天销售数据失败!" + "<br/>"); } } else { Response.Write("error1 :抓取网页数据失败!" + "<br/>"); } #endregion } else { Response.Write("error1“数据隔了1天以上没抓取过,请先设置今天的开始期号!”" + "</br>"); //向上一天插入一跳最后一期的记录,例如:insert into tb_PK10_List(No,date) values('584063','2016-10-30'),不用设置begintime,endtime等。 } return; } else { Response.Write("<a href =\"" + Utils.getPage("PK10Get.aspx" + "?act=getall") + "\">" + "手动抓取最近所有开奖数据" + "</a><br/>"); Response.Write("<a href =\"" + Utils.getPage("PK10Get.aspx") + "\">" + "自动抓取开奖数据" + "</a><br/>"); Response.Write("<br/>"); string act = Utils.GetRequest("act", "get", 1, "", ""); if (act == "getall") { Response.Write("【手动抓取最近所有开奖数据...】" + " <br/>"); string html = new PK10().GetHtmlByURL(); RefreshLatestOpenData(html); GetLatestOpenDatas(html, "0"); //(从百度彩票抓,可以抓到整日的数据) } else { Response.Write("【自动抓取第" + _base.GetOpenDataNo.ToString() + "期】" + "<br/>"); #region 读取开奖记录 if (CurrentTime < _base.GetOpenDataBeginTime) //未到公布开奖时间 { Response.Write("等待开奖公布..." + "<br/>"); } else { if (CurrentTime <= _base.GetOpenDataEndTime) //处于本期公布开奖时间,读取开奖记录,并重置下次读取的时间段 { string html = new PK10().GetHtmlByURL2(); RefreshLatestOpenData(html); } else //超过指定的开奖公布时间,读取最新开奖记录,并重置下次读取的时间段;然后读取已开奖的记录更新开奖(刷新机可能停止运作了一段长的时间) { string html = new PK10().GetHtmlByURL2(); RefreshLatestOpenData(html); html = new PK10().GetHtmlByURL(); GetLatestOpenDatas(html, _base.GetOpenDataNo); //(从百度彩票抓,可以抓到整日的数据) } } #endregion } } if (AutoCalc) { CalcOpenData(); //派奖计算 } Response.Write("ok1"); } catch (Exception ex) { Response.Write("error1" + "<br/>" + ex.Message); return; } }
private IEnumerable <Message> ParseMessages(IQFeedWrapper feed, string str, MessageTypes type, long requestId) { switch (type) { case ExtendedMessageTypes.System: yield return(new IQFeedSystemMessage(feed, str)); break; case ExtendedMessageTypes.SecurityType: { var parts = str.SplitByComma(); yield return(new IQFeedSecurityTypeMessage(parts[0].To <int>(), parts[1], parts[2])); break; } case ExtendedMessageTypes.ListedMarket: { var parts = str.SplitByComma(); yield return(new IQFeedListedMarketMessage(parts[0].To <int>(), parts[1], parts[2])); break; } case ExtendedMessageTypes.Data: yield return(new IQFeedDataMessage(str)); break; case ExtendedMessageTypes.End: yield return(new IQFeedEndMessage()); break; case MessageTypes.Time: yield return(new TimeMessage { ServerTime = str.ToDateTime("yyyyMMdd HH:mm:ss").ApplyTimeZone(TimeHelper.Est) }); break; case MessageTypes.Security: { var parts = str.SplitByComma(); yield return(new SecurityMessage { SecurityId = CreateSecurityId(parts[0], parts[1].To <int>()), Name = parts[3], OriginalTransactionId = requestId, SecurityType = _securityTypes[parts[2].To <int>()], }); break; } case ExtendedMessageTypes.Fundamental: { foreach (var result in ToSecurityFundamentalMessages(str)) { yield return(result); } break; } case MessageTypes.Level1Change: { foreach (var result in ToSecurityUpdateMessage(str)) { yield return(result); } break; } case MessageTypes.Execution: { yield return(ToLevel1(str, _secIds[requestId])); break; } case MessageTypes.News: yield return(ToNewsMessage(str)); break; case ExtendedMessageTypes.NewsStory: { yield return(new NewsMessage { Id = _newsIds[requestId], Story = str.StripBrackets("<BEGIN>", "<END>"), ServerTime = CurrentTime.Convert(TimeHelper.Est) }); break; } case MessageTypes.CandleTimeFrame: case MessageTypes.CandleTick: case MessageTypes.CandleVolume: case ExtendedMessageTypes.HistoryExtraDayCandle: { var parts = str.SplitByComma(); var tuple = _candleParsers[requestId]; var candleMsg = tuple.Item1(parts); candleMsg.OriginalTransactionId = requestId; candleMsg.SecurityId = _secIds[requestId]; if (tuple.Item2 is TimeSpan) { var tf = (TimeSpan)tuple.Item2; if (tf == TimeSpan.FromDays(1)) { candleMsg.OpenTime = candleMsg.CloseTime; candleMsg.CloseTime = candleMsg.OpenTime.EndOfDay(); } else // if (tf == TimeSpan.FromDays(7) || tf.Ticks == TimeHelper.TicksPerMonth) { candleMsg.CloseTime -= TimeSpan.FromTicks(1); candleMsg.OpenTime = tf.GetCandleBounds(candleMsg.CloseTime.ToLocalTime(TimeHelper.Est)).Min; } } else { candleMsg.OpenTime = candleMsg.CloseTime; } yield return(candleMsg); break; } case MessageTypes.QuoteChange: { var l1Msg = ToLevel2(str); if (l1Msg != null) { yield return(l1Msg); } break; } case MessageTypes.Error: yield return(new ErrorMessage { Error = new InvalidOperationException(str) }); break; default: throw new InvalidOperationException(LocalizedStrings.Str2142Params.Put(type)); } }
private IEnumerable <Message> ToSecurityUpdateMessage(string value) { var parts = value.SplitByComma(); var index = 0; var secCode = parts[index++]; var exchangeId = int.Parse(parts[index++], NumberStyles.HexNumber); var tradeBoard = parts[index++].To <int?>(); var bidBoard = parts[index++].To <int?>(); var askBoard = parts[index++].To <int?>(); var l1Messages = new[] { exchangeId, tradeBoard, bidBoard, askBoard } .Where(id => id != null) .Select(id => id.Value) .Distinct() .ToDictionary(boardId => boardId, boardId => new Level1ChangeMessage { SecurityId = CreateSecurityId(secCode, boardId) }); DateTime?lastTradeDate = null; TimeSpan?lastTradeTime = null; decimal? lastTradePrice = null; decimal? lastTradeVolume = null; long? lastTradeId = null; var types = new HashSet <Level1Fields>(Enumerator.GetValues <Level1Fields>()); var messageContentsIndex = Level1Columns.IndexOf(Level1ColumnRegistry.MessageContents); if (messageContentsIndex != -1) { types.Exclude(parts[messageContentsIndex + index]); } if (tradeBoard == null) { types.Remove(Level1Fields.LastTradeId); types.Remove(Level1Fields.LastTradeTime); types.Remove(Level1Fields.LastTradePrice); types.Remove(Level1Fields.LastTradeVolume); } if (bidBoard == null) { types.Remove(Level1Fields.BestBidTime); types.Remove(Level1Fields.BestBidPrice); types.Remove(Level1Fields.BestBidVolume); } if (askBoard == null) { types.Remove(Level1Fields.BestAskTime); types.Remove(Level1Fields.BestAskPrice); types.Remove(Level1Fields.BestAskVolume); } foreach (var column in Level1Columns) { var colValue = parts[index++]; if (colValue.IsEmpty()) { continue; } //colValue = colValue.To(column.Type); switch (column.Field) { case IQFeedLevel1Column.DefaultField: { var typedColValue = column.Convert(colValue); if (typedColValue != null) { l1Messages[exchangeId].AddValue(column.Name, typedColValue); } break; } case Level1Fields.LastTradeId: if (types.Contains(column.Field)) { lastTradeId = colValue.To <long?>(); if (lastTradeId != null && lastTradeId != 0) { l1Messages[tradeBoard.Value].Add(column.Field, lastTradeId.Value); } } break; case Level1Fields.LastTradeTime: if (types.Contains(column.Field)) { if (column == Level1ColumnRegistry.LastDate) { lastTradeDate = colValue.TryToDateTime(column.Format); } else if (column == Level1ColumnRegistry.LastTradeTime) { lastTradeTime = column.ConvertToTimeSpan(colValue); } if (lastTradeDate.HasValue && lastTradeTime.HasValue) { var l1Msg = l1Messages[tradeBoard.Value]; l1Msg.ServerTime = (lastTradeDate.Value + lastTradeTime.Value).ApplyTimeZone(TimeHelper.Est); l1Msg.Add(Level1Fields.LastTradeTime, l1Msg.ServerTime); } } break; case Level1Fields.LastTradePrice: case Level1Fields.LastTradeVolume: if (types.Contains(column.Field)) { var decValue = colValue.To <decimal?>(); l1Messages[tradeBoard.Value].TryAdd(column.Field, decValue); if (column == Level1ColumnRegistry.LastTradePrice) { lastTradePrice = decValue; } else // if (column == SessionHolder.Level1ColumnRegistry.LastTradeVolume) { lastTradeVolume = decValue; } } break; case Level1Fields.BestBidTime: if (types.Contains(column.Field)) { var typedColValue = column.ConvertToTimeSpan(colValue); if (typedColValue != null) { var l1Msg = l1Messages[bidBoard.Value]; l1Msg.ServerTime = (DateTime.Today + typedColValue.Value).ApplyTimeZone(TimeHelper.Est); l1Msg.Add(Level1Fields.BestBidTime, l1Msg.ServerTime); } } break; case Level1Fields.BestBidPrice: case Level1Fields.BestBidVolume: if (types.Contains(column.Field)) { l1Messages[bidBoard.Value].TryAdd(column.Field, colValue.To <decimal?>()); } break; case Level1Fields.BestAskTime: if (types.Contains(column.Field)) { var typedColValue = column.ConvertToTimeSpan(colValue); if (typedColValue != null) { var l1Msg = l1Messages[askBoard.Value]; l1Msg.ServerTime = (DateTime.Today + typedColValue.Value).ApplyTimeZone(TimeHelper.Est); l1Msg.Add(Level1Fields.BestAskTime, l1Msg.ServerTime); } } break; case Level1Fields.BestAskPrice: case Level1Fields.BestAskVolume: if (types.Contains(column.Field)) { l1Messages[askBoard.Value].TryAdd(column.Field, colValue.To <decimal?>()); } break; case Level1Fields.OpenInterest: case Level1Fields.OpenPrice: case Level1Fields.HighPrice: case Level1Fields.LowPrice: case Level1Fields.ClosePrice: case Level1Fields.SettlementPrice: case Level1Fields.VWAP: if (types.Contains(column.Field)) { l1Messages[exchangeId].TryAdd(column.Field, colValue.To <decimal?>()); } break; default: if (types.Contains(column.Field)) { var typedColValue = column.Convert(colValue); if (typedColValue != null) { l1Messages[exchangeId].Add(column.Field, typedColValue); } } break; } } foreach (var l1Msg in l1Messages.Values) { if (l1Msg.Changes.Count <= 0) { continue; } yield return(new SecurityMessage { SecurityId = l1Msg.SecurityId }); if (l1Msg.ServerTime.IsDefault()) { l1Msg.ServerTime = CurrentTime.Convert(TimeHelper.Est); } yield return(l1Msg); } if (!types.Contains(Level1Fields.LastTrade) || !lastTradeDate.HasValue || !lastTradeTime.HasValue || !lastTradeId.HasValue || !lastTradePrice.HasValue || !lastTradeVolume.HasValue) { yield break; } yield return(new ExecutionMessage { SecurityId = l1Messages[tradeBoard.Value].SecurityId, TradeId = lastTradeId.Value, ServerTime = (lastTradeDate.Value + lastTradeTime.Value).ApplyTimeZone(TimeHelper.Est), TradePrice = lastTradePrice.Value, Volume = lastTradeVolume.Value, ExecutionType = ExecutionTypes.Tick, }); }
private void Count() { CurrentTime = CurrentTime.Add(_timeStep); }
private void OnNewSecurity(int row, int rowCount, string smartId, string name, string secCode, string secClass, int decimals, int lotSize, decimal?stepPrice, decimal?priceStep, string isin, string board, DateTime?expiryDate, decimal?daysBeforeExpiry, decimal?strike) { //AMU: заглушка. 11.01.2013 обнаружил, что через SmartCom стали приходить инструменты (класс EQBR и FISS) с пустым secCode - "longName" в понятии АйтиИнвеста if (secCode.IsEmpty()) { secCode = smartId; } var securityId = new SecurityId { SecurityCode = secCode, BoardCode = board, Native = smartId, Isin = isin }; if (secClass.IsEmpty()) { secClass = board; } var secMsg = new SecurityMessage { PriceStep = priceStep, Decimals = decimals, Multiplier = lotSize, Name = name, ShortName = name, ExpiryDate = expiryDate?.ApplyTimeZone(TimeHelper.Moscow), ExtensionInfo = new Dictionary <object, object> { { "Class", secClass } }, OriginalTransactionId = _lookupSecuritiesId }; if (secClass.CompareIgnoreCase("IDX")) { secMsg.SecurityType = SecurityTypes.Index; switch (secMsg.SecurityId.BoardCode) { case "RUSIDX": securityId.BoardCode = secCode.ContainsIgnoreCase("MICEX") || secCode.ContainsIgnoreCase("MCX") ? ExchangeBoard.Micex.Code : ExchangeBoard.Forts.Code; break; //default: // security.Board = ExchangeBoard.Test; // break; } } else { var info = SecurityClassInfo.GetSecurityClassInfo(secClass); secMsg.SecurityType = info.Item1; securityId.BoardCode = info.Item2; // http://stocksharp.com/forum/yaf_postsm16847_Vopros-po-vystavlieniiu-zaiavok.aspx#post16847 if (ExchangeBoard.GetOrCreateBoard(info.Item2).IsMicex && /* проверяем, что не началась ли трансляция правильных дробных шагов */ secMsg.PriceStep != null && secMsg.PriceStep == (int)secMsg.PriceStep) { // http://stocksharp.com/forum/yaf_postsm21245_Sokhranieniie-stakanov-po-GAZP-EQNE.aspx#post21245 secMsg.PriceStep = 1m / 10m.Pow(secMsg.PriceStep.Value); } } secMsg.SecurityId = securityId; if (secMsg.SecurityType == SecurityTypes.Option) { var optionInfo = secMsg.Name.GetOptionInfo(ExchangeBoard.Forts); if (optionInfo != null) { // http://stocksharp.com/forum/yaf_postst1355_Exception-Change-Set-11052.aspx if (!secCode.IsEmpty()) { var futureInfo = optionInfo.UnderlyingSecurityId.GetFutureInfo(secCode, ExchangeBoard.Forts); if (futureInfo != null) { secMsg.UnderlyingSecurityCode = futureInfo.SecurityId.SecurityCode; } } secMsg.ExpiryDate = optionInfo.ExpiryDate; secMsg.OptionType = optionInfo.OptionType; secMsg.Strike = optionInfo.Strike; } } SendOutMessage(secMsg); if (stepPrice != null) { SendOutMessage( new Level1ChangeMessage { SecurityId = securityId, ServerTime = CurrentTime.Convert(TimeHelper.Moscow), } .TryAdd(Level1Fields.StepPrice, stepPrice.Value)); } if ((row + 1) < rowCount) { return; } SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = _lookupSecuritiesId }); _lookupSecuritiesId = 0; }
public override void Update(GameTime gameTime) { if (!isStarted) { return; } // UtilityHelper.ApplyVelocity(ref currentColor, Vector4.Multiply(velocity, Sign), gameTime); Vector4 deltaDistance = graphFunction.ApplyVelocity(CurrentTime, CurrentTime.Add(gameTime.ElapsedGameTime), Duration, totalDistance); CurrentTime = CurrentTime.Add(gameTime.ElapsedGameTime); // if (CurrentTime > Duration) CurrentTime = TimeSpan.Zero; deltaDistance = Vector4.Multiply(deltaDistance, Sign); currentColor = Vector4.Add(currentColor, deltaDistance); currentColor.X = MathHelper.Clamp(currentColor.X, Math.Min(fromColor.X, toColor.X), Math.Max(fromColor.X, toColor.X)); currentColor.Y = MathHelper.Clamp(currentColor.Y, Math.Min(fromColor.Y, toColor.Y), Math.Max(fromColor.Y, toColor.Y)); currentColor.Z = MathHelper.Clamp(currentColor.Z, Math.Min(fromColor.Z, toColor.Z), Math.Max(fromColor.Z, toColor.Z)); currentColor.W = MathHelper.Clamp(currentColor.W, Math.Min(fromColor.W, toColor.W), Math.Max(fromColor.W, toColor.W)); sprite.SetOverlay(currentColor); if (isLoop) { int completed = 0; if (currentColor.X == fromColor.X || currentColor.X == toColor.X) { Sign.X *= -1; completed++; } if (currentColor.Y == fromColor.Y || currentColor.Y == toColor.Y) { Sign.Y *= -1; completed++; } if (currentColor.Z == fromColor.Z || currentColor.Z == toColor.Z) { Sign.Z *= -1; completed++; } if (currentColor.W == fromColor.W || currentColor.W == toColor.W) { Sign.W *= -1; completed++; } if (completed == 4) { CurrentTime = TimeSpan.Zero; } } else { if (currentColor.X == toColor.X && currentColor.Y == toColor.Y && currentColor.Z == toColor.Z && currentColor.W == toColor.W) { if (!isInfinite) { this.Stop(); } return; } } }
void EWrapper.currentTime(long time) { CurrentTime?.Invoke(time); }
private void ProcessSubscriptions() { if (_subscribedLevel1.Count > 0) { var tickerReply = _client.GetTickers(_subscribedLevel1.Cache.Select(id => id.SecurityCode.ToBtceCode())); foreach (var ticker in tickerReply.Items.Values) { var l1Msg = new Level1ChangeMessage { SecurityId = new SecurityId { SecurityCode = ticker.Instrument.ToStockSharpCode(), BoardCode = _boardCode, }, ServerTime = ticker.Timestamp.ApplyTimeZone(TimeHelper.Moscow) } .TryAdd(Level1Fields.Volume, (decimal)ticker.Volume) .TryAdd(Level1Fields.HighPrice, (decimal)ticker.HighPrice) .TryAdd(Level1Fields.LowPrice, (decimal)ticker.LowPrice) .TryAdd(Level1Fields.LastTradePrice, (decimal)ticker.LastPrice) // BTCE транслирует потенциальные цену для покупки и продажи .TryAdd(Level1Fields.BestBidPrice, (decimal)ticker.Ask) .TryAdd(Level1Fields.BestAskPrice, (decimal)ticker.Bid) .TryAdd(Level1Fields.AveragePrice, (decimal)ticker.AveragePrice); if (l1Msg.Changes.Count > 0) { SendOutMessage(l1Msg); } } } if (_subscribedDepths.Count > 0) { foreach (var group in _subscribedDepths.CachedPairs.GroupBy(p => p.Value)) { var depthReply = _client.GetDepths(group.Key, group.Select(p => p.Key).Select(id => id.SecurityCode.ToBtceCode())); foreach (var pair in depthReply.Items) { SendOutMessage(new QuoteChangeMessage { SecurityId = new SecurityId { SecurityCode = pair.Key.ToStockSharpCode(), BoardCode = _boardCode, }, Bids = pair.Value.Bids.Select(vp => vp.ToStockSharp(Sides.Buy)).ToArray(), Asks = pair.Value.Asks.Select(vp => vp.ToStockSharp(Sides.Sell)).ToArray(), ServerTime = CurrentTime.Convert(TimeHelper.Moscow), }); } } } if (_subscribedTicks.Count > 0) { var tradeReply = _client.GetTrades(_tickCount, _subscribedTicks.Cache.Select(id => id.SecurityCode.ToBtceCode())); // меняем на глубину 50 _tickCount = 50; foreach (var pair in tradeReply.Items) { foreach (var trade in pair.Value.OrderBy(t => t.Id)) { if (_lastTickId >= trade.Id) { continue; } _lastTickId = trade.Id; SendOutMessage(new ExecutionMessage { SecurityId = new SecurityId { SecurityCode = pair.Key.ToStockSharpCode(), BoardCode = _boardCode, }, ExecutionType = ExecutionTypes.Tick, TradePrice = (decimal)trade.Price, Volume = (decimal)trade.Volume, TradeId = trade.Id, ServerTime = trade.Timestamp.ApplyTimeZone(TimeHelper.Moscow), OriginSide = trade.Side.ToStockSharp() }); } } } }