Fynance 1.2.0

dotnet add package Fynance --version 1.2.0                
NuGet\Install-Package Fynance -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fynance" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fynance --version 1.2.0                
#r "nuget: Fynance, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Fynance as a Cake Addin
#addin nuget:?package=Fynance&version=1.2.0

// Install Fynance as a Cake Tool
#tool nuget:?package=Fynance&version=1.2.0                

Fynance

Build Status

NuGet NuGet Downloads GitHub Stars GitHub Issues Apache License Donate

Fynance is a handy wrapper to get stock market quotes written in .Net Standard. It is currently support the Yahoo Finance but it can be extended to other APIs.

Installation - Nuget Package

This is available on nuget package.

Install-Package Fynance

To update the package to the last version use the following nuget statement:

Update-Package Fynance

Fynance Examples

What data you can get with Fynance:

  • Get Security Info
  • Get Quotes
  • Get Events
    • Get Dividends
    • Get Splits
General Usage

First you have to add the Fynance namespace to make the types available on your code:

using Fynance;

The Fynance implements a fluent interface to read data from a stock market api. Given it, a instance of Ticker is a representation of a security on the stock market. Then you can make an instance of Ticker and use all the methods to configure what you want to have until call the Get method. There is a async version of this method called GetAsync. The following code is a sample of use:

var result = await Ticker.Build()
                         .SetSymbol("MSFT")
                         .SetPeriod(Period.OneMonth)
                         .SetInterval(Interval.OneDay)
                         .GetAsync();

The Build method instance the Ticker object and all these Set methods configure what information you want to get from the available APIs.

To the the events as we call dividends or splits you can use SetDividends and SetEvents to define it:

var result = await Ticker.Build()
                         .SetSymbol("MSFT")
                         .SetPeriod(Period.OneMonth)
                         .SetInterval(Interval.OneDay)
                         .SetDividends(true)
                         .SetEvents(true)
                         .GetAsync();

Alternatively, you can use the method .SetEvents(true) and it will set Dividends and Splits.

When you call the Get methods, you get a instance of FyResult. It contains all the data following the methods configured over the Ticker. The FyResult can contain all the information from the Security, the OLHC history, dividends and splits.

Results

There are many information you can read from the security, see some samples available:

var currenty = result.Currency;
var symbol = result.Symbol;
var symbol = result.ExchangeName;

Reading all the OLHC history:

foreach (var item in result.Quotes)
{
   var period = item.Period; // DateTime
   var open = item.Open; // Decimal
   var low = item.Low; // Decimal
   var high = item.High; // Decimal 
   var close = item.Close; // Decimal 
   var close = item.Close; // Decimal 
   var adjClose = item.AdjClose; // Decimal 
   var volume = item.Volume; // Decimal
}

Reading the dividends:

foreach (var item in result.Dividends)
{
   var date = item.Date; // DateTime: Payment date 
   var value = item.value; // Decimal: Payment value
}

Reading the splits:

foreach (var item in result.Splits)
{
   var date = item.Date; // DateTime: Event Date 
   var numerator = item.Numberator; // Decimal: Numerator of splits
   var denominator = item.Denominator; // Decimal: Denominator of split
}

Issue Reports

If you find any issue, please report them using the GitHub issue tracker. Would be great if you provide a sample of code or a repository with a sample project.

Contributions

Contributions are welcome, feel free to fork the repository and send a pull request with your changes to contribute with the package.

Licenses

This software is distributed under the terms of the Apache License 2.0. Please, read the LICENSE file available on this repository.

Credits

This project is a collab of @FelipeOriani and @EduVencovsky.

Many thanks for the Newtonsoft.Json packaged used as a dependency of this project.

If you wanna colaborate with this project or it was useful to you, make a donate:

paypal

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.1 is compatible.  netstandard1.2 was computed.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0 325 6/4/2024
1.1.0 3,815 9/28/2021
1.0.4 390 9/24/2021
1.0.3 406 9/24/2021
1.0.2 525 11/13/2020
1.0.1 583 6/11/2020
1.0.0 487 6/1/2020