mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 21:18:04 +00:00
version bump to 0.1.14
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<PlatformTarget>anycpu</PlatformTarget>
|
<PlatformTarget>anycpu</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**;..\Source\Basics\*_Feed.cs">
|
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**;..\Source\Feeds\**">
|
||||||
<Link>QuanTAlib\%(RecursiveDir)%(Filename)%(Extension)</Link>
|
<Link>QuanTAlib\%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -15,17 +15,16 @@ Alphavantage - Free API to collect quotes for stock, Forex and crypto. It requir
|
|||||||
|
|
||||||
public class Alphavantage_Feed : TBars
|
public class Alphavantage_Feed : TBars
|
||||||
{
|
{
|
||||||
//public enum Interval { Month, Week, Day, Hour, Min30, Min15, Min5, Min1}
|
public enum Interval { Month, Week, Day, Hour, Min30, Min15, Min5, Min1}
|
||||||
public Alphavantage_Feed(string Symbol = "IBM", bool Extended = false, Interval Interval = Interval.Day, string APIkey = "demo")
|
public Alphavantage_Feed(string Symbol = "IBM", bool Extended = false, Interval Interval = Interval.Day, string APIkey = "demo")
|
||||||
{
|
{
|
||||||
|
|
||||||
string outputsize = "compact";
|
string outputsize = "compact";
|
||||||
if (Extended) { outputsize = "full"; }
|
if (Extended) { outputsize = "full"; }
|
||||||
System.Net.Http.HttpClient client = new();
|
System.Net.Http.HttpClient client = new();
|
||||||
|
|
||||||
JsonElement json = new();
|
JsonElement json = new();
|
||||||
var tokens = Symbol.Split("-");
|
var tokens = Symbol.Split("-");
|
||||||
if (tokens.Count() > 1)
|
if (tokens.Length > 1)
|
||||||
{
|
{
|
||||||
string req = "https://www.alphavantage.co/query?function=FX" + GetInterval(Interval) + "&from_symbol=" + tokens[0] + "&to_symbol=" + tokens[1] + "&outputsize=" + outputsize + "&apikey=" + APIkey;
|
string req = "https://www.alphavantage.co/query?function=FX" + GetInterval(Interval) + "&from_symbol=" + tokens[0] + "&to_symbol=" + tokens[1] + "&outputsize=" + outputsize + "&apikey=" + APIkey;
|
||||||
var msg = client.GetStringAsync(req).Result;
|
var msg = client.GetStringAsync(req).Result;
|
||||||
@@ -85,7 +84,7 @@ public class Alphavantage_Feed : TBars
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private (DateTime t, double o, double h, double l, double c, double v) GetOHLC(JsonProperty json)
|
private static (DateTime t, double o, double h, double l, double c, double v) GetOHLC(JsonProperty json)
|
||||||
{
|
{
|
||||||
double o, h, l, c, v;
|
double o, h, l, c, v;
|
||||||
o = h = l = c = v = 0;
|
o = h = l = c = v = 0;
|
||||||
@@ -109,4 +108,17 @@ public class Alphavantage_Feed : TBars
|
|||||||
}
|
}
|
||||||
return (date, o, h, l, c, v);
|
return (date, o, h, l, c, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetInterval(Interval interval = Interval.Day) => interval switch
|
||||||
|
{
|
||||||
|
Interval.Month => "_MONTHLY",
|
||||||
|
Interval.Week => "_WEEKLY",
|
||||||
|
Interval.Day => "_DAILY",
|
||||||
|
Interval.Hour => "_INTRADAY&interval=60min",
|
||||||
|
Interval.Min30 => "_INTRADAY&interval=30min",
|
||||||
|
Interval.Min15 => "_INTRADAY&interval=15min",
|
||||||
|
Interval.Min5 => "_INTRADAY&interval=5min",
|
||||||
|
Interval.Min1 => "_INTRADAY&interval=1min",
|
||||||
|
_ => "_DAILY"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ public class GBM_Feed : TBars
|
|||||||
seed = Close;
|
seed = Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double GBM_value (double Seed, double Volatility, double Drift) {
|
private static double GBM_value (double Seed, double Volatility, double Drift) {
|
||||||
Random rnd = new((int)(DateTime.UtcNow.Ticks));
|
Random rnd = new((int)(DateTime.UtcNow.Ticks));
|
||||||
double U1 = 1.0-rnd.NextDouble();
|
double U1 = 1.0-rnd.NextDouble();
|
||||||
double U2 = 1.0-rnd.NextDouble();
|
double U2 = 1.0-rnd.NextDouble();
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>0.1.13</Version>
|
<Version>0.1.14</Version>
|
||||||
<releaseNotes>Added MACD, RSI, CCI, ALMA, LINREG</releaseNotes>
|
<releaseNotes></releaseNotes>
|
||||||
<Title>QuanTAlib</Title>
|
<Title>QuanTAlib</Title>
|
||||||
<Product>Library of Technical Indicators for .NET</Product>
|
<Product>Library of Technical Indicators for .NET</Product>
|
||||||
<Description>Quantitative Technical Analysis library for both real-time (streaming) and historical data analysis</Description>
|
<Description>Quantitative Technical Analysis library for both real-time (streaming) and historical data analysis</Description>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<Authors>Miha Kralj</Authors>
|
<Authors>Miha Kralj</Authors>
|
||||||
<Copyright>Miha Kralj</Copyright>
|
<Copyright>Miha Kralj</Copyright>
|
||||||
<PackageReadmeFile>readme.md</PackageReadmeFile>
|
<PackageReadmeFile>readme.md</PackageReadmeFile>
|
||||||
<TargetFrameworks>net7.0;net6.0;netcoreapp3.1;netstandard2.1</TargetFrameworks>
|
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user