Artesian.SDK 5.0.1

dotnet add package Artesian.SDK --version 5.0.1
NuGet\Install-Package Artesian.SDK -Version 5.0.1
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="Artesian.SDK" Version="5.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Artesian.SDK --version 5.0.1
#r "nuget: Artesian.SDK, 5.0.1"
#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 Artesian.SDK as a Cake Addin
#addin nuget:?package=Artesian.SDK&version=5.0.1

// Install Artesian.SDK as a Cake Tool
#tool nuget:?package=Artesian.SDK&version=5.0.1

image

Artesian.SDK

This Library provides read access to the Artesian API

Getting Started

Installation

This library is provided in NuGet.

Support for .NET Framework 4.6.1, .NET Standard 2.0.

In the Package Manager Console -

Install-Package Artesian.SDK

or download directly from NuGet.

How to use

The Artesian.SDK instance can be configured using either Client credentials or API-Key authentication

//API-Key
ArtesianServiceConfig cfg = new ArtesianServiceConfig(
   new Uri("https://fake-artesian-env/"),
   "5418B0DB-7AB9-4875-81BA-6EE609E073B6"
   );

//Client credentials
ArtesianServiceConfig cfg = new ArtesianServiceConfig(
		new Uri("https://fake-artesian-env/"),
		"audience",
		"domain",
		"client_id",
		"client_secret"
		);

BREAKING CHANGES: Upgrade v4->v5

The following breaking changes has been introduced in v5 respect to v4.

Update of GME PublicOffer to V2.0

With the introduction of the MI-XBID market on the GME Public Offers data has been increased the api version With a version before v5 of the SDK it will be not possible to download the MI-XBID data

The new market in the class GME_Enums --> Market is MIXBID

Changes on fields

The following fields are now nullable. It will be always valorized for Makret except MIXBID

        //Can be NULL for XBID, never NULL otherwise
        public string Unit { get; set; }
		
        //Can be NULL for XBID, never NULL otherwise
        public decimal? MeritOrder { get; set; }

        //Can be NULL for XBID, never NULL otherwise
        public bool? PartialQuantityAccepted { get; set; }

        //Can be NULL for XBID, never NULL otherwise
        public decimal? ADJQuantity { get; set; }

        //Can be NULL for XBID, never NULL otherwise
        public decimal? ADJEnergyPrice { get; set; }

        //Can be NULL for XBID, never NULL otherwise
        public int? Quarter { get; set; }

        //Can be NULL for XBID, never NULL otherwise
        public decimal? AwardedPrice { get; set; }

The following fields are new.

        //Added for XBID, NULL otherwise
        public LocalDateTime? Timestamp { get; set; }

        //Added for XBID, NULL otherwise
        public decimal? PrezzoUnitario { get; set; }

QueryService

Using the ArtesianServiceConfig we create an instance of the QueryService which is used to create Actual, Versioned and Market Assessment time series queries

Policy configuration

Optionally a custom policy can be introduced to configure policy constraints within the QueryService otherwise default policy is implemented

ArtesianPolicyConfig policy = new ArtesianPolicyConfig();
	policy
	    .RetryPolicyConfig(retryCount: 3, retryWaitTime: 200)
	    .CircuitBreakerPolicyConfig(maxExceptions: 2, durationOfBreak: 3)
	    .BulkheadPolicyConfig(maxParallelism: 10, maxQueuingActions: 15);

var qs = new QueryService(cfg, policy);

<table> <tr><th>Policies</th><th>Description</th></tr> <tr><td>Wait & Retry Policy</td><td>Retry, waiting a specified duration between each retry</td></tr> <tr><td>Circuit Breaker Policy</td><td>The CircuitBreakerPolicy instance maintains internal state across calls to track failures</td></tr> <tr><td>Bulkhead Policy</td><td>The bulkhead isolation policy assigns operations to constrained resource pools, such that one faulting channel of actions cannot swamp all resource</td></tr> </table>

