CosminSanda.Finance
1.1.3
See the version list below for details.
dotnet add package CosminSanda.Finance --version 1.1.3
NuGet\Install-Package CosminSanda.Finance -Version 1.1.3
<PackageReference Include="CosminSanda.Finance" Version="1.1.3" />
paket add CosminSanda.Finance --version 1.1.3
#r "nuget: CosminSanda.Finance, 1.1.3"
// Install CosminSanda.Finance as a Cake Addin #addin nuget:?package=CosminSanda.Finance&version=1.1.3 // Install CosminSanda.Finance as a Cake Tool #tool nuget:?package=CosminSanda.Finance&version=1.1.3
CosminSanda.Finance
This package simplifies the process of retrieving data from Yahoo Finance.
Currently, it can fetch information about earnings calls and about daily quotes.
This package can be used, typically, to analyze the price action around historical earnings calls for the purpose of establishing strategies for future earnings releases a.k.a "Playing the Earnings".
The package acts as a proxy to Yahoo Finance and is essentially a web scraper.
While in previous versions, caching was built in, it has been removed.
That means all methods make requests directly to Yahoo Finance and it is your responsibility to cache the data so as to avoid redundant requests.
The reason for disabling the cache has to do with the lack of guarantees regarding the provided data which can lead to inconsistencies for less popular instruments.
Methods are made static to make it easier to use from interactive environments.
That is also the reason why there aren't a lot of options for Dependencies Injection of, for example, logging.
To further simplify the use of methods in the package, arguments are passed using basic types like string
and int32
.
Installation
Classic
If you would like to use this library in your own project, use the standard installation process. of packages from NuGet.
Install-Package CosminSanda.Finance
Notebook
If you would like to use this in a .NET enabled Jupyter notebook use this command in a cell:
#r "nuget,CosminSanda.Finance"
Sample usage
Tesla earnings
The code blocks in this tutorials should be executed as part of a dotnet-interactive
notebook.
In this example, we look at the price action before and after the last Tesla earnings. The number of days analyzed is always even, the first half of the days are from before the earnings call and the reminder are from after the earnings results have been released.
Although CsvHelper
and ServiceStack.Text
should be installed as transient dependencies, they are not, so in the notebook, they have to be installed individually.
#r "nuget: CosminSanda.Finance"
#r "nuget: XPlot.Plotly.Interactive"
#r "nuget: CsvHelper"
#r "nuget: ServiceStack.Text"
Get an ascending ordered list of all Tesla earnings dates.
var earnings = await EarningsCalendar.GetPastEarningsDates("TSLA");
We'll exemplify using just the latest earnings call date.
var lastDate = earnings.Last();
Get the OHLC data for 5 days before and 5 days after the earnings call.
The earnings call can take place before market open (in which case the date of the earnings call is included in the last 5 days) or after market close (in which case the date of the earnings call is included in the first 5 days).
var quotes = await Quotes.GetQuotesAround("TSLA", lastDate, 5);
Use a charting library to vizualise the data and get a feel of how the earnings call expectations and actual results influence the price action.
In the case of the Tesla earnings release on 20th of July 2022, it's obvious that the call happened after market close, so the 20th is part of the "before earnings" half of the candles.
var chart = Chart
.Candlestick(quotes.Select(o => new Tuple<string, double, double, double, double>(
o.Date.ToDateTime(TimeOnly.Parse("10:00 PM")).ToString("yyyy-MM-dd"),
o.Open,
o.High,
o.Low,
o.Close
)));
chart.WithLayout(new Layout.Layout{
title=$"Tesla earnings on {lastDate.Date}"
});
chart
You should see something similar to this:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
All Frameworks
- CsvHelper (>= 28.0.0)
- Newtonsoft.Json (>= 13.0.1)
- ServiceStack.Text (>= 6.4.0)
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.5 | 412 | 11/14/2022 |
1.1.4 | 382 | 11/4/2022 |
1.1.3 | 392 | 11/4/2022 |
1.1.2 | 394 | 11/3/2022 |
1.1.1 | 449 | 10/1/2022 |
1.1.0 | 454 | 10/1/2022 |
1.0.2 | 422 | 9/29/2022 |
1.0.1 | 433 | 9/29/2022 |
1.0.0 | 435 | 9/27/2022 |
0.0.9 | 474 | 7/30/2022 |
0.0.8 | 462 | 7/29/2022 |
0.0.7 | 510 | 7/23/2020 |
0.0.6 | 472 | 6/24/2020 |
0.0.5 | 537 | 6/24/2020 |
0.0.4 | 480 | 6/20/2020 |
0.0.3 | 498 | 6/19/2020 |
- Refactor and braking changes.
- Remove cache capability