IEnumerator StartGame() { int orderCount = (int)PhotonNetwork.CurrentRoom.CustomProperties["LevelRounds"]; while (orderCount > 0) { //shared or individual int targetType = Random.Range(0, 2); //case shared order if (targetType == 0) { List <string> playersInOrder = new List <string>(); for (int i = 0; i < playerNames.Count; i++) { if (Random.Range(0, 2) == 1) { playersInOrder.Add(playerNames[i]); } } if (playersInOrder.Count == 0) { playersInOrder.Add(playerNames[Random.Range(0, playerNames.Count)]); } OrderProperties sharedOrder = orderGenerator.GenerateSharedOrder(playersInOrder); this.photonView.RPC("ReceiveSharedOrder", RpcTarget.AllViaServer, sharedOrder.type, sharedOrder.isSimon, sharedOrder.text, sharedOrder.players.ToArray(), sharedOrder.color, sharedOrder.direction, sharedOrder.word); } //case individual order else { this.photonView.RPC("GenerateIndividualOrder", RpcTarget.AllViaServer); } orderCount--; yield return(new WaitForSecondsRealtime(voiceTime)); while (playersReady < PhotonNetwork.CountOfPlayersInRooms) { yield return(null); } playersReady = 0; } this.photonView.RPC("SendScoreToDatabase", RpcTarget.AllViaServer); yield return(new WaitForSecondsRealtime(5.0f)); PhotonNetwork.LoadLevel("GameLobbyScene"); }
public void GtdSameDayTimeInForceCryptoOrderExpiresAtMidnightUtc() { var utcTime = new DateTime(2018, 4, 27, 10, 0, 0); var security = new Crypto( SecurityExchangeHours.AlwaysOpen(TimeZones.Utc), new Cash(Currencies.USD, 0, 1m), new SubscriptionDataConfig( typeof(QuoteBar), Symbols.BTCUSD, Resolution.Minute, TimeZones.Utc, TimeZones.Utc, true, true, true ), SymbolProperties.GetDefault(Currencies.USD), ErrorCurrencyConverter.Instance, RegisteredSecurityDataTypesProvider.Null ); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.Utc); security.SetLocalTimeKeeper(localTimeKeeper); var timeInForce = TimeInForce.GoodTilDate(new DateTime(2018, 4, 27)); var orderProperties = new OrderProperties { TimeInForce = timeInForce }; var order = new LimitOrder(Symbols.BTCUSD, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); localTimeKeeper.UpdateTime(utcTime.AddHours(14).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); localTimeKeeper.UpdateTime(utcTime.AddHours(14)); Assert.IsTrue(timeInForce.IsOrderExpired(security, order)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); }
public void DayTimeInForceEquityOrderExpiresAtMarketClose() { var utcTime = new DateTime(2018, 4, 27, 10, 0, 0).ConvertToUtc(TimeZones.NewYork); var security = new Equity( SecurityExchangeHoursTests.CreateUsEquitySecurityExchangeHours(), new SubscriptionDataConfig( typeof(TradeBar), Symbols.SPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true ), new Cash(Currencies.USD, 0, 1m), SymbolProperties.GetDefault(Currencies.USD), ErrorCurrencyConverter.Instance, RegisteredSecurityDataTypesProvider.Null ); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.NewYork); security.SetLocalTimeKeeper(localTimeKeeper); var timeInForce = TimeInForce.Day; var orderProperties = new OrderProperties { TimeInForce = timeInForce }; var order = new LimitOrder(Symbols.SPY, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); localTimeKeeper.UpdateTime(utcTime.AddHours(6).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); localTimeKeeper.UpdateTime(utcTime.AddHours(6)); Assert.IsTrue(timeInForce.IsOrderExpired(security, order)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); }
public void loadDataGrid() { foreach (OrderProperties order in _ListOfOrderItinerary) { string[] rows = new string[] { order.Manufacturer_Name, order.Product_Type, order.Product_Name, order.Count.ToString(), order.Price_Per_Unit.ToString(), order.Balance_Amount.ToString(), order.Paid_Amount.ToString(), order.Discount_Rate, order.Order_Status, order.Description, order.OrderDate }; dataGridViewItinerary.Rows.Add(rows); textBoxDate.Text = order.OrderDate.ToUpper(); textBoxOrderId.Text = order.Order_Id.ToUpper(); textBoxVendorId.Text = order.Vendor_Id.ToUpper(); updateOrderProperties = order; } }
protected void ValueOrderPropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList orderPropertyField = (DropDownList)sender; DropDownList itemPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("ValueItemPropertyField"); DropDownList packagePropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("ValuePackagePropertyField"); DropDownList customPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("ValueCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)orderPropertyField.NamingContainer.FindControl("ValueCustomPropertyLabel"); Label multiplierLabel = (Label)orderPropertyField.NamingContainer.FindControl("ValueMultiplierLabel"); HelpLabel valueLabel = (HelpLabel)orderPropertyField.NamingContainer.FindControl("ValueLabel"); TextBox valueField = (TextBox)orderPropertyField.NamingContainer.FindControl("ValueField"); BaseValidator valueRequired = (BaseValidator)orderPropertyField.NamingContainer.FindControl("ValueRequired"); BaseValidator valueNumeric = (BaseValidator)orderPropertyField.NamingContainer.FindControl("ValueNumeric"); OrderProperties orderProperty = (OrderProperties)Enum.Parse(typeof(OrderProperties), orderPropertyField.SelectedValue); ItemProperties itemProperty = (ItemProperties)Enum.Parse(typeof(ItemProperties), itemPropertyField.SelectedValue); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); if (orderProperty == OrderProperties.ItemProperty) { itemPropertyField.Visible = true; packagePropertyField.Visible = false; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, itemProperty); PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, itemProperty); } else if (orderProperty == OrderProperties.PackageProperty) { itemPropertyField.Visible = false; packagePropertyField.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, packageProperty); } else { itemPropertyField.Visible = false; packagePropertyField.Visible = false; customPropertyField.Visible = false; PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, orderProperty); Page.Validate("RuleGroup"); if (Page.IsValid) { PrepareCustomPropertyField(customPropertyLabel, customPropertyField, orderProperty); } } } }
void refreshOrderDetails() { foreach (KeyValuePair <int, OrderProperties> orders in _listOfOrderItems) { OrderProperties orderInCart = orders.Value; _grossPrice = orderInCart.Price_Per_Unit * orderInCart.Count; _discountPrice = (_grossPrice * _discountRate) / 100; _totalPrice = _grossPrice - _discountPrice; _minimumAdvancePayment = (_totalPrice * 70) / 100; textBoxAdvanceAmount.Text = _minimumAdvancePayment.ToString("c"); textBoxDiscountId.Text = _discountPrice.ToString("c"); textBoxTotalPrice.Text = _totalPrice.ToString("c"); textBoxBalanceAmount.Text = (_totalPrice - _minimumAdvancePayment).ToString("c"); } }
private void addToCartDataGrid(OrderProperties orderItems) { try { _itemNo++; string [] cartRow = new string[] { _itemNo.ToString(), orderItems.Order_Id.ToString(), orderItems.Manufacturer_Name, orderItems.Product_Name, orderItems.Product_Type, orderItems.Count.ToString(), orderItems.Price_Per_Unit.ToString("c"), orderItems.Total_Price.ToString("c") }; dataGridViewCart.Rows.Add(cartRow); dataGridViewCart.Columns.Add(_buttonRemoveCartItem); _buttonRemoveCartItem.HeaderText = "REMOVE ITEM"; _buttonRemoveCartItem.Name = "buttonRemoveCartItem"; _buttonRemoveCartItem.Text = "REMOVE"; _buttonRemoveCartItem.UseColumnTextForButtonValue = true; dataGridViewCart.CellClick += new DataGridViewCellEventHandler(dataGridViewCart_CellClick); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public void DeserializesOrderGoodTilDateTimeInForce() { var expiry = new DateTime(2018, 5, 26); var orderProperties = new OrderProperties { TimeInForce = TimeInForce.GoodTilDate(expiry) }; var expected = new MarketOrder(Symbols.BTCUSD, 0.123m, DateTime.Today, "", orderProperties); TestOrderType(expected); var json = JsonConvert.SerializeObject(expected); var actual = DeserializeOrder <MarketOrder>(json); var gtd = (GoodTilDateTimeInForce)actual.Properties.TimeInForce; Assert.AreEqual(expiry, gtd.Expiry); }
protected void MatchOrderPropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList orderPropertyField = (DropDownList)sender; DropDownList itemPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("MatchItemPropertyField"); DropDownList packagePropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("MatchPackagePropertyField"); DropDownList customPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("MatchCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)orderPropertyField.NamingContainer.FindControl("MatchCustomPropertyLabel"); OrderProperties orderProperty = (OrderProperties)Enum.Parse(typeof(OrderProperties), orderPropertyField.SelectedValue); ItemProperties itemProperty = (ItemProperties)Enum.Parse(typeof(ItemProperties), itemPropertyField.SelectedValue); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); if (orderProperty == OrderProperties.ItemProperty) { itemPropertyField.Visible = true; packagePropertyField.Visible = false; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, itemProperty); } else if (orderProperty == OrderProperties.PackageProperty) { itemPropertyField.Visible = false; packagePropertyField.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); } else { itemPropertyField.Visible = false; packagePropertyField.Visible = false; customPropertyField.Visible = false; Page.Validate("RuleGroup"); if (Page.IsValid) { PrepareCustomPropertyField(customPropertyLabel, customPropertyField, orderProperty); } } } }
public void DayTimeInForceForexOrderAfter5PMExpiresAt5PMNextDay() { // set time to 6:00:00 PM (NY time) var utcTime = new DateTime(2018, 4, 25, 18, 0, 0).ConvertToUtc(TimeZones.NewYork); var handler = new DayTimeInForceHandler(); var security = new Forex( SecurityExchangeHoursTests.CreateForexSecurityExchangeHours(), new Cash(CashBook.AccountCurrency, 0, 1m), new SubscriptionDataConfig(typeof(QuoteBar), Symbols.EURUSD, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true), SymbolProperties.GetDefault(CashBook.AccountCurrency)); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.NewYork); security.SetLocalTimeKeeper(localTimeKeeper); var orderProperties = new OrderProperties { TimeInForce = TimeInForce.Day }; var order = new LimitOrder(Symbols.EURUSD, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(handler.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, 0); Assert.IsTrue(handler.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, 0); Assert.IsTrue(handler.IsFillValid(security, order, fill2)); // set time to midnight (NY time) localTimeKeeper.UpdateTime(utcTime.AddHours(6)); Assert.IsFalse(handler.IsOrderExpired(security, order)); // set time to 4:59:59 PM next day (NY time) localTimeKeeper.UpdateTime(utcTime.AddHours(23).AddSeconds(-1)); Assert.IsFalse(handler.IsOrderExpired(security, order)); // set time to 5:00:00 PM next day (NY time) localTimeKeeper.UpdateTime(utcTime.AddHours(23)); Assert.IsTrue(handler.IsOrderExpired(security, order)); Assert.IsTrue(handler.IsFillValid(security, order, fill1)); Assert.IsTrue(handler.IsFillValid(security, order, fill2)); }
internal void UpdateOrderList(OrderProperties orderProperty) { if (OrderPropertyList[0] == orderProperty) { OrderOrderList[0] = !OrderOrderList[0]; } else { int index = OrderPropertyList.IndexOf(orderProperty); if (index != -1) { OrderPropertyList.RemoveAt(index); bool asc = OrderOrderList[index]; OrderOrderList.RemoveAt(index); OrderPropertyList.Insert(0, orderProperty); OrderOrderList.Insert(0, asc); } } }
public OrderProperties GenerateIndividualOrder(string playerName) { OrderProperties order = new OrderProperties(); order.type = Random.Range(0, 2); order.text = string.Empty; order.players = new List <string>(); order.players.Add(playerName); int simonIs = Random.Range(0, 100); if (simonIs <= simonIsChance) { order.text += names[0]; order.isSimon = true; } else { order.text += names[Random.Range(1, names.Count)]; order.isSimon = false; } order.text += " dice: " + playerName + " "; //OrderType = 0 means marker type if (order.type == 0) { order.text += "mueve"; GenerateMarkerOrder(ref order.text, ref order.color, ref order.direction); } //OrderType = 1 means voice type else { order.text += "dí"; GenerateVoiceOrder(ref order.text, ref order.word); } return(order); }
public void DayTimeInForceCryptoOrderExpiresAtMidnight() { var utcTime = new DateTime(2018, 4, 27, 10, 0, 0); var handler = new DayTimeInForceHandler(); var security = new Crypto( SecurityExchangeHours.AlwaysOpen(TimeZones.Utc), new Cash(CashBook.AccountCurrency, 0, 1m), new SubscriptionDataConfig(typeof(QuoteBar), Symbols.BTCUSD, Resolution.Minute, TimeZones.Utc, TimeZones.Utc, true, true, true), SymbolProperties.GetDefault(CashBook.AccountCurrency)); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.Utc); security.SetLocalTimeKeeper(localTimeKeeper); var orderProperties = new OrderProperties { TimeInForce = TimeInForce.Day }; var order = new LimitOrder(Symbols.BTCUSD, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(handler.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, 0); Assert.IsTrue(handler.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, 0); Assert.IsTrue(handler.IsFillValid(security, order, fill2)); localTimeKeeper.UpdateTime(utcTime.AddHours(14).AddSeconds(-1)); Assert.IsFalse(handler.IsOrderExpired(security, order)); localTimeKeeper.UpdateTime(utcTime.AddHours(14)); Assert.IsTrue(handler.IsOrderExpired(security, order)); Assert.IsTrue(handler.IsFillValid(security, order, fill1)); Assert.IsTrue(handler.IsFillValid(security, order, fill2)); }
private void buttonAddToCart_Click(object sender, EventArgs e) { OrderProperties cartItems = new OrderProperties(); try { cartItems.Order_Id = textBoxOrderId.Text; cartItems.OrderDate = BusinessUtlities.getCurrentDateTime; cartItems.Product_Type = comboBoxProductType.SelectedItem.ToString(); cartItems.Manufacturer_Name = comboBoxManufacturer.SelectedItem.ToString(); cartItems.Product_Name = comboBoxProductName.SelectedItem.ToString(); cartItems.Product_Id = textBoxProductId.Text; cartItems.Count = Convert.ToInt16(textBoxCount.Text); cartItems.Price_Per_Unit = Convert.ToDouble(textBoxPricePerUnit.Text); cartItems.Total_Price = cartItems.Count * cartItems.Price_Per_Unit; cartItems.Discount_Rate = textBoxDiscountId.Text; cartItems.User_ID = textBoxUser.Text; cartItems.Vendor_Id = textBoxVendor.Text; if (textBoxDescription.Text.Length > 0) { cartItems.Description = textBoxDescription.Text; } addToCartDataGrid(cartItems); _grossPrice += cartItems.Total_Price; _discountPrice = (_grossPrice * _discountRate) / 100; _totalPrice = _grossPrice - _discountPrice; _minimumAdvancePayment = (_totalPrice * 70) / 100; textBoxAdvanceAmount.Text = _minimumAdvancePayment.ToString("c"); textBoxTotalPrice.Text = _totalPrice.ToString("c"); textBoxDiscountId.Text = _discountPrice.ToString("c"); textBoxBalanceAmount.Text = (_totalPrice - _minimumAdvancePayment).ToString("c"); _listOfOrderItems.Add(_itemCount++, cartItems); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
protected void Rules_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "New") { String id = e.CommandArgument.ToString(); Int32 index = Settings.CostingRules.IndexOf(id); OrderRule rule = new OrderRule(); rule.Matches.Add(new OrderMatch()); Settings.CostingRules.Insert(index, rule); Settings.CostingRules.Save(); Rules.DataBind(); Rules.EditIndex = index; } else if (e.CommandName == "MoveUp") { String id = e.CommandArgument.ToString(); Int32 index = Settings.CostingRules.IndexOf(id); if (index > 0) { OrderRule rule = Settings.CostingRules[index]; Settings.CostingRules.RemoveAt(index); Settings.CostingRules.Insert(index - 1, rule); Settings.CostingRules.Save(); Rules.DataBind(); } } else if (e.CommandName == "MoveDown") { String id = e.CommandArgument.ToString(); Int32 index = Settings.CostingRules.IndexOf(id); if (index < (Settings.CostingRules.Count - 2)) { OrderRule rule = Settings.CostingRules[index]; Settings.CostingRules.RemoveAt(index); Settings.CostingRules.Insert(index + 1, rule); Settings.CostingRules.Save(); Rules.DataBind(); } } else if (e.CommandName == "Update") { if (Page.IsValid) { GridViewRow row = Rules.Rows[Rules.EditIndex]; if (row != null) { OrderMatchList matches = ((BVModules_Shipping_Order_Rules_OrderMatchEditor)row.FindControl("OrderMatchEditor")).GetMatches(); DropDownList orderPropertyList = (DropDownList)row.FindControl("ValueOrderPropertyField"); DropDownList packagePropertyList = (DropDownList)row.FindControl("ValuePackagePropertyField"); OrderProperties orderProperty = (OrderProperties)Enum.Parse(typeof(OrderProperties), orderPropertyList.SelectedValue); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyList.SelectedValue); if (orderProperty == OrderProperties.PackageProperty && packageProperty == PackageProperties.Distance) { if (PostalCode.IsPostalDataInstalled()) { Anthem.Manager.AddScriptForClientSideEval("alert('No postal code data has been installed. The Distance property will always return -1.');"); } } else { foreach (OrderMatch match in matches) { if (match.OrderProperty == OrderProperties.PackageProperty && match.PackageProperty == PackageProperties.Distance) { if (PostalCode.IsPostalDataInstalled()) { Anthem.Manager.AddScriptForClientSideEval("alert('No postal code data has been installed. The Distance property will always return -1.');"); break; } } } } Page.Items["matches"] = matches; } } } else if (e.CommandName == "View") { if (Page.IsValid) { GridViewRow row = Rules.Rows[Rules.EditIndex]; if (row != null) { GridView grid = row.FindControl("SampleShippingCosts") as GridView; if (grid != null) { Int32 count; grid.Visible = true; Session["SampleData"] = GetSampleOrders(row, out count); grid.DataSource = Session["SampleData"]; grid.DataBind(); if (count > grid.PageSize * 5) { grid.Caption = string.Format("{0}+ matching orders", grid.PageSize * 5); } else { grid.Caption = string.Format("{0} matching order", count); if (count == 0 || count > 1) { grid.Caption += "s"; } } } } } } }
private static void PrepareValueField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, OrderProperties property) { PropertyTypes propertyType = OrderPropertiesHelper.GetPropertyType(property); PrepareValueField(multiplier, label, field, requiredValidator, numericValidator, propertyType); }
public GameObject ResolveBoxObject(OrderProperties properties) { return(ResolveBoxObject(properties.rackLetter - rackLabelPrefix, properties.x, properties.y)); }
public bool cancelExistingOrder(OrderProperties cancelOrderProperties) { return(customerOrderDataHandler.cancelOrder(cancelOrderProperties)); }
public void GtdTimeInForceForexOrderBeforeExpiresAt5PMOnExpiryDate() { // set time to 10:00:00 AM (NY time) var utcTime = new DateTime(2018, 4, 27, 10, 0, 0).ConvertToUtc(TimeZones.NewYork); var security = new Forex( SecurityExchangeHoursTests.CreateForexSecurityExchangeHours(), new Cash(Currencies.USD, 0, 1m), new SubscriptionDataConfig( typeof(QuoteBar), Symbols.EURUSD, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true ), SymbolProperties.GetDefault(Currencies.USD), ErrorCurrencyConverter.Instance ); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.NewYork); security.SetLocalTimeKeeper(localTimeKeeper); var timeInForce = TimeInForce.GoodTilDate(new DateTime(2018, 5, 1)); var orderProperties = new OrderProperties { TimeInForce = timeInForce }; var order = new LimitOrder(Symbols.EURUSD, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, OrderFee.Zero); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); // April 27th 4:59:59 PM (NY time) localTimeKeeper.UpdateTime(utcTime.AddHours(7).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // April 27th 5:00:00 PM (NY time) localTimeKeeper.UpdateTime(utcTime.AddHours(7)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st at 10 AM localTimeKeeper.UpdateTime(utcTime.AddDays(4)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st 4:59:59 PM (NY time) localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(7).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st 5:00:00 PM (NY time) localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(7)); Assert.IsTrue(timeInForce.IsOrderExpired(security, order)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); }
public string ResolveItemName(OrderProperties properties) { return(ResolveItemName(properties.rackLetter - rackLabelPrefix, properties.x, properties.y)); }
public bool updateOrderStatus(OrderProperties orderStatusUpdate) { OrderDBProcessHandler updateOrder = new OrderDBProcessHandler(); return(updateOrder.updateOrderStatus(orderStatusUpdate)); }
public OrderProperties GenerateSharedOrder(List <string> playerNames) { OrderProperties order = new OrderProperties(); order.type = Random.Range(0, 2); order.text = string.Empty; int simonIs = Random.Range(0, 100); if (simonIs <= simonIsChance) { order.text += names[0]; order.isSimon = true; } else { order.text += names[Random.Range(1, names.Count)]; order.isSimon = false; } order.text += " dice: "; order.players = playerNames; if (playerNames.Count == 1) { order.text += playerNames[0] + " "; } else if (playerNames.Count == 2) { order.text += playerNames[0] + " y " + playerNames[1] + ", "; } else { order.text += "Todos "; } //OrderType = 0 means marker type if (order.type == 0) { //Generate marker order if (playerNames.Count > 1) { order.text += "muevan"; } else { order.text += "mueve"; } GenerateMarkerOrder(ref order.text, ref order.color, ref order.direction); } //OrderType = 1 means voice type else { //Generate voice order if (playerNames.Count > 1) { order.text += "digan"; } else { order.text += "dí"; } GenerateVoiceOrder(ref order.text, ref order.word); } return(order); }
/// <summary> /// Updates the order lists. If the order-property is already the first item, the order is reversed. /// </summary> /// <param name="exportTime"></param> private void UpdateOrderLists(OrderProperties orderProperty) { eccComparer.UpdateOrderList(orderProperty); OrderList(); }
public static OrderProperties CreateOrderProperties(int ID, int counslersAmount, int price, string activityDuration, byte[] rowVersion, int orderPropertiesWrapper_OrderProperties) { OrderProperties orderProperties = new OrderProperties(); orderProperties.Id = ID; orderProperties.CounslersAmount = counslersAmount; orderProperties.Price = price; orderProperties.ActivityDuration = activityDuration; orderProperties.RowVersion = rowVersion; orderProperties.OrderPropertiesWrapper_OrderProperties = orderPropertiesWrapper_OrderProperties; return orderProperties; }
public void GtdTimeInForceCryptoOrderExpiresAtMidnightUtcAfterExpiryDate() { var utcTime = new DateTime(2018, 4, 27, 10, 0, 0); var security = new Crypto( SecurityExchangeHours.AlwaysOpen(TimeZones.Utc), new Cash(CashBook.AccountCurrency, 0, 1m), new SubscriptionDataConfig( typeof(QuoteBar), Symbols.BTCUSD, Resolution.Minute, TimeZones.Utc, TimeZones.Utc, true, true, true ), SymbolProperties.GetDefault(CashBook.AccountCurrency), ErrorCurrencyConverter.Instance ); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.Utc); security.SetLocalTimeKeeper(localTimeKeeper); var timeInForce = TimeInForce.GoodTilDate(new DateTime(2018, 5, 1)); var orderProperties = new OrderProperties { TimeInForce = timeInForce }; var order = new LimitOrder(Symbols.BTCUSD, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, 0); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, 0); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); // April 27th before midnight localTimeKeeper.UpdateTime(utcTime.AddHours(14).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // April 28th at midnight localTimeKeeper.UpdateTime(utcTime.AddHours(14)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st at 10 AM localTimeKeeper.UpdateTime(utcTime.AddDays(4)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st before midnight localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(14).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 2nd at midnight localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(14)); Assert.IsTrue(timeInForce.IsOrderExpired(security, order)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); }
public void AddToOrderProperties(OrderProperties orderProperties) { base.AddObject("OrderProperties", orderProperties); }
private int CompareByProperty(ExportedCreatureControl a, ExportedCreatureControl b, OrderProperties property, bool ascending) { int result = 0; switch (property) { case OrderProperties.ExportTime: result = DateTime.Compare(a.creatureValues.domesticatedAt ?? new DateTime(2000, 1, 1), b.creatureValues.domesticatedAt ?? new DateTime(2000, 1, 1)); break; case OrderProperties.CreatureName: result = string.Compare(a.creatureValues.name, b.creatureValues.name); break; case OrderProperties.Species: result = string.Compare(a.creatureValues.speciesName, b.creatureValues.speciesName); break; case OrderProperties.OwnerName: result = string.Compare(a.creatureValues.owner, b.creatureValues.owner); break; case OrderProperties.ImportStatus: result = (int)a.Status - (int)b.Status; break; } if (!ascending) { return(-result); } return(result); }
private void PrepareCustomPropertyField(WebControl label, ListControl list, OrderProperties property) { list.Items.Clear(); if (property == OrderProperties.BillingAddress || property == OrderProperties.ShippingAddress) { label.ToolTip = "<p>Select the address property to use.</p>"; list.Items.AddRange(GetAddressProperties()); list.Visible = true; } else if (property == OrderProperties.Customer) { label.ToolTip = "<p>Select the customer property to use.</p>"; list.Items.AddRange(GetCustomerProperties()); list.Visible = true; } else if (property == OrderProperties.UseMethod) { label.ToolTip = "<p>Select the shipping method to use.</p>"; list.Items.AddRange(GetShippingMethods()); list.Visible = true; } else { label.ToolTip = ""; list.Items.Add(new ListItem("n/a", "")); list.Visible = false; } }
public void GtdTimeInForceEquityOrderExpiresAtMarketCloseOnExpiryDate() { var utcTime = new DateTime(2018, 4, 27, 10, 0, 0).ConvertToUtc(TimeZones.NewYork); var security = new Equity( SecurityExchangeHoursTests.CreateUsEquitySecurityExchangeHours(), new SubscriptionDataConfig( typeof(TradeBar), Symbols.SPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true ), new Cash(CashBook.AccountCurrency, 0, 1m), SymbolProperties.GetDefault(CashBook.AccountCurrency), ErrorCurrencyConverter.Instance ); var localTimeKeeper = new LocalTimeKeeper(utcTime, TimeZones.NewYork); security.SetLocalTimeKeeper(localTimeKeeper); var timeInForce = TimeInForce.GoodTilDate(new DateTime(2018, 5, 1)); var orderProperties = new OrderProperties { TimeInForce = timeInForce }; var order = new LimitOrder(Symbols.SPY, 10, 100, utcTime, "", orderProperties); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); var fill1 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.PartiallyFilled, OrderDirection.Buy, order.LimitPrice, 3, 0); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); var fill2 = new OrderEvent(order.Id, order.Symbol, utcTime, OrderStatus.Filled, OrderDirection.Buy, order.LimitPrice, 7, 0); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); // April 27th before market close localTimeKeeper.UpdateTime(utcTime.AddHours(6).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // April 27th at market close localTimeKeeper.UpdateTime(utcTime.AddHours(6)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st at 10 AM localTimeKeeper.UpdateTime(utcTime.AddDays(4)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st before market close localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(6).AddSeconds(-1)); Assert.IsFalse(timeInForce.IsOrderExpired(security, order)); // May 1st at market close localTimeKeeper.UpdateTime(utcTime.AddDays(4).AddHours(6)); Assert.IsTrue(timeInForce.IsOrderExpired(security, order)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill1)); Assert.IsTrue(timeInForce.IsFillValid(security, order, fill2)); }