Partition Strategy

Requests are partitioned by an IPartitionStrategy, optionally an IPartitionStrategy can be passed to use a certain partition
strategy. A partition strategy by ID is implemented by default

PartitionByIDStrategy idStrategy = new PartitionByIDStrategy();
var act = qs.CreateActual(idStrategy)
       .ForMarketData(new int[] { 100000001 })
       .InGranularity(Granularity.Day)
       .InRelativeInterval(RelativeInterval.RollingMonth)
       .ExecuteAsync().Result;

<table> <tr><th>Partition Strategies</th><th>Description</th></tr> <tr><td>Partition by ID</td><td>Requests are partitioned into groups of ID's by a defined partition size </td></tr> </table>

Actual Time Series

var actualTimeSeries = await qs.CreateActual()
                .ForMarketData(new int[] { 100000001, 100000002, 100000003 })
                .InGranularity(Granularity.Day)
                .InAbsoluteDateRange(new LocalDate(2018,08,01),new LocalDate(2018,08,10))
                .ExecuteAsync();

To construct an Actual Time Series the following must be provided.

<table> <tr><th>Actual Query</th><th>Description</th></tr> <tr><td>Market Data ID</td><td>Provide a market data id or set of market data id's to query</td></tr> <tr><td>Time Granularity</td><td>Specify the granularity type</td></tr> <tr><td>Time Extraction Window</td><td>An extraction time window for data to be queried</td></tr> </table>

Go to Time Extraction window section

Market Assessment Time Series

var marketAssesmentSeries = await qs.CreateMarketAssessment()
                       .ForMarketData(new int[] { 100000001 })
                       .ForProducts(new string[] { "M+1", "GY+1" })
                       .InRelativeInterval(RelativeInterval.RollingMonth)
                       .ExecuteAsync();

To construct a Market Assessment Time Series the following must be provided.

<table> <tr><th>Market Assessment Query</th><th>Description</th></tr> <tr><td>Market Data ID</td><td>Provide a market data id or set of market data id's to query</td></tr> <tr><td>Product</td><td>Provide a product or set of products</td></tr> <tr><td>Time Extraction Window</td><td>An extraction time window for data to be queried </td></tr> </table>

Go to Time Extraction window section

Auction Time Series

var marketAssesmentSeries = await qs.CreateAuction()
                       .ForMarketData(new int[] { 100000001 })
                       .InAbsoluteDateRange(new LocalDate(2018,08,01),new LocalDate(2018,08,10))
                       .ExecuteAsync();

To construct an Auction Time Series the following must be provided.

Auction Query Description
Market Data ID Provide a market data id or set of market data id's to query
Time Extraction Window An extraction time window for data to be queried

Go to Time Extraction window section

Versioned Time Series

 var versionedSeries = await qs.CreateVersioned()
		.ForMarketData(new int[] { 100000001 })
		.InGranularity(Granularity.Day)
		.ForLastOfMonths(Period.FromMonths(-4))
		.InRelativeInterval(RelativeInterval.RollingMonth)
		.ExecuteAsync();

To construct a Versioned Time Series the following must be provided.

<table> <tr><th>Versioned Query</th><th>Description</th></tr> <tr><td>Market Data ID</td><td>Provide a market data id or set of market data id's to query</td></tr> <tr><td>Time Granularity</td><td>Specify the granularity type</td></tr> <tr><td>Versioned Time Extraction Window</td><td>Versioned extraction time window</td></tr> <tr><td>Time Extraction Window</td><td>An extraction time window for data to be queried</td></tr> </table>

Go to Versioned Time Extraction window section
Go to Time Extraction window section

Versioned Time Extraction Windows

