Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deletetimezone): Added CET default Timezone for delete #51

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using Ark.Tools.Nodatime;
using MessagePack;

using MessagePack;
using NodaTime;

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Artesian.SDK.Dto
{
Expand Down Expand Up @@ -56,7 +52,7 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version)
public LocalDateTime? Version { get; set; }

/// <summary>
/// The timezone. Must be the OriginalTimezone or, when Hourly, must be "UTC".
/// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET
/// </summary>
[Required]
[MessagePack.Key(2)]
Expand Down
10 changes: 4 additions & 6 deletions Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,22 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false,
/// </remarks>
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="timezone">For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
{
Ensure.Any.IsNotNull(_entity);

var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone;
var timeZone = DateTimeZoneProviders.Tzdb[tz];

var data = new DeleteCurveData(_identifier)
{
Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone,
Timezone = timezone,
// LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999.
// So we use default(LocalDateTime) 01/01/0001
RangeStart = rangeStart ?? default(LocalDateTime),
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtStartOfDayInZone(timeZone).LocalDateTime,
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtMidnight(),
DeferCommandExecution = deferCommandExecution,
DeferDataGeneration = deferDataGeneration,
};
Expand Down
10 changes: 4 additions & 6 deletions Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,22 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false,
/// </remarks>
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="timezone">For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
{
Ensure.Any.IsNotNull(_entity);

var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone;
var timeZone = DateTimeZoneProviders.Tzdb[tz];

var data = new DeleteCurveData(_identifier)
{
Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone,
Timezone = timezone,
// LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999.
// So we use default(LocalDateTime) 01/01/0001
RangeStart = rangeStart ?? default(LocalDateTime),
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtStartOfDayInZone(timeZone).LocalDateTime,
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtMidnight(),
DeferCommandExecution = deferCommandExecution,
DeferDataGeneration = deferDataGeneration,
};
Expand Down
11 changes: 5 additions & 6 deletions Artesian/Artesian.SDK/Factory/BidAsk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,23 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false,
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="product">Product of the BidAsk Time Serie</param>
/// <param name="timezone">For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List<string> product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List<string> product = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
{
Ensure.Any.IsNotNull(_entity);

var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone;
jacopocinaark marked this conversation as resolved.
Show resolved Hide resolved
var timeZone = DateTimeZoneProviders.Tzdb[tz];


var data = new DeleteCurveData(_identifier)
{
Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone,
Timezone = timezone,
// LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999.
// So we use default(LocalDateTime) 01/01/0001
RangeStart = rangeStart ?? default(LocalDateTime),
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtStartOfDayInZone(timeZone).LocalDateTime,
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtMidnight(),
DeferCommandExecution = deferCommandExecution,
DeferDataGeneration = deferDataGeneration,
Product = product,
Expand Down
9 changes: 5 additions & 4 deletions Artesian/Artesian.SDK/Factory/IMarketData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="product">Product of the MarketAssessment Time Serie</param>
/// <param name="timezone">Timezone of the delete range. Default is CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);
}

/// <summary>
Expand Down Expand Up @@ -237,7 +238,7 @@
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);

Check warning on line 241 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IBidAskWritable.Delete(LocalDateTime?, LocalDateTime?, List<string>, string, bool, bool, CancellationToken)' (but other parameters do)

Check warning on line 241 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IBidAskWritable.Delete(LocalDateTime?, LocalDateTime?, List<string>, string, bool, bool, CancellationToken)' (but other parameters do)

Check warning on line 241 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IBidAskWritable.Delete(LocalDateTime?, LocalDateTime?, List<string>, string, bool, bool, CancellationToken)' (but other parameters do)

Check warning on line 241 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IBidAskWritable.Delete(LocalDateTime?, LocalDateTime?, List<string>, string, bool, bool, CancellationToken)' (but other parameters do)
}
/// <summary>
/// Interface for Auction Bid Write
Expand Down Expand Up @@ -299,7 +300,7 @@
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); }
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); }

Check warning on line 303 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IAuctionMarketDataWritable.Delete(LocalDateTime?, LocalDateTime?, string, bool, bool, CancellationToken)' (but other parameters do)

Check warning on line 303 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'IAuctionMarketDataWritable.Delete(LocalDateTime?, LocalDateTime?, string, bool, bool, CancellationToken)' (but other parameters do)

/// <summary>
/// Interface for timeserie write
Expand Down Expand Up @@ -367,6 +368,6 @@
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);
Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default);

Check warning on line 371 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'ITimeserieWritable.Delete(LocalDateTime?, LocalDateTime?, string, bool, bool, CancellationToken)' (but other parameters do)

Check warning on line 371 in Artesian/Artesian.SDK/Factory/IMarketData.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'timezone' has no matching param tag in the XML comment for 'ITimeserieWritable.Delete(LocalDateTime?, LocalDateTime?, string, bool, bool, CancellationToken)' (but other parameters do)
}
}
10 changes: 4 additions & 6 deletions Artesian/Artesian.SDK/Factory/MarketAssessment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,22 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false,
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="product">Product of the MarketAssessment Time Serie</param>
/// <param name="timezone">For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List<string> product = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
{
Ensure.Any.IsNotNull(_entity);

var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone;
var timeZone = DateTimeZoneProviders.Tzdb[tz];

var data = new DeleteCurveData(_identifier)
{
Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone,
Timezone = timezone,
// LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999.
// So we use default(LocalDateTime) 01/01/0001
RangeStart = rangeStart ?? default(LocalDateTime),
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtStartOfDayInZone(timeZone).LocalDateTime,
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtMidnight(),
DeferCommandExecution = deferCommandExecution,
DeferDataGeneration = deferDataGeneration,
Product = product,
Expand Down
10 changes: 4 additions & 6 deletions Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,22 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false,
/// </remarks>
/// <param name="rangeStart">LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used)</param>
/// <param name="rangeEnd">LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used)</param>
/// <param name="timezone">For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET</param>
/// <param name="deferCommandExecution">DeferCommandExecution</param>
/// <param name="deferDataGeneration">DeferDataGeneration</param>
/// <param name="ctk">The Cancellation Token</param>
/// <returns></returns>
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default)
{
Ensure.Any.IsNotNull(_entity);

var tz = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone;
var timeZone = DateTimeZoneProviders.Tzdb[tz];

var data = new DeleteCurveData(_identifier)
{
Timezone = _entity.OriginalGranularity.IsTimeGranularity() ? "UTC" : _entity.OriginalTimezone,
Timezone = timezone,
// LocalDate.MinIsoValue has year -9998 and yearOfEra 9999. Using it without any string formatting, we got date 01-01-9999.
// So we use default(LocalDateTime) 01/01/0001
RangeStart = rangeStart ?? default(LocalDateTime),
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtStartOfDayInZone(timeZone).LocalDateTime,
RangeEnd = rangeEnd ?? LocalDateTime.MaxIsoValue.Date.AtMidnight(),
DeferCommandExecution = deferCommandExecution,
DeferDataGeneration = deferDataGeneration,
Version = SelectedVersion,
Expand Down
Loading