/// <param name="player">Paritee.StardewValleyAPI.Players</param> /// <returns>Returns Paritee.StardewValleyAPI.Buidlings.AnimalShop</returns> public AnimalShop GetAnimalShop(Player player) { Dictionary <Stock.Name, string[]> available = this.Config.MapFarmAnimalsToAvailableAnimalShopStock(); StockConfig stockConfig = new StockConfig(available, this.GetBlueFarmAnimals(player), this.GetVoidFarmAnimals(player)); Stock stock = new Stock(stockConfig); return(new AnimalShop(stock)); }
/// <param name="version">string</param> /// <param name="farm">StardewValley.Farm</param> /// <param name="blueFarmAnimals">Paritee.StardewValleyAPI.FarmAnimals.Variations.BlueVariation</param> /// <param name="voidFarmAnimals">Paritee.StardewValleyAPI.FarmAnimals.Variations.VoidVariation</param> /// <returns>Returns Paritee.StardewValleyAPI.Buidlings.AnimalShop</returns> public AnimalShop GetAnimalShop(string version, Farm farm, BlueVariation blueFarmAnimals, VoidVariation voidFarmAnimals) { if (!this.IsVersionSupported(version)) { throw new NotSupportedException(); } List <FarmAnimalForPurchase> farmAnimalsForPurchase = this.Config.GetFarmAnimalsForPurchase(farm); StockConfig stockConfig = new StockConfig(farmAnimalsForPurchase, blueFarmAnimals, voidFarmAnimals); Stock stock = new Stock(stockConfig); return(new AnimalShop(stock)); }
private AnimalShop GetAnimalShop(Player player) { // Set up everything else BlueConfig blueConfig = new BlueConfig(player.HasSeenEvent(BlueVariation.EVENT_ID)); BlueVariation blueFarmAnimals = new BlueVariation(blueConfig); VoidConfig voidConfig = new VoidConfig(this.Config.VoidFarmAnimalsInShop, player.HasCompletedQuest(VoidVariation.QUEST_ID)); VoidVariation voidFarmAnimals = new VoidVariation(voidConfig); List <FarmAnimalForPurchase> farmAnimalsForPurchase = this.Config.GetFarmAnimalsForPurchase(Game1.getFarm()); StockConfig stockConfig = new StockConfig(farmAnimalsForPurchase, blueFarmAnimals, voidFarmAnimals); Stock stock = new Stock(stockConfig); return(new AnimalShop(stock)); }
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e) { this.Player = new Player(Game1.player, this.Helper); // Set up everything else BlueConfig blueConfig = new BlueConfig(this.Player.HasSeenEvent(BlueVariation.EVENT_ID)); this.BlueFarmAnimals = new BlueVariation(blueConfig); VoidConfig voidConfig = new VoidConfig(this.Config.VoidFarmAnimalsInShop, this.Player.HasCompletedQuest(VoidVariation.QUEST_ID)); this.VoidFarmAnimals = new VoidVariation(voidConfig); List <FarmAnimalForPurchase> farmAnimalsForPurchase = this.Config.GetFarmAnimalsForPurchase(Game1.getFarm()); StockConfig stockConfig = new StockConfig(farmAnimalsForPurchase, this.BlueFarmAnimals, this.VoidFarmAnimals); Stock stock = new Stock(stockConfig); this.AnimalShop = new AnimalShop(stock); }
private void GameLoop_SaveLoaded(object sender, SaveLoadedEventArgs e) { this.Player = new Player(Game1.player, this.Helper); // Set up everything else BlueConfig blueConfig = new BlueConfig(this.Player.HasSeenEvent(Blue.EVENT_ID)); this.BlueFarmAnimals = new Blue(blueConfig); VoidConfig voidConfig = new VoidConfig(this.Config.VoidFarmAnimalsInShop, this.Player.HasCompletedQuest(Void.QUEST_ID)); this.VoidFarmAnimals = new Void(voidConfig); Dictionary <Stock.Name, string[]> available = this.Config.MapFarmAnimalsToAvailableAnimalShopStock(); StockConfig stockConfig = new StockConfig(available, this.BlueFarmAnimals, this.VoidFarmAnimals); Stock stock = new Stock(stockConfig); this.AnimalShop = new AnimalShop(stock); }
private static async Task AutoTradeStocks(IAlpacaClient alpacaClient, StockConfig stockConfig, MLConfig mlConfig) { if ((stockConfig.Stock_List?.Count ?? 0) == 0) { throw new ArgumentException("You must pass an least one valid stock symbol", nameof(stockConfig)); } var strategies = new List <Strategy>() { new MeanReversionStrategy(alpacaClient), new MLStrategy(alpacaClient, mlConfig), new MicrotrendStrategy(alpacaClient), //new NewsStrategy(alpacaClient, config.Get<NewsSearchConfig>()), }; var strategy = strategies .SingleOrDefault(x => string.Equals(x.GetType().Name, stockConfig.Stock_Strategy, StringComparison.OrdinalIgnoreCase)); if (strategy == null) { throw new ArgumentException($"Could not find any strategies with the name '{stockConfig.Stock_Strategy}'", nameof(stockConfig)); } if (!await alpacaClient.ConnectStreamApi()) { throw new UnauthorizedAccessException("Failed to connect to streaming API. Authorization failed."); } foreach (var stockSymbol in stockConfig.Stock_List) { var stockData = await alpacaClient.GetStockData(stockSymbol); if ((stockData?.Count ?? 0) == 0) { throw new ArgumentException($"You stock symbol {stockSymbol} is not valid.", nameof(stockConfig)); } strategy.HistoricalData = stockData; alpacaClient.SubscribeMinuteAgg(stockSymbol, async y => await strategy.HandleMinuteAgg(y)); } }
public StockController(List <AmazonProduct> products, StockConfig config) { Products = products; Config = config; }