public void AddOneTimeEvent(YahooService service, ResponseReceivedHandler messageHandler, object tag) { if (!this.oneTimeEvents.Contains(service)) this.oneTimeEvents.Add(service, new Pair(messageHandler, tag)); else this.oneTimeEvents[service] = new Pair(messageHandler, tag); }
public void AddPermanentEvent(YahooService service, ResponseReceivedHandler messageHandler, object tag) { if (!permanentEvents.Contains(service)) permanentEvents.Add(service, new Pair(messageHandler, tag)); else permanentEvents[service] = new Pair(messageHandler, tag); }
public App( IConfiguration config, YahooService yahooService, FantasyFootballUnitOfWork uow) { _config = config; _yahooService = yahooService; _uow = uow; }
public void AddPermanentEvent(YahooService service, ResponseReceivedHandler messageHandler, object tag) { if (!permanentEvents.Contains(service)) { permanentEvents.Add(service, new Pair(messageHandler, tag)); } else { permanentEvents[service] = new Pair(messageHandler, tag); } }
public void AddOneTimeEvent(YahooService service, ResponseReceivedHandler messageHandler, object tag) { if (!this.oneTimeEvents.Contains(service)) { this.oneTimeEvents.Add(service, new Pair(messageHandler, tag)); } else { this.oneTimeEvents[service] = new Pair(messageHandler, tag); } }
public void TestInitialize() { _yahooDataRepositoryMock = new Mock <ICsvDataRepository <YahooRecord> >(); _yahooTreeDataRepositoryMock = new Mock <ITreeDataRepository <YahooTreeData> >(); _yahooDataRepositoryMock .Setup(x => x.LoadData("test")); _yahooDataRepositoryMock .Setup(x => x.CsvLinesNormalized) .Returns( new List <YahooRecord> { new YahooRecord { Close = 1.25765 }, new YahooRecord { Close = 1.51123 }, new YahooRecord { Close = 1.75987 }, new YahooRecord { Close = 2.34231 }, new YahooRecord { Close = 2.47654 } } ); _service = new YahooService( _yahooDataRepositoryMock.Object, _yahooTreeDataRepositoryMock.Object ); }
static async Task Main(string[] args) { var yfService = new YahooService(); var symbol = "MSFT"; //var result = await yfService.GetHistoricalDataAsync(Frequency.OneDay // , new DateTime(2020, 9, 1, 12, 0, 0) // , new DateTime(2020, 9, 25, 12, 0, 0) // , "MSFT"); //var result = await yfService.GetHistoricalDataAsyncYahoo(Interval.OneDay // , new DateTime(2020, 9, 1, 12, 0, 0) // , new DateTime(2020, 9, 25, 12, 0, 0) // , "MSFT", true); //var fundamentalData = await yfService.GetFundamentalDataAsync("MSFT"); //foreach (var result in fundamentalData.QuoteSummary.Result) //{ // //var assetProfile = result.AssetProfile; // //foreach (var assetProfileCompanyOfficer in assetProfile.CompanyOfficers) // //{ // //} // var recommendation = result.RecommendationTrend; // foreach (var trend in recommendation.Trend) // { // } // var c = result.CashflowStatementHistory; // foreach (var cCashFlowStatement in c.CashFlowStatements) // { // } // var i = result.IndexTrend; // foreach (var iEstimate in i.Estimates) // { // } // var d = result.DefaultKeyStatistics; // var it = result.IndustryTrend; // var itt = result.IncomeStatementHistory; // var fo = result.FundOwnership; // var sd = result.SummaryDetail; // var sdd = result.InsiderHolders; // foreach (var sddHolder in sdd.Holders) // { // } // var sddd = result.CalendarEvents; // var ds = result.UpgradeDowngradeHistory; // var dd = result.BalanceSheetHistory; // foreach (var ddBalanceSheetStatement in dd.BalanceSheetStatements) // { // } //} //var hs = await yfService.GetHistoricalDataAsyncYahoo(Interval.OneDay, new DateTime(2010, 1, 1), // new DateTime(2020, 1, 1), "MSFT", true); //await hs.Prices.WriteCsvAsync(@"c:\temp\MSFT.csv"); //var options = await yfService.GetOptionsContractAsync("MSFT", DateTime.Now.AddDays(1)); //var msftPrices = await yfService.GetHistoricalDataAsync("MSFT", 30); //var calcReturn = ((msftPrices.Last().Close - msftPrices.First().Open) / msftPrices.First().Open) * 100; var list = await yfService.CalculateReturnsAsync(new[] { "MSFT", "AAPL" }, 30); var sorted = list.Sort(); var avg = list.Average(); //list.GroupBy(c => symbol) //var prices = await yfService.GetHistoricalDataAsync(symbol, 30); //await prices.ToList().ReadCsvAsync(@"C:\Temp\MSFT.csv"); // Console.ReadLine(); var prices = await CsvExtensions.ReadCsvAsync("Data\\all_stocks_5yr.csv", new Dictionary <string, string> { { "date", "StartTime" }, { "open", "Open" }, { "high", "High" }, { "low", "Low" }, { "close", "Close" }, { "volume", "Volume" }, { "Name", "Symbol" } }); //var momentum = prices.CalculateMomentum(new DateTime(2017, 1, 1), 50); //var stockNames = prices.GetStockNames(); //var returns = prices.CalculateReturns(); //var orderedReturns = returns.OrderBy(c => c.ReturnPercentage); //var m = prices.SlidingWindow(500, 300, 50); }
public Message(UInt32 sessionID, YahooService service, YahooStatus status) { header.SessionIdentifier = sessionID; header.Service = service; header.Status = status; }
public Message(UInt32 sessionID, YahooService service) : this(sessionID, service, YahooStatus.Available) { }
static async Task Main(string[] args) { IStockDataService yahooService = new YahooService(); _priceManager = new PriceManager(yahooService); var prices = CsvExtensions.ReadCsv( @"Data\\all_stocks_5yr.csv", new Dictionary <string, string> { { "date", "StartTime" }, { "open", "Open" }, { "close", "Close" }, { "high", "High" }, { "low", "Low" }, { "volume", "Volume" }, { "Name", "Symbol" } }); var aalPrice = prices.Where(c => c.Symbol.Equals("AAL")).SortByStartTime(); var open = aalPrice.Select(c => (double)c.Open).ToArray(); var high = aalPrice.Select(c => (double)c.High).ToArray(); var low = aalPrice.Select(c => (double)c.Low).ToArray(); var close = aalPrice.Select(c => (double)c.Close).ToArray(); var volume = aalPrice.Select(c => c.Volume).ToArray(); var lstm = new Lstm(open, high, low, close, volume); lstm.Print(); var scale = lstm.CalculateScale(); var min = lstm.CalculateMin(); var stochasticOsc = new StochasticOsc(); var sData = stochasticOsc.Run(GetData()); var plt = new Plot(600, 400); var slow = sData.Select(c => c.SlowValue).ToArray(); var vals = sData.Select(c => c.Value).ToArray(); //var xs = sData.Select(p => p.StartTime.ToOADate()).ToArray(); plt.PlotSignalXY(sData.Select(p => p.StartTime.ToOADate()).ToArray(), slow, label: "slow", color: Color.Red, lineWidth: 2, lineStyle: LineStyle.Solid, markerSize: 0); plt.PlotSignalXY(sData.Select(p => p.StartTime.ToOADate()).ToArray(), vals, label: "fast", color: Color.Black, lineWidth: 2, lineStyle: LineStyle.Solid); plt.Title("IBM Stochastic"); plt.YLabel("Stochastic Unit"); plt.XLabel("Date"); plt.Ticks(dateTimeX: true); //plt.Legend(); plt.AxisBounds(minY: 0, maxY: 100); plt.AxisAuto(verticalMargin: 0.01); plt.Add(new PlottableHLine(20, Color.Black, 1, "", false, 20, 20, LineStyle.Solid)); plt.Add(new PlottableHLine(80, Color.Black, 1, "", false, 80, 80, LineStyle.Solid)); plt.SaveFig("IBM Slow Stochastic Chart.png"); return; //var list = stochasticService.Run(sData); //await TargilAsync(); //var tickerManager = new TickerManager(yahooService, _priceManager); //var tickers = CsvExtensions.ReadConstituentsAsync("Data\\constituents.csv", new Dictionary<string, string> //{ // {"Symbol", "Symbol"}, // {"Name", "Name"}, // {"Sector", "Sector"}, //}).Result; //var msftTicker = tickerManager.GetTickerBySymbol(tickers, "MSFT"); //var prices = await _priceManager.GetPricesAsync( // msftTicker, // new DateTime(2020, 4, 13), // new DateTime(2020, 6, 26), // Interval.OneDay, // false); //var offsetPercent = 1; //var vals = stochasticService.Run(prices); //var plt = new ScottPlot.Plot(600, 400); //plt.PlotSignal(vals.Select(c => (double)c.Value).ToArray()); //plt.Title("Signal Plot Quickstart (5 million points)"); //plt.YLabel("Vertical Units"); //plt.XLabel("Horizontal Units"); //plt.SaveFig("Quickstart_Quickstart_Signal_5MillionPoints.png"); return; //var offsetPercent = 0.5; //var supportPoints = _priceManager.GetSupportExtremaGroups(prices, ExtremaType.Minimum, offsetPercent); //var p = prices.Last(); //Console.WriteLine($"Curret value: {p.Close}"); //Console.WriteLine("Support Points"); //supportPoints.Print(ExtremaType.Minimum); //Console.WriteLine(); //Console.WriteLine("Reject Points"); //rejectPoints.Print(ExtremaType.Maximum); //var daysMomentum = _priceManager.GetDaysMomentum(prices); //daysMomentum.Print(); }
public void AddPermanentEvent(YahooService service, ResponseReceivedHandler messageHandler) { AddPermanentEvent(service, messageHandler, null); }