Fynance 1.0.1
See the version list below for details.
dotnet add package Fynance --version 1.0.1
NuGet\Install-Package Fynance -Version 1.0.1
<PackageReference Include="Fynance" Version="1.0.1" />
paket add Fynance --version 1.0.1
#r "nuget: Fynance, 1.0.1"
// Install Fynance as a Cake Addin
#addin nuget:?package=Fynance&version=1.0.1
// Install Fynance as a Cake Tool
#tool nuget:?package=Fynance&version=1.0.1
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.
Fynance Project Status
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; // Double
var low = item.Low; // Double
var high = item.High; // Double
var close = item.Close; // Double
var close = item.Close; // Double
var adjClose = item.AdjClose; // Double
var volume = item.Volume; // Double
}
Reading the dividends:
foreach (var item in result.Dividends)
{
var date = item.Date; // DateTime: Payment date
var value = item.value; // Double: Payment value
}
Reading the splits:
foreach (var item in result.Splits)
{
var date = item.Date; // DateTime: Date
var numerator = item.Numberator; // Double: Numerator of splits
var denominator = item.Denominator; // Double: 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.
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.
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard1.1 netstandard1.2 netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1 |
.NET Framework | net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen30 tizen40 tizen60 |
Universal Windows Platform | uap uap10.0 |
Windows Phone | wpa81 |
Windows Store | netcore netcore45 netcore451 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 1.1
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.