<table> <tr><th>Versioned Time Extraction Windows</th><th>Description</th></tr> <tr><td>Version</td><td>Gets the specified version of a versioned timeseries</td></tr> <tr><td>Last Days</td><td>Gets the latest version of a versioned timeseries of each day in a time window</td></tr> <tr><td>Last N</td><td>Gets the latest N timeseries versions that have at least a not-null value</td></tr> <tr><td>Most Recent</td><td>Gets the most recent version of a versioned timeseries in a time window</td></tr> <tr><td>Most Updated Version</td><td>Gets the timeseries of the most updated version of each timepoint of a versioned timeseries</td></tr> </table>

Versioned Time Extraction window types for queries.

Version

 .ForVersion(new LocalDateTime(2018, 07, 19, 12, 0, 0, 123))

Last Days

 .ForLastOfDays(new LocalDate(2018, 6, 22), new LocalDate(2018, 7, 23))

Last N

 .ForLastNVersions(3)

Most Recent

 .ForMostRecent(Period.FromMonths(-1), Period.FromDays(20))

Most Updated Version

 .ForMUV()
 /// optional paramater to limit version
 .ForMUV(new LocalDateTime(2019, 05, 01, 2, 0, 0))

Bid Ask Time Series

var bidAskSeries = await qs.CreateBidAsk()
                       .ForMarketData(new int[] { 100000001 })
                       .ForProducts(new string[] { "M+1", "GY+1" })
                       .InRelativeInterval(RelativeInterval.RollingMonth)
                       .ExecuteAsync();

To construct a Bid Ask Time Series the following must be provided.

<table> <tr><th>Bid Ask Query</th><th>Description</th></tr> <tr><td>Market Data ID</td><td>Provide a market data id or set of market data id's to query</td></tr> <tr><td>Product</td><td>Provide a product or set of products</td></tr> <tr><td>Time Extraction Window</td><td>An extraction time window for data to be queried </td></tr> </table>

Go to Time Extraction window section

Artesian SDK Extraction Windows

Extraction window types for queries.

