public void setUp() { system = new TradingSystem(null, null); user = new User(1, "user", "1234", false, false); store = new Store(1, "store"); product = new Product(1, "product", null, null, -1); }
public void setUp() { system = new TradingSystem(null, null); user = new User(1, "user", "1234", false, true); store = new Store(1, "store"); manager = new Manager(store, user, new List <int>()); }
public LeagueYearParameters(Guid leagueID, int year, int standardGames, int gamesToDraft, int counterPicks, int counterPicksToDraft, int freeDroppableGames, int willNotReleaseDroppableGames, int willReleaseDroppableGames, bool dropOnlyDraftGames, bool counterPicksBlockDrops, int minimumBidAmount, IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots, DraftSystem draftSystem, PickupSystem pickupSystem, ScoringSystem scoringSystem, TradingSystem tradingSystem, TiebreakSystem tiebreakSystem, AnnualDate counterPickDeadline) { LeagueID = leagueID; Year = year; StandardGames = standardGames; GamesToDraft = gamesToDraft; CounterPicks = counterPicks; CounterPicksToDraft = counterPicksToDraft; FreeDroppableGames = freeDroppableGames; WillNotReleaseDroppableGames = willNotReleaseDroppableGames; WillReleaseDroppableGames = willReleaseDroppableGames; DropOnlyDraftGames = dropOnlyDraftGames; CounterPicksBlockDrops = counterPicksBlockDrops; MinimumBidAmount = minimumBidAmount; LeagueTags = leagueTags.ToList(); SpecialGameSlots = specialGameSlots.ToList(); DraftSystem = draftSystem; PickupSystem = pickupSystem; ScoringSystem = scoringSystem; TradingSystem = tradingSystem; TiebreakSystem = tiebreakSystem; CounterPickDeadline = counterPickDeadline; }
public LeagueOptions(int standardGames, int gamesToDraft, int counterPicks, int counterPicksToDraft, int freeDroppableGames, int willNotReleaseDroppableGames, int willReleaseDroppableGames, bool dropOnlyDraftGames, bool counterPicksBlockDrops, int minimumBidAmount, IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots, DraftSystem draftSystem, PickupSystem pickupSystem, ScoringSystem scoringSystem, TradingSystem tradingSystem, TiebreakSystem tiebreakSystem, AnnualDate counterPickDeadline) { StandardGames = standardGames; GamesToDraft = gamesToDraft; CounterPicks = counterPicks; CounterPicksToDraft = counterPicksToDraft; FreeDroppableGames = freeDroppableGames; WillNotReleaseDroppableGames = willNotReleaseDroppableGames; WillReleaseDroppableGames = willReleaseDroppableGames; DropOnlyDraftGames = dropOnlyDraftGames; CounterPicksBlockDrops = counterPicksBlockDrops; MinimumBidAmount = minimumBidAmount; LeagueTags = leagueTags.ToList(); SpecialGameSlots = specialGameSlots.OrderBy(x => x.SpecialSlotPosition).ToList(); DraftSystem = draftSystem; PickupSystem = pickupSystem; ScoringSystem = scoringSystem; TradingSystem = tradingSystem; TiebreakSystem = tiebreakSystem; CounterPickDeadline = counterPickDeadline; _specialSlotDictionary = SpecialGameSlots.ToDictionary(specialGameSlot => StandardGames - SpecialGameSlots.Count + specialGameSlot.SpecialSlotPosition); }
public void setUp() { discountPolicies = new List <DiscountPolicy>(); purchasePolicies = new List <PurchasePolicy>(); user = new User(1, "aviv", "123", false, false); store = new Store(0, "blabla"); Owner owner = new Owner(store, user); store.Roles.AddChild(owner); basket_user = user.Basket; admin = new User(0, "admin", "1234", true, false); basket_user = user.Basket; p1 = new Product(0, "first", "cat", "key", 80); p2 = new Product(1, "second", null, "", 3000); p3 = new Product(2, "third", null, "", 2000); p4 = new Product(3, "fourth", null, "", 5000); pis1 = new ProductInStore(10000000, store, p1); pis2 = new ProductInStore(10000000, store, p2); pis3 = new ProductInStore(10000000, store, p3); pis4 = new ProductInStore(10000000, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); sys = new TradingSystem(null, null); sys.StoreCounter = 1; sys.ProductCounter = 4; sys.UserCounter = 2; sys.Stores.Add(store.Id, store); sys.Users.Add(admin.Id, admin); sys.Users.Add(user.Id, user); }
public void setUp() { system = new TradingSystem(null, null); ownerUser = new User(1234, "Seifan", "2457", false, false); ownerUser.register(ownerUser.UserName, ownerUser.Password); ownerUser.signIn(ownerUser.UserName, ownerUser.Password); store = new Store(1111, "adidas"); ownerRole = new Owner(store, ownerUser); ownerUser.Roles.Add(store.Id, ownerRole); managerUser = new User(7878, "baba", "3434", false, false); managerUser.register(managerUser.UserName, managerUser.Password); permissions = new List <int>(); permissions.Add(2); user1 = new User(2456, "luli", "5656", false, false); store.Roles = new TreeNode <Role>(ownerRole); store.RolesDictionary.Add(ownerUser.Id, new TreeNode <Role>(ownerRole)); system.Users.Add(ownerUser.Id, ownerUser); system.Users.Add(managerUser.Id, managerUser); system.Users.Add(user1.Id, user1); system.Stores.Add(store.Id, store); }
public void setUp() { admin = new User(0, "admin", "123456", true, true); basket_admin = admin.Basket; user = new User(1, null, null, false, false); basket_user = user.Basket; store = new Store(-1, "store", 0, null, null); p1 = new Product(0, "first", "", "", 5000); p2 = new Product(1, "second", "", "", 5000); p3 = new Product(2, "third", "", "", 5000); p4 = new Product(3, "fourth", "", "", 5000); pis1 = new ProductInStore(10000000, store, p1); pis2 = new ProductInStore(10000000, store, p2); pis3 = new ProductInStore(10000000, store, p3); pis4 = new ProductInStore(10000000, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); sys = new TradingSystem(null, null); sys.StoreCounter = 1; sys.ProductCounter = 4; sys.UserCounter = 2; sys.Stores.Add(store.Id, store); sys.Users.Add(admin.Id, admin); sys.Users.Add(user.Id, user); }
private static void Main(string[] args) { var shares = 0; var tradeType = TradeType.Buy; do { var console = string.Empty; while (string.IsNullOrEmpty(console)) { Console.WriteLine("Enter Ticker Symbol, Number of Shares to Trade, and Trade TradeType (B/S)"); Console.WriteLine("Example: HP,200,S [Enter Q to quit]"); Console.Write("Enter Trade: "); console = Console.ReadLine(); } //TODO, put in validation for input //Strip out the white spaces console = Regex.Replace(console, @"\s+", ""); if (console.ToLower().Equals("q")) { break; } var tradeInfo = console.Split(','); var ticker = tradeInfo[0]; int i; if (int.TryParse(tradeInfo[1], out i)) { shares = i; } if (tradeInfo[2].ToLower().Equals("b")) { tradeType = TradeType.Buy; } else if (tradeInfo[2].ToLower().Equals("s")) { tradeType = TradeType.Sell; } Console.WriteLine("I will now try to {0} {1} shares of {2}", tradeType, shares, ticker); //Call the static object, Trading System. TradingSystem will return the response //message of the Trade. Trade responseTradeMessage = TradingSystem.Trade(ticker, shares, tradeType); Console.WriteLine("The following is the result of your trade:\n"); //Convert the response Trade message into a JSON string and show it var startColor = Console.ForegroundColor; //Make the console text RED upon failure if (responseTradeMessage.TradeStatus.Equals(TradeStatus.Fail)) { Console.ForegroundColor = ConsoleColor.Red; } Console.WriteLine(JsonConvert.SerializeObject(responseTradeMessage, Newtonsoft.Json.Formatting.Indented)); Console.ForegroundColor = startColor; } while (true); }
public void setUp() { DBtransactions db = DBtransactions.getInstance(true); system = new TradingSystem(null, null); user1 = new User(4567, "Yuval", "3399", false, false); system.Users.Add(user1.Id, user1); }
public void setUp() { DBtransactions db = DBtransactions.getInstance(true); system = new TradingSystem(null, null); user1 = new User(1234, "Seifan", null, false, false); system.Users.Add(user1.Id, user1); }
public void setUp() { admin = new User(0, "admin", "123456", true, true); basket_admin = admin.Basket; user = new User(1, null, null, false, false); basket_user = user.Basket; store = new Store(-1, "store"); p1 = new Product(0, "first", "", "", 5000); p2 = new Product(1, "second", "", "", 5000); p3 = new Product(2, "third", "", "", 5000); p4 = new Product(3, "fourth", "", "", 5000); pis1 = new ProductInStore(10000000, store, p1); pis2 = new ProductInStore(10000000, store, p2); pis3 = new ProductInStore(10000000, store, p3); pis4 = new ProductInStore(10000000, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); sys = new TradingSystem(null, null); sys.StoreCounter = 1; sys.ProductCounter = 4; sys.UserCounter = 2; sys.Stores.Add(store.Id, store); sys.Users.Add(admin.Id, admin); sys.Users.Add(user.Id, user); Dictionary <int, KeyValuePair <ProductInStore, int> > discountProduct = new Dictionary <int, KeyValuePair <ProductInStore, int> >(); discountProduct.Add(p1.Id, new KeyValuePair <ProductInStore, int>(pis1, 0)); rd_min = new RevealedDiscount(sys.DiscountPolicyCounter++, 0.2, discountProduct, new DateTime(2222, 1, 1), DuplicatePolicy.WithMultiplication); rd_mid = new RevealedDiscount(sys.DiscountPolicyCounter++, 0.25, discountProduct, new DateTime(2222, 1, 1), DuplicatePolicy.WithMultiplication); rd_max = new RevealedDiscount(sys.DiscountPolicyCounter++, 0.3, discountProduct, new DateTime(2222, 1, 1), DuplicatePolicy.WithMultiplication); rd_mid_without = new RevealedDiscount(sys.DiscountPolicyCounter++, 0.35, discountProduct, new DateTime(2222, 1, 1), DuplicatePolicy.WithoutMultiplication); rd_max_without = new RevealedDiscount(sys.DiscountPolicyCounter++, 1, discountProduct, new DateTime(2222, 1, 1), DuplicatePolicy.WithoutMultiplication); Dictionary <int, KeyValuePair <ProductInStore, int> > relatedProduct = new Dictionary <int, KeyValuePair <ProductInStore, int> >(); relatedProduct.Add(p1.Id, new KeyValuePair <ProductInStore, int>(pis1, 2)); lc1 = new LeafCondition(relatedProduct, 0, 0, null, new DateTime(), DuplicatePolicy.WithMultiplication); relatedProduct = new Dictionary <int, KeyValuePair <ProductInStore, int> >(); relatedProduct.Add(p1.Id, new KeyValuePair <ProductInStore, int>(pis2, 1)); lc2 = new LeafCondition(relatedProduct, 0, 0, null, new DateTime(), DuplicatePolicy.WithMultiplication); Dictionary <int, ProductInStore> ProductPrecentage = new Dictionary <int, ProductInStore>(); ProductPrecentage.Add(pis1.Product.Id, pis1); ProductPrecentage.Add(pis2.Product.Id, pis2); lc = new LogicalCondition(0, 0.5, ProductPrecentage, new DateTime(2222, 1, 1), DuplicatePolicy.WithMultiplication, LogicalConnections.and); lc.addChild(0, lc1); lc.addChild(1, lc2); }
public void setup() { DBtransactions db = DBtransactions.getInstance(true); system = new TradingSystem(null, null); user = new User(1, "user", "1234", false, false); store = new Store(1, "store"); product = new Product(1, "product", null, null, -1); }
public void setUp() { system = new TradingSystem(null, null); owner = new User(202511098, "Amit", "!#2ps4R", false, true); ownerWannaBe = new User(209344320, "Shahaf", "poQ#40~", false, true); user = new User(200981476, "Guy", "@1359pOl", false, false); system.Users.Add(owner.Id, owner); system.Users.Add(ownerWannaBe.Id, ownerWannaBe); system.Users.Add(user.Id, user); }
public void setUp() { system = new TradingSystem(null, null); admin = new User(201499712, "ShakedFerera", "384!@wsaQ", true, false); notAdmin = new User(201453992, "Lidoy", "21~U78op", false, false); toRemove = new User(203444912, "Astma", "46uW@1", false, false); system.Users.Add(admin.Id, admin); system.Users.Add(notAdmin.Id, notAdmin); system.Users.Add(toRemove.Id, toRemove); }
public void TestMethod_initsystem() { Setup(); db.OpenStoreDB(store, this.adminOwner); TradingSystem sysTest = new TradingSystem(null, null); db.initSystem(sysTest); Assert.AreEqual(true, sysTest.Stores.ContainsKey(store.Id)); }
private void TradingDecision(bool aiIsTrader) { //goes back if AI has made enough offers this turn if (aiIsTrader && offers >= MAX_OFFERS_PER_TURN) { Click(TradingSystem.Back); } //AI will accept the trade if it gains more than it loses uint aiVal = TradingVal(aiIsTrader); uint otherVal = TradingVal(!aiIsTrader); if (otherVal > aiVal) { Click(TradingSystem.Accept); return; } //add other's properties to increase value gained by AI foreach (Property property in NotOffered(!aiIsTrader)) { TradingSystem.ToggleCardInOffer(property); otherVal = TradingSystem.GetTradingValue(Offered(!aiIsTrader)); if (otherVal >= aiVal) { Click(TradingSystem.Offer); offers++; return; } } //get ai cards currently on offer - we will modify the list in trading system while looping through it so //we need a clone List <Property> aiOfferClone = new List <Property>(); foreach (Property property in Offered(aiIsTrader)) { aiOfferClone.Add(property); } //if AI still does not gain enough it removes its properties from trade until it gains enough if (aiVal >= otherVal) { foreach (Property property in aiOfferClone) { TradingSystem.ToggleCardInOffer(property); aiVal = TradingSystem.GetTradingValue(Offered(aiIsTrader)); if (aiVal <= otherVal) { Click(TradingSystem.Offer); offers++; return; } } } }
public void TestMethod_signIn() { Setup(); db.registerNewUserDB(admin); store.Roles = new TreeNode <Role>(new Role(store, admin)); store.RolesDictionary = new Dictionary <int, TreeNode <Role> >(); TradingSystem sysTest = new TradingSystem(null, null); sysTest.Stores.Add(store.Id, store); db.signIn(admin.Id, sysTest); Assert.AreEqual(true, sysTest.Users.ContainsKey(admin.Id)); }
private ServiceLayer() { system = new TradingSystem(new ProductSupplySystemImpl(), new FinancialSystemImpl()); users = new Dictionary <String, int>(); stores = new Dictionary <String, int>(); permissions = new Dictionary <String, int>(); storeCounter = 0; userCounter = 0; manager.init(); addPermissions(); //setUp(); }
public void setUp() { admin = new User(0, "admin", "123456", true, true); admin.State = state.signedIn; basket_admin = admin.Basket; user = new User(1, null, null, false, false); basket_user = user.Basket; manager = new User(2, "manager", "1234", false, true); store = new Store(-1, "store"); Owner storeOwner = new Owner(store, admin); Manager storeManager = new Manager(store, manager, new List <int>()); admin.Roles.Add(store.Id, storeOwner); manager.Roles.Add(store.Id, storeManager); store.Roles = new TreeNode <Role>(storeOwner); TreeNode <Role> ownerNode = new TreeNode <Role>(storeOwner); TreeNode <Role> managerNode = ownerNode.AddChild(storeManager); store.RolesDictionary.Add(admin.Id, ownerNode); store.Roles.AddChild(storeManager); store.RolesDictionary.Add(manager.Id, managerNode); p1 = new Product(0, "first", null, "", 5000); p2 = new Product(1, "second", null, "", 5000); p3 = new Product(2, "third", null, "", 5000); p4 = new Product(3, "fourth", null, "", 5000); pis1 = new ProductInStore(10000000, store, p1); pis2 = new ProductInStore(10000000, store, p2); pis3 = new ProductInStore(10000000, store, p3); pis4 = new ProductInStore(10000000, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); sys = new TradingSystem(null, null); sys.StoreCounter = 1; sys.ProductCounter = 4; sys.UserCounter = 2; sys.Stores.Add(store.Id, store); sys.Users.Add(admin.Id, admin); sys.Users.Add(user.Id, user); sys.Users.Add(manager.Id, manager); }
public LeagueYear ToDomain(League league, SupportedYear year, IEnumerable <EligibilityOverride> eligibilityOverrides, IEnumerable <TagOverride> tagOverrides, IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots, FantasyCriticUser?winningUser, IEnumerable <Publisher> publishersInLeague) { DraftSystem draftSystem = Lib.Enums.DraftSystem.FromValue(DraftSystem); PickupSystem pickupSystem = Lib.Enums.PickupSystem.FromValue(PickupSystem); TradingSystem tradingSystem = Lib.Enums.TradingSystem.FromValue(TradingSystem); TiebreakSystem tiebreakSystem = Lib.Enums.TiebreakSystem.FromValue(TiebreakSystem); ScoringSystem scoringSystem = Lib.Domain.ScoringSystems.ScoringSystem.GetScoringSystem(ScoringSystem); AnnualDate counterPickDeadline = new AnnualDate(CounterPickDeadlineMonth, CounterPickDeadlineDay); LeagueOptions options = new LeagueOptions(StandardGames, GamesToDraft, CounterPicks, CounterPicksToDraft, FreeDroppableGames, WillNotReleaseDroppableGames, WillReleaseDroppableGames, DropOnlyDraftGames, CounterPicksBlockDrops, MinimumBidAmount, leagueTags, specialGameSlots, draftSystem, pickupSystem, scoringSystem, tradingSystem, tiebreakSystem, counterPickDeadline); return(new LeagueYear(league, year, options, Lib.Enums.PlayStatus.FromValue(PlayStatus), eligibilityOverrides, tagOverrides, DraftStartedTimestamp, winningUser, publishersInLeague)); }
public void setUp() { store = new Store(1111, "adidas"); logic = DuplicatePolicy.WithMultiplication; admin = new User(0, "admin", "1234", true, true); basket_admin = admin.Basket; user = new User(3434, "luli", "1111", false, true); ownerUser = new User(1234, "Seifan", "2457", false, false); ownerUser.register(ownerUser.UserName, ownerUser.Password); ownerUser.signIn(ownerUser.UserName, ownerUser.Password); ownerRole = new Owner(store, ownerUser); ownerUser.Roles.Add(store.Id, ownerRole); p1 = new Product(0, "first", "", "", 100); p2 = new Product(1, "second", "", "", 50); p3 = new Product(2, "third", "", "", 200); p4 = new Product(3, "fourth", "", "", 300); pis1 = new ProductInStore(20, store, p1); pis2 = new ProductInStore(20, store, p2); pis3 = new ProductInStore(20, store, p3); pis4 = new ProductInStore(20, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); products = new List <KeyValuePair <String, int> >(); products.Add(new KeyValuePair <String, int>("first", 2)); products.Add(new KeyValuePair <String, int>("second", 10)); products.Add(new KeyValuePair <String, int>("third", 5)); products.Add(new KeyValuePair <String, int>("fourth", 4)); system = new TradingSystem(null, null); system.Stores.Add(store.Id, store); system.Users.Add(admin.Id, admin); system.Users.Add(ownerUser.Id, ownerUser); system.Users.Add(user.Id, user); discountId = system.addRevealedDiscountPolicy(products, 20, ownerUser.Id, store.Id, 60, 0); }
public void setUp() { store = new Store(1111, "adidas"); admin = new User(0, "admin", "1234", true, true); basket_admin = admin.Basket; ownerUser = new User(1234, "Seifan", "2457", false, false); ownerUser.register(ownerUser.UserName, ownerUser.Password); ownerUser.signIn(ownerUser.UserName, ownerUser.Password); ownerRole = new Owner(store, ownerUser); ownerUser.Roles.Add(store.Id, ownerRole); p1 = new Product(0, "first", "", "", 100); p2 = new Product(1, "second", "", "", 50); p3 = new Product(2, "third", "", "", 200); p4 = new Product(3, "fourth", "", "", 300); pis1 = new ProductInStore(20, store, p1); pis2 = new ProductInStore(20, store, p2); pis3 = new ProductInStore(20, store, p3); pis4 = new ProductInStore(20, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); products = new List <string>(); products.Add("first"); products.Add("second"); products.Add("third"); products.Add("fourth"); system = new TradingSystem(null, null); system.Stores.Add(store.Id, store); system.Users.Add(admin.Id, admin); system.Users.Add(ownerUser.Id, ownerUser); logic = LogicalConnections.and; duplicate = DuplicatePolicy.WithMultiplication; date1 = new DateTime(2019, 10, 1); lc = new LogicalCondition(0, 0.5, null, new DateTime(2222, 1, 1), DuplicatePolicy.WithMultiplication, LogicalConnections.and); }
//mortgage public override void ClickUI() { base.ClickUI(); if (!MenuManager.TradingMode) { Street street = property.GetComponent <Street>(); if (!MenuManager.BuildHouseMode) { if (property.CanMortagage()) { property.Mortgage(); } else if (street != null && street.CanSellHouse()) { street.SellHouse(); } //can only unmortgage if player does not need to pay anything else if (property.Mortgaged && MenuManager.PaymentOptions.enabled == false) { property.UnMortgage(); } } else if (MenuManager.BuildHouseMode) { if (street != null) { street.BuildHouse(); } } return; } //check if AI is currently trading, and disable clicking if it is if ((TradingSystem.CounterOfferInProgress && TradingSystem.Tradee.gameObject.GetComponent <AI>() != null) || (!TradingSystem.CounterOfferInProgress && GameManager.CurrentPlayer.gameObject.GetComponent <AI>() != null)) { return; } TradingSystem.ToggleCardInOffer(property); }
public void setUp() { system = new TradingSystem(null, null); store = new Store(2, "ZARA"); owner = new User(205600191, "Rotem", "r455!2@", false, false); owner.State = state.signedIn; ownerRole = new Owner(store, owner); owner.Roles.Add(owner.Id, ownerRole); store.Roles = new TreeNode <Role>(ownerRole); store.RolesDictionary.Add(owner.Id, new TreeNode <Role>(ownerRole)); assigned = new User(301600802, "Hen", "!235yZ", false, false); manager = new User(205667112, "Shir", "!223@lSa", false, false); managerRole = new Manager(store, manager, new List <int>()); manager.Roles.Add(manager.Id, managerRole); store.Roles = new TreeNode <Role>(managerRole); store.RolesDictionary.Add(manager.Id, new TreeNode <Role>(managerRole)); system.Users.Add(owner.Id, owner); system.Users.Add(manager.Id, manager); system.Users.Add(assigned.Id, assigned); system.Stores.Add(store.Id, store); }
public void setUp() { store = new Store(1111, "adidas"); admin = new User(0, "admin", "1234", true, true); basket_admin = admin.Basket; ownerUser = new User(1234, "Seifan", "2457", false, false); ownerUser.register(ownerUser.UserName, ownerUser.Password); ownerUser.signIn(ownerUser.UserName, ownerUser.Password); ownerRole = new Owner(store, ownerUser); ownerUser.Roles.Add(store.Id, ownerRole); p1 = new Product(0, "first", "", "", 100); p2 = new Product(1, "second", "", "", 50); p3 = new Product(2, "third", "", "", 200); p4 = new Product(3, "fourth", "", "", 300); pis1 = new ProductInStore(20, store, p1); pis2 = new ProductInStore(20, store, p2); pis3 = new ProductInStore(20, store, p3); pis4 = new ProductInStore(20, store, p4); store.Products.Add(p1.Id, pis1); store.Products.Add(p2.Id, pis2); store.Products.Add(p3.Id, pis3); store.Products.Add(p4.Id, pis4); products = new Dictionary <int, KeyValuePair <ProductInStore, int> >(); products.Add(p1.Id, new KeyValuePair <ProductInStore, int>(pis1, 2)); products.Add(p2.Id, new KeyValuePair <ProductInStore, int>(pis1, 10)); products.Add(p3.Id, new KeyValuePair <ProductInStore, int>(pis1, 5)); products.Add(p4.Id, new KeyValuePair <ProductInStore, int>(pis1, 4)); pcp = new ProductConditionPolicy(0, 1, 0, 10, LogicalConnections.and); store.PurchasePolicy.Add(pcp); system = new TradingSystem(null, null); system.Stores.Add(store.Id, store); system.Users.Add(admin.Id, admin); system.Users.Add(ownerUser.Id, ownerUser); }
public void setUp() { system = new TradingSystem(null, null); store = new Store(2, "ZARA"); owner = new User(205600191, "Rotem", "r455!2@", false, false); owner.State = state.signedIn; ownerRole = new Owner(store, owner); owner.Roles.Add(owner.Id, ownerRole); store.Roles = new TreeNode <Role>(ownerRole); store.RolesDictionary.Add(owner.Id, new TreeNode <Role>(ownerRole)); manager = new User(203114469, "Noy", "!(ftR6", false, false); List <int> permissions = new List <int>(); permissions.Add(2); permissions.Add(4); permissions.Add(5); permissions.Add(6); managerRole = new Manager(store, manager, permissions); manager.Roles.Add(manager.Id, managerRole); store.Roles.AddChild(managerRole); store.RolesDictionary.Add(manager.Id, new TreeNode <Role>(managerRole)); user = new User(201119304, "Keren", "@rtY89", false, false); List <int> invalidPremissions = new List <int>(); invalidPremissions.Add(1); notPremittedManager = new User(202445691, "Adi", "*&112rY", false, false); notPremittedManagerRole = new Manager(store, notPremittedManager, invalidPremissions); notPremittedManager.Roles.Add(notPremittedManager.Id, notPremittedManagerRole); store.Roles.AddChild(notPremittedManagerRole); store.RolesDictionary.Add(notPremittedManager.Id, new TreeNode <Role>(notPremittedManagerRole)); p = new Product(2, "Skinny jeans", "Trouses", "Gray", 159); pis = new ProductInStore(30, store, p); store.Products.Add(p.Id, pis); system.Stores.Add(store.Id, store); system.Users.Add(owner.Id, owner); system.Users.Add(manager.Id, manager); system.Users.Add(notPremittedManager.Id, notPremittedManager); system.Users.Add(user.Id, user); }
public LeagueYearParameters ToDomain(IReadOnlyDictionary <string, MasterGameTag> tagDictionary) { DraftSystem draftSystem = Lib.Enums.DraftSystem.FromValue(DraftSystem); PickupSystem pickupSystem = Lib.Enums.PickupSystem.FromValue(PickupSystem); TradingSystem tradingSystem = Lib.Enums.TradingSystem.FromValue(TradingSystem); TiebreakSystem tiebreakSystem = Lib.Enums.TiebreakSystem.FromValue(TiebreakSystem); ScoringSystem scoringSystem = Lib.Domain.ScoringSystems.ScoringSystem.GetScoringSystem(ScoringSystem); int freeDroppableGames = FreeDroppableGames; if (UnlimitedFreeDroppableGames) { freeDroppableGames = -1; } int willNotReleaseDroppableGames = WillNotReleaseDroppableGames; if (UnlimitedWillNotReleaseDroppableGames) { willNotReleaseDroppableGames = -1; } int willReleaseDroppableGames = WillReleaseDroppableGames; if (UnlimitedWillReleaseDroppableGames) { willReleaseDroppableGames = -1; } var counterPickDeadline = new AnnualDate(CounterPickDeadline.Month, CounterPickDeadline.Day); var leagueTags = Tags.ToDomain(tagDictionary); var specialGameSlots = SpecialGameSlots.Select(x => x.ToDomain(tagDictionary)); LeagueYearParameters parameters = new LeagueYearParameters(LeagueID, Year, StandardGames, GamesToDraft, CounterPicks, CounterPicksToDraft, freeDroppableGames, willNotReleaseDroppableGames, willReleaseDroppableGames, DropOnlyDraftGames, CounterPicksBlockDrops, MinimumBidAmount, leagueTags, specialGameSlots, draftSystem, pickupSystem, scoringSystem, tradingSystem, tiebreakSystem, counterPickDeadline); return(parameters); }
public void setup() { sys = new TradingSystem(null, null); admin = new User(0, "admin", "1234", true, true); admin.State = state.signedIn; store = new Store(0, "store"); OwnerSotre = new Owner(store, admin); store.RolesDictionary.Add(admin.Id, store.Roles.AddChild(OwnerSotre)); admin.Roles.Add(store.Id, OwnerSotre); manager = new User(1, "manager", "1234", false, true); manager.State = state.signedIn; List <int> permmision = new List <int>(); permmision.Add(2); managerSotre = new Manager(store, manager, permmision); store.RolesDictionary.Add(manager.Id, store.Roles.AddChild(managerSotre)); manager.Roles.Add(store.Id, managerSotre); p1 = new Product(1, "p1", null, null, 1); ps1 = new ProductInStore(10, store, p1); store.Products.Add(p1.Id, ps1); p2 = new Product(2, "p2", null, null, 10); ps2 = new ProductInStore(10, store, p2); store.Products.Add(p2.Id, ps2); pcp = new ProductConditionPolicy(0, 1, 0, 10, LogicalConnections.and); icp = new inventoryConditionPolicy(1, 1, 5, LogicalConnections.and); bcp = new BuyConditionPolicy(2, 2, 5, 10, 20, LogicalConnections.and); ucp = new UserConditionPolicy(3, "Tel Aviv", true, LogicalConnections.and); //itcp= if(buy p1 min buy =0 &max buy =10) then (min inventory =5) itcp = new IfThenCondition(4, pcp, icp, LogicalConnections.and); lcp = new LogicalConditionPolicy(5, LogicalConnections.and, LogicalConnections.and); sys.Users.Add(admin.Id, admin); sys.Users.Add(manager.Id, manager); sys.Stores.Add(store.Id, store); }
static async Task MainAsync() { // Config Config config = new Config() { Reload = false, DataDirectory = @"..\..\..\..\data\", QuandlApiKey = "", GoogleCookies = "", ImportantWords = new string[] { "debt", "color", "stocks", "economics", "inflation", "restaurant", "portfolio", "metals", "housing", "dow jones", "revenue", "sell", "bonds", "risk", "car", "credit", "markets", "return", "unemployment", "leverage", "chance", "nasdaq", "money", "society", "war", "religion", "cancer", "growth", "investment", "hedge", "marriage", "transaction", "cash", "economy", "derivatives", "headlines", "profit", "loss", "office", "forex", "finance", "fed", "banking", "stock market", "fine", "crisis", "happy", "gains", "invest", "house" }, BestNCompanies = 100, NormalizationWindowSize = int.MaxValue, DataFrom = new DateTime(1995, 1, 1), ValidFrom = 0.7, TestFrom = 0.85, Predict = 30, Random = new Random() }; // Prepare data DataManager dataManager = new DataManager(config); await dataManager.PrepareData(); // Make prediction RnnManager rnnManager = new RnnManager(config); rnnManager.Predict(); // Decode prediction dataManager.DecodePrediction(); // Make trades TradingSystem tradingSystem = new TradingSystem(config); tradingSystem.Trade(); }
public void setUp() { sys = new TradingSystem(null, null); discountPolicies = new List <DiscountPolicy>(); purchasePolicies = new List <PurchasePolicy>(); user = new User(1, "aviv", "123", false, false); store = new Store(0, "blabla"); Owner owner = new Owner(store, user); user.Roles.Add(store.Id, owner); TreeNode <Role> ownerNode = store.Roles.AddChild(owner); store.RolesDictionary.Add(1, ownerNode); user2 = new User(2, "liraz", "123", false, false); Owner owner2 = new Owner(store, user2); user2.Roles.Add(store.Id, owner2); TreeNode <Role> owner2Node = ownerNode.AddChild(owner2); store.RolesDictionary.Add(2, owner2Node); basket_user = user.Basket; admin = new User(0, "admin", "1234", true, false); sys.Stores.Add(store.Id, store); sys.StoreCounter = 1; sys.ProductCounter = 4; sys.Users.Add(admin.Id, admin); sys.Users.Add(user.Id, user); sys.Users.Add(user2.Id, user2); sys.UserCounter = 3; user.State = state.signedIn; }