static void Main(string[] args) { using (var db = new TradingContext()) { var trade = new Trade { Instrument = InstrumentType.Common, Price = 1, Quantity = 200, Side = TradeSide.Buy, Ticker = "KMI", MarkToMarket = 12, TransactionUtc = new DateTime(2016, 11, 10).ToUniversalTime() }; var position = new Position { Ticker = "KMI" }; position.Trades.Add(trade); db.Positions.Add(position); db.SaveChanges(); var query = from p in db.Positions select p; foreach (var p in query) { Console.WriteLine(JsonConvert.SerializeObject(p)); Console.WriteLine(); } Console.ReadLine(); } }
public void Insert(BlockOfShares blockOfShares) { using (var db = new TradingContext()) { db.BlockOfSharesTable.Add(blockOfShares); db.SaveChanges(); } }
public void Insert(Transaction transaction) { using (var db = new TradingContext()) { db.TransactionHistory.Add(transaction); db.SaveChanges(); } }
public bool Insert(Client client) { using (var db = new TradingContext()) { db.Clients.Add(client); db.SaveChanges(); return(true); } }
public void Remove(Client client) { using (var db = new TradingContext()) { var clientToDelete = db.Clients.Where(c => c.Name == client.Name).FirstOrDefault(); db.Clients.Remove(clientToDelete); db.SaveChanges(); } }
public bool Insert(Share share) { using (var db = new TradingContext()) { db.Shares.Add(share); db.SaveChanges(); return(true); } }
public static void ImportFromBorsaItaliana(string startFrom) { List <string> tickers = getTickers(startFrom); int index = 0; var borsaItalianaService = new BorsaItalianaService(); foreach (var ticker in tickers) { var quote = borsaItalianaService.GetDailyQuotesLastThreeMonths(ticker); quote = GetEndOfMonthQuotes(quote); if (quote.Any()) { using (var context = new TradingContext()) { var quoteEsistenti = context.Quote.Where(q => q.Ticker == ticker).ToList(); foreach (var quota in quote) { var quotaEsistente = quoteEsistenti.SingleOrDefault(q => q.Data.ToString("MMyyyy") == quota.Data.ToString("MMyyyy")); if (quotaEsistente == null) { context.Quote.Add(quota); } else if (quotaEsistente.Chiusura != quota.Chiusura || quotaEsistente.Volumi != quota.Volumi) { context.Update(quotaEsistente); quotaEsistente.Chiusura = quota.Chiusura; quotaEsistente.Volumi = quota.Volumi; } } var records = context.SaveChanges(); Console.WriteLine($"{++index} {ticker}: {records} record(s) affected"); } } else { Console.WriteLine($"{++index} {ticker}: ERROR no data returned from web service"); } } using (var context = new TradingContext()) { var etfService = new EtfService(null, new EtfRepository(context)); var counter = etfService.AggiornaQuoteMeseSuccessivo(); Console.WriteLine($"Quote mese successivo: {counter} record(s) affected"); var portfolioService = new PortfolioService(borsaItalianaService, null, null, new PortfolioRepository(context)); counter = portfolioService.AggiornaQuotePortfolio(); Console.WriteLine($"Quote portafoglio: {counter} record(s) affected"); } Console.WriteLine("Done!"); }
public IActionResult UpdateAccount([FromBody] BotAccountUpdate botUpdate, string botId) { try { var bot = _context.Bots .Include(x => x.Exchanges) .FirstOrDefault(x => x.Name == botId); if (bot == null) { return(UnprocessableEntity("Invalid bot name.")); } var config = _context.ExchangeCredentials.FirstOrDefault(x => x.Nickname == botUpdate.Account); if (config == null) { return(UnprocessableEntity("Invalid account name.")); } var account = bot.Exchanges.FirstOrDefault(x => x.Name == botUpdate.Exchange); if (account == null) { bot.Exchanges.Add(new BotExchange(config.Name) { SelectedConfig = config }); } else { account.SelectedConfig = config; } _context.Bots.Update(bot); _context.SaveChanges(); return(Ok()); } catch (Exception e) { _logger.LogCritical("UpdateBotAccount threw an exception: " + e.Message); return(StatusCode(500)); } }
public bool ChangeBalance(int clientID, decimal accountGain) { using (var db = new TradingContext()) { Client client = db.Clients.Where(c => c.ClientID == clientID).FirstOrDefault(); client.Balance += accountGain; db.SaveChanges(); return(true); } }
public IActionResult AddExchangeConfig([FromBody] ExchangeConfig config) { //Check we've been given enough info if (string.IsNullOrEmpty(config.Name)) { return(UnprocessableEntity("Please choose an exchange")); } if (string.IsNullOrEmpty(config.Nickname)) { return(UnprocessableEntity("Please enter a nickname for this account")); } if (!config.Simulated) { if (string.IsNullOrEmpty(config.PublicKey)) { return(UnprocessableEntity("Public Key must have a value")); } else if (string.IsNullOrEmpty(config.PrivateKey)) { return(UnprocessableEntity("Private Key must have a value")); } } //Make sure we don't already have the creds if (_context.ExchangeCredentials.Any(x => x.Name == config.Name && (x.PublicKey == config.PublicKey || x.Nickname == config.Nickname))) { return(UnprocessableEntity("Credentials already exist")); } //Add creds to the db _context.ExchangeCredentials.Add(new ExchangeConfig() { Name = config.Name, Nickname = config.Nickname, Simulated = config.Simulated, PublicKey = config.PublicKey, PrivateKey = config.PrivateKey }); _context.SaveChanges(); return(Ok()); }
public void ChangeSharePrice(int shareID, decimal price) { using (var db = new TradingContext()) { var entry = db.Shares .Where(s => s.ShareID == shareID) .FirstOrDefault(); entry.Price = price; db.SaveChanges(); } }
public void ClientUpdate(Client clientData) { using (var db = new TradingContext()) { var clientToUpdate = db.Clients.Where(c => c.ClientID == clientData.ClientID).FirstOrDefault(); clientToUpdate.Name = clientData.Name; clientToUpdate.PhoneNumber = clientData.PhoneNumber; clientToUpdate.Balance = clientData.Balance; db.SaveChanges(); } }
public void Remove(BlockOfShares blockOfShare) { using (var db = new TradingContext()) { var blockToDelete = db.BlockOfSharesTable .Where(b => b.ShareID == blockOfShare.ShareID && b.ClientID == blockOfShare.ClientID) .FirstOrDefault(); db.BlockOfSharesTable.Remove(blockToDelete); db.SaveChanges(); } }
public void ChangeShareAmountForClient(BlockOfShares blockOfShares) { using (var db = new TradingContext()) { var entry = db.BlockOfSharesTable .Where(b => (b.ClientID == blockOfShares.ClientID && b.ShareID == blockOfShares.ShareID)) .FirstOrDefault(); entry.Amount += blockOfShares.Amount; db.SaveChanges(); } }
private static void InitializeDb() { Trader playerTrader = dataBase.traders.Add (new Trader { name = "Player" }); player = playerTrader; dataBase.itemCategories.Add(new ItemCategory { name = "Руда" }); dataBase.itemCategories.Add(new ItemCategory { name = "Металлы" }); dataBase.SaveChanges(); dataBase.items.Add(new Item { name = "Бистот", ItemCategoryId = 1 }); dataBase.items.Add(new Item { name = "Крокит", ItemCategoryId = 1 }); dataBase.SaveChanges(); dataBase.items.Add(new Item { name = "Железо", ItemCategoryId = 2 }); dataBase.items.Add(new Item { name = "Титан", ItemCategoryId = 2 }); dataBase.SaveChanges(); for (int i = 0; i < 5; i++) { dataBase.traders.Add(new Trader { name = Guid.NewGuid().ToString() }); dataBase.SaveChanges(); } }
public void CreateBot(string name) { _context.Bots.Add(new Bot(name)); _context.SaveChanges(); }
public async Task ExecuteArbitrage(ArbitrageResult result) { try { //Temp bot grabbing so we can check settings (to be called from bot later?) Bot bot; ExchangeConfig account; if (result.Type == ArbitrageType.Triangle) { bot = _context.Bots .Include(x => x.TradeSettings) .Include(x => x.Exchanges) .First(x => x.Name == "Triangle Arbitrage"); } else { bot = _context.Bots .Include(x => x.TradeSettings) .Include(x => x.Exchanges) .First(x => x.Name == "Normal Arbitrage"); } if (bot.TradeSettings.TradingEnabled) { //Grab bot accounts for this trade var exchange = bot.Exchanges.FirstOrDefault(x => x.Name == result.Exchanges.First()); if (exchange == null || exchange.SelectedConfig == null) { //_logger.LogWarning("No account chosen for " + result.Exchanges.First()); return; } else { account = exchange.SelectedConfig; } var arbitrageTradeResults = new TradeResults(); if (result.Type == ArbitrageType.Triangle) { var ex = _exchanges.First(x => x.Name == result.Exchanges.First()); //Triangle arb only has one exchange if (!account.Simulated && !ex.IsAuthenticated) { throw new Exception("Can't create a trade, user is not authenticated."); } //TODO: Check that we have enough liquidity for trades (and potentially swap from available liquidity to fill them) //Step 1: Buy/Sell initial coins //Step 2: Swap coin into misc coin //Step 3: Swap misc coin back to original var previousCurrency = result.InitialCurrency; //Set start currency for choosing buy/sell var currentLiquidity = result.InitialLiquidity; //The amount of the current asset we have var simDelay = new Random().NextDouble() + 0.1; foreach (var pair in result.Pairs) { //If we start on the base, we want to buy the alt var side = pair.BaseCurrency == previousCurrency ? OrderSide.Buy : OrderSide.Sell; ExchangeOrderResult orderResult; if (account.Simulated) { orderResult = await ex.SimulateOrder(pair.MarketSymbol, side, OrderType.Market, 0, currentLiquidity, simDelay); //Use delay to simulate lag between placing and filling the order } else { orderResult = await ex.CreateOrder(pair.MarketSymbol, side, OrderType.Market, 0, currentLiquidity); } arbitrageTradeResults.BotId = bot.Name; arbitrageTradeResults.Trades.Add(new TradeResult() { Amount = orderResult.Amount, AmountFilled = orderResult.AmountFilled, AveragePrice = orderResult.AveragePrice, Fees = orderResult.Fees, FeesCurrency = orderResult.FeesCurrency, FillDate = orderResult.FillDate, OrderSide = side, MarketSymbol = pair.MarketSymbol, Message = orderResult.Message, OrderDate = orderResult.OrderDate, OrderId = orderResult.OrderId, Price = orderResult.Price, Result = orderResult.Result.ToOrderResult(), TradeId = orderResult.TradeId, }); if (orderResult.Result == ExchangeAPIOrderResult.Canceled || orderResult.Result == ExchangeAPIOrderResult.Error || orderResult.Result == ExchangeAPIOrderResult.Unknown) { throw new Exception("Something went wrong with order " + orderResult.OrderId + ",\r\nResult:" + orderResult.Result + "\r\n" + orderResult.Message); } if (side == OrderSide.Buy) { previousCurrency = pair.AltCurrency; } else { previousCurrency = pair.BaseCurrency; } currentLiquidity = orderResult.AmountFilled; } arbitrageTradeResults.InitialCurrency = result.InitialCurrency; arbitrageTradeResults.EstimatedProfit = result.Profit; arbitrageTradeResults.ActualProfit = (arbitrageTradeResults.Trades.Last().AmountFilled - result.InitialLiquidity) / result.InitialLiquidity * 100; //Trade 1 gets converted back to the initial currency and added to the dust collected var trade1 = arbitrageTradeResults.Trades.First(); if (trade1.OrderSide == OrderSide.Buy) { arbitrageTradeResults.Dust += trade1.AveragePrice * (trade1.Amount - trade1.AmountFilled); } else { arbitrageTradeResults.Dust += (trade1.Amount - trade1.AmountFilled) / trade1.AveragePrice; } //Trade 2 gets converted back to the second currency from the first trade and then to the initial currency var trade2 = arbitrageTradeResults.Trades[1]; if (trade2.OrderSide == OrderSide.Buy) { var baseAmount = trade2.AveragePrice * (trade2.Amount - trade2.AmountFilled); if (trade1.OrderSide == OrderSide.Buy) { arbitrageTradeResults.Dust += trade1.AveragePrice * baseAmount; } else { arbitrageTradeResults.Dust += baseAmount / trade1.AveragePrice; } } else { var altAmount = (trade2.Amount - trade2.AmountFilled) / trade2.AveragePrice; if (trade1.OrderSide == OrderSide.Buy) { arbitrageTradeResults.Dust += trade1.AveragePrice * altAmount; } else { arbitrageTradeResults.Dust += altAmount / trade1.AveragePrice; } } //Dust for the final trade is already in the right currency var trade3 = arbitrageTradeResults.Trades.Last(); arbitrageTradeResults.Dust += trade3.Amount - trade3.AmountFilled; arbitrageTradeResults.TimeFinished = DateTime.Now; _context.ArbitrageResults.Add(arbitrageTradeResults); _context.SaveChanges(); } else { //TODO: Implemented normal arb } } } catch (Exception e) { _logger.LogCritical("Something went wrong executing arbitrage", e); } }
public static async void ImportData() { var endDate = DateTime.Now; var startDate = endDate.AddMonths(-26); string url = "http://real-chart.finance.yahoo.com/table.csv?s={0}.MI"; url += $"&a={startDate.Month - 1}&b={startDate.Day}&c={startDate.Year}&d={endDate.Month - 1}&e={endDate.Day}&f={endDate.Year}&g=m&ignore=.csv"; List <string> tickers; using (var context = new TradingContext()) { tickers = context.Etfs.Where(e => e.Leveraged == false).Select(e => e.Ticker).ToList(); } int index = 0; foreach (var ticker in tickers) { var page = string.Format(url, ticker); using (HttpClient client = new HttpClient()) using (HttpResponseMessage response = await client.GetAsync(page)) using (HttpContent content = response.Content) { string csvData = await content.ReadAsStringAsync(); if (csvData != null) { using (var context = new TradingContext()) { var quote = context.Quote.Where(q => q.Ticker == ticker).ToList(); var lines = csvData.Split('\n'); foreach (var line in lines) { var values = line.Split(','); DateTime data; if (!DateTime.TryParse(values[0], out data)) { continue; } var chiusura = decimal.Parse(values[6].Replace(".", ",")); var volumi = int.Parse(values[5]); var quota = quote.SingleOrDefault(q => q.Data.ToString("MMyyyy") == data.ToString("MMyyyy")); if (quota == null) { context.Quote.Add(new Quota { Ticker = ticker.Trim(), Data = data, Chiusura = chiusura, Volumi = volumi }); } else if (chiusura != quota.Chiusura || volumi != quota.Volumi) { context.Update(quota); quota.Chiusura = chiusura; quota.Volumi = volumi; } } var records = context.SaveChanges(); Console.WriteLine($"{++index} {ticker}: {records} record(s) affected"); } } } } Console.WriteLine("Done!"); }
public int SaveChanges() { return(context.SaveChanges()); }
public void Initalize(TradingContext context) { Context = context; context.Items.Add(new Item() { InGameId = ItemIds.Missing_Item, IconUrl = "https://cdn0.iconfinder.com/data/icons/basic-ui-elements-colored/700/010_x-3-512.png" }); context.SaveChanges(); var allItemCombinationResults = new List <ItemCombinationWithFixedResult> { A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.House_of_Mirrors).Times(9) }).WithTheCurrencyResult(CurrencyId.Mirror_of_Kalandra), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Beauty_Through_Death).Times(9) }).WithTheItemResult(ItemIds.Prophecies.The_Queens_Sacrifice), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Doctor).Times(8) }).WithTheItemResult(ItemIds.Accessories.Headhunter), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Fiend).Times(11) }).WithTheItemResult(ItemIds.Accessories.Headhunter, corrupted: true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Immortal_Resolve).Times(6) }).WithTheItemResult(ItemIds.Prophecies.Fated_Connections), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Immortal).Times(10) }).WithTheItemResult(ItemIds.DivinationCards.House_of_Mirrors), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Abandoned_Wealth).Times(6) }).WithTheCurrencyResult(CurrencyId.Exalted_Orb).ResultTimes(3), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Wolven_Kings_Bite).Times(8) }).WithTheItemResult(ItemIds.Armours.Rigwalds_Quills), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Hunters_Reward).Times(3) }).WithTheItemResult(ItemIds.Accessories.The_Taming), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Nurse).Times(8) }).WithTheItemResult(ItemIds.DivinationCards.The_Doctor), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Iron_Bard).Times(9) }).WithTheItemResult(ItemIds.Prophecies.Trash_to_Treasure), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Dragons_Heart).Times(11) }).WithTheSkillGemResult(SkillGemNames.Empower, 4, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.A_Dab_Of_Ink).Times(9) }).WithTheItemResult(ItemIds.Weapons.The_Poets_Pen), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Pride_Before_the_Fall).Times(8) }).WithTheItemResult(ItemIds.Armours.Kaoms_Heart, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Spark_and_the_Flame).Times(2) }).WithTheItemResult(ItemIds.Accessories.Bereks_Respite), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_World_Eater).Times(8) }).WithTheItemResult(ItemIds.Weapons.Starforge), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Wealth_and_Power).Times(11) }).WithTheSkillGemResult(SkillGemNames.Enlighten, 4, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Master).Times(4) }).WithTheItemResult(ItemIds.Accessories.Biscos_Collar), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Mayor).Times(5) }).WithTheItemResult(ItemIds.UniqueMaps.The_Perandus_Manor), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Wind).Times(7) }).WithTheItemResult(ItemIds.Weapons.Windripper), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Brittle_Emperor).Times(8) }).WithTheItemResult(ItemIds.Accessories.Volls_Devotion, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Kings_Heart).Times(8) }).WithTheItemResult(ItemIds.Armours.Kaoms_Heart), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Saints_Treasure).Times(10) }).WithTheCurrencyResult(CurrencyId.Exalted_Orb).ResultTimes(2), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Last_One_Standing).Times(10) }).WithTheItemResult(ItemIds.Weapons.Atziris_Disfavour), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Offering).Times(8) }).WithTheItemResult(ItemIds.Armours.Shavronnes_Wrappings), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Risk).Times(3) }).WithTheItemResult(ItemIds.Accessories.Ventors_Gamble), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Endless_Darkness).Times(9) }).WithTheItemResult(ItemIds.Weapons.Voidforge), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Queen).Times(16) }).WithTheItemResult(ItemIds.Armours.Atziris_Acuity), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Formless_Sea).Times(7) }).WithTheItemResult(ItemIds.Weapons.Varunastra), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Enlightened).Times(6) }).WithTheSkillGemResult(SkillGemNames.Enlighten, 3, false), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Polymath).Times(3) }).WithTheItemResult(ItemIds.Accessories.Astramentis), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Hunger).Times(9) }).WithTheItemResult(ItemIds.Flasks.Taste_of_Hate), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Professor).Times(4) }).WithTheItemResult(ItemIds.UniqueMaps.The_Putrid_Cloister), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Hoarder).Times(12) }).WithTheCurrencyResult(CurrencyId.Exalted_Orb), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Hunger).Times(9) }).WithTheItemResult(ItemIds.Flasks.Taste_of_Hate), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Artist).Times(11) }).WithTheSkillGemResult(SkillGemNames.Enhance, 4, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Valley_of_Steel_Boxes).Times(9) }).WithTheItemResult(ItemIds.Prophecies.Monstrous_Treasure), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Jewellers_Boon).Times(5) }).WithTheItemResult(ItemIds.Prophecies.The_Jewellers_Touch), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Throne).Times(2) }).WithTheItemResult(ItemIds.Armours.Kaoms_Roots, true), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.The_Wind).Times(7) }).WithTheItemResult(ItemIds.Weapons.Windripper), A.ItemCombinationWithAFixedResult.ThatUsesTheIngridients(new List <ItemWithAmount> { An.Ingredient.WithTheItem(ItemIds.DivinationCards.Last_Hope).Times(3) }).WithTheItemResult(ItemIds.Armours.Kaoms_Roots, true), }; foreach (ItemCombinationWithFixedResult itemCombination in allItemCombinationResults) { itemCombination.UpdateCostAndProfit(); } Context.ItemCombinationsWithFixedResults.AddRange(allItemCombinationResults); Context.SaveChanges(); }