Date Range

 .InAbsoluteDateRange(new LocalDate(2018,08,01),new LocalDate(2018,08,10)

Relative Interval

 .InRelativeInterval(RelativeInterval.RollingMonth)

Period

 .InRelativePeriod(Period.FromDays(5))

Period Range

 .InRelativePeriodRange(Period.FromWeeks(2), Period.FromDays(20))

Filler Strategy

All extraction types (Actual,Versioned and Market Assessment) have an optional filler strategy.

var versionedSeries = await qs.CreateVersioned()
    .ForMarketData(new int[] { 100000001 })
	.InGranularity(Granularity.Day)
	.ForMostRecent()
	.InAbsoluteDateRange(new LocalDate(2018, 6, 22), new LocalDate(2018, 7, 23))
	.WithFillLatestValue(Period.FromDays(7))

Null

 .WithFillNull()

None

 .WithFillNone()

Custom Value

 //Timeseries
 .WithFillCustomValue(123)
 // Market Assessment
 ..WithFillCustomValue(new MarketAssessmentValue { Settlement = 123, Open = 456, Close = 789, High = 321, Low = 654, VolumePaid = 987, VolumeGiven = 213, Volume = 435 })

Latest Value

 .WithLFillLatestValue(Period.FromDays(7))

MarketData Service

Using the ArtesianServiceConfig cfg we create an instance of the MarketDataService which is used to retrieve and edit MarketData refrences. GetMarketReference will read the marketdata entity by MarketDataIdentifier and returns an istance of IMarketData if it exists.

//reference market data entity
var marketDataEntity = new MarketDataEntity.Input(){
    ProviderName = "TestProviderName",
    MarketDataName = "TestMarketDataName",
    OriginalGranularity = Granularity.Day,
    OriginalTimezone = "CET",
    AggregationRule = AggregationRule.Undefined,
    Type = MarketDataType.VersionedTimeSerie,
    MarketDataId = 1
}

var marketDataService = new MarketDataService(cfg);

var marketData = await marketDataService.GetMarketDataReference(new MarketDataIdentifier(
        marketDataEntity.ProviderName,
        marketDataEntity.MarketDataName)
    );

To Check MarketData for IsRegistered status, returns true if present or false if not found.

var isRegistered = await marketData.IsRegistered();

To Register MarketData , it will first verify that it has not all ready been registered then proceed to register the given MarketData entity.

await marketData.Register(marketDataEntity);

Calling Update will update the current MarketData metadata with changed values. Calling Load, retrieves the current metadata of a MarketData.

marketData.Metadata.AggregationRule = AggregationRule.SumAndDivide;
marketData.Metadata.Transform = SystemTimeTransforms.GASDAY66;

await marketData.Update();

await marketData.Load();

Using Write mode to edit MarketData and save to save the data of the current MarketData providing an instant.

Actual Time Series

EditActual starts the write mode for an Actual Time serie. Checks are done to verify registration and MarketDataType to verify it is an Actual Time Serie. Using AddData to be written.

var writeMarketData = marketdata.EditActual();

writeMarketData.AddData(new LocalDate(2018, 10, 03), 10);
writeMarketData.AddData(new LocalDate(2018, 10, 04), 15);

await writeMarketData.Save(Instant.FromDateTimeUtc(DateTime.Now.ToUniversalTime()));

Versioned Time Series

EditVersioned starts the write mode for a Versioned Time serie. Checks are done to verify registration and MarketDataType to verify it is a Versioned Time Serie. Using AddData to be written.

var writeMarketData = marketData.EditVersioned(new LocalDateTime(2018, 10, 18, 00, 00));

writeMarketData.AddData(new LocalDate(2018, 10, 03), 10);
writeMarketData.AddData(new LocalDate(2018, 10, 04), 15);

await writeMarketData.Save(Instant.FromDateTimeUtc(DateTime.Now.ToUniversalTime()));

Market Assessment Time Series

EditMarketAssessment starts the write mode for a Market Assessment. Checks are done to verify registration and MarketDataType to verify it is a Market Assessment. Using AddData to provide a local date time and a MarketAssessmentValue to be written.

var writeMarketData = marketData.EditMarketAssessment();

var marketAssessmentValue = new MarketAssessmentValue()
{
    High = 47,
    Close = 20,
    Low = 18,
    Open = 33,
    Settlement = 22,
    VolumePaid = 34,
    VolumeGiven = 23,
    Volume = 16

};

writeMarketData.AddData(new LocalDate(2018, 11, 28), "Dec-18", marketAssessmentValue);

await writeMarketData.Save(Instant.FromDateTimeUtc(DateTime.Now.ToUniversalTime()));

Auction Time Series

EditAuction starts the write mode for an Auction entity. Checks are done to verify registration and MarketDataType to verify it is an Auction entity. Using AddData to provide a local date time and Auction bid and offer arrays to be written.

var writeMarketData = marketData.EditAuction();

var localDateTime = new LocalDateTime(2018, 09, 24, 00, 00);
var bid = new List<AuctionBidValue>();
var offer = new List<AuctionBidValue>();
bid.Add(new AuctionBidValue(100, 10));
offer.Add(new AuctionBidValue(120, 12));

writeMarketData.Add(localDateTime, new AuctionBids(localDateTime, bid.ToArray(), offer.ToArray()));
await writeMarketData.Save(Instant.FromDateTimeUtc(DateTime.Now.ToUniversalTime()));

Bid Ask Time Series

EditBidAsk starts the write mode for a Bid Ask. Checks are done to verify registration and MarketDataType to verify it is a Bid Ask. Using AddData to provide a local date time and a BidAskValue to be written.

var writeMarketData = marketData.EditBidAsk();

var bidAskValue = new BidAskValue()
{
    BestBidPrice = 47,
    BestBidQuantity = 18,
    BestAskPrice = 20,
    BestAskQuantity = 33,
    LastPrice = 22,
    LastQuantity = 13
};

writeMarketData.AddData(new LocalDate(2018, 11, 28), "Dec-18", bidAskValue);

await writeMarketData.Save(Instant.FromDateTimeUtc(DateTime.Now.ToUniversalTime()));

Acknowledgments

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 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
5.0.1 266 10/30/2023
5.0.0 168 8/11/2023
4.3.4-beta01 113 8/10/2023
4.3.3 150 8/4/2023
4.3.2 168 7/28/2023
4.3.1 301 5/11/2023
4.3.0 666 3/28/2023
4.2.0 422 1/2/2023
4.1.0 1,204 6/23/2022
4.1.0-beta2 154 6/22/2022
4.1.0-beta1 154 5/25/2022
4.0.0 1,213 5/16/2022
4.0.0-beta2 167 6/22/2022
3.2.1 1,649 10/14/2021
3.2.0 484 10/12/2021
3.1.2 389 9/30/2021
3.1.1 1,205 3/18/2021
3.1.0 537 3/5/2021
3.0.0 556 1/21/2021
2.2.5 450 1/11/2021
2.2.4 482 12/23/2020
2.2.1 851 10/7/2020
2.2.0 593 9/2/2020
2.1.0 548 9/1/2020
2.1.0-beta01 424 7/7/2020
2.0.1 1,061 5/20/2020
2.0.0 2,256 4/6/2020
2.0.0-beta04 478 3/16/2020
2.0.0-beta03 519 3/9/2020
2.0.0-beta02 435 3/3/2020
2.0.0-beta01 416 3/2/2020
1.9.1-beta01 493 1/24/2020
1.9.0-beta01 497 1/16/2020
1.8.0 781 11/20/2019
1.8.0-beta01 417 11/19/2019
1.7.2 767 11/14/2019
1.7.0 654 10/14/2019
1.6.0 734 5/22/2019
1.5.2 695 5/20/2019
1.5.1 700 5/16/2019
1.5.0 655 5/10/2019
1.4.3 686 5/9/2019
1.4.2 735 5/6/2019
1.4.1 838 4/3/2019
1.4.0 846 3/20/2019
1.3.2 818 2/18/2019
1.3.1 775 2/18/2019
1.3.0 862 11/28/2018
1.2.2-beta01 577 11/28/2018
1.2.1 821 11/7/2018
1.2.0 844 10/23/2018
1.2.0-beta07 609 10/23/2018
1.2.0-beta06 608 10/22/2018
1.2.0-beta05 619 10/19/2018
1.2.0-beta04 648 10/18/2018
1.2.0-beta03 612 10/18/2018
1.2.0-beta02 620 10/18/2018
1.2.0-beta01 608 10/18/2018
1.1.2-beta05 663 10/3/2018
1.1.2-beta04 636 10/3/2018
1.1.2-beta03 635 10/3/2018
1.1.2-beta02 673 10/3/2018
1.1.2-beta-01 632 10/3/2018
1.1.1 823 9/28/2018
1.1.0 847 9/27/2018
1.1.0-beta04 644 9/26/2018
1.1.0-beta03 628 9/26/2018
1.1.0-beta02 611 9/25/2018
1.1.0-beta01 610 9/25/2018
1.0.0 1,377 8/17/2018
0.2.7-alpha02 734 8/14/2018
0.2.6-alpha02 732 8/14/2018
0.2.5-alpha02 713 8/13/2018
0.2.4-alpha02 717 8/13/2018
0.2.3-alpha02 700 8/10/2018
0.2.2-alpha02 714 8/8/2018
0.2.1-alpha02 738 8/8/2018
0.2.0-alpha02 737 7/25/2018
0.1.0-alpha02 787 7/19/2018
0.1.0-alpha01 775 7/19/2018

Breaking: remove support for .NET 5.0 (EOL)