From 6503db2f53df0e16a5ec8da03fecb0639bdd15ba Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Wed, 19 Jun 2024 13:09:11 +0200 Subject: [PATCH 1/5] feat(deletetimezone): Added CET default Timezone for delete ref: #17577 --- Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index 5a59a5b..9151a5e 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -56,11 +56,11 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version) public LocalDateTime? Version { get; set; } /// - /// The timezone. Must be the OriginalTimezone or, when Hourly, must be "UTC". + /// The timezone of the Range to delete. It is applied only if the curve Granularity is less than Day. Default is CET /// [Required] [MessagePack.Key(2)] - public string Timezone { get; set; } + public string Timezone { get; set; } = "CET"; /// /// Start date of range to be deleted From 2ef01235079d7229360440b39f1e1d8f2fdd9626 Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Thu, 20 Jun 2024 16:06:06 +0200 Subject: [PATCH 2/5] fix: default timezone to CET ref: #17577 --- .../Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs | 2 +- Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/BidAsk.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/IMarketData.cs | 9 +++++---- Artesian/Artesian.SDK/Factory/MarketAssessment.cs | 8 ++++---- Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs | 8 ++++---- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index 9151a5e..e0d6be4 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -60,7 +60,7 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version) /// [Required] [MessagePack.Key(2)] - public string Timezone { get; set; } = "CET"; + public string Timezone { get; set; } /// /// Start date of range to be deleted diff --git a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs index ce788b8..d815077 100644 --- a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs @@ -150,20 +150,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - 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 = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; 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), diff --git a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs index cef394c..68dfd6e 100644 --- a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs @@ -162,20 +162,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - 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 = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; 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), diff --git a/Artesian/Artesian.SDK/Factory/BidAsk.cs b/Artesian/Artesian.SDK/Factory/BidAsk.cs index 03cfd44..a298708 100644 --- a/Artesian/Artesian.SDK/Factory/BidAsk.cs +++ b/Artesian/Artesian.SDK/Factory/BidAsk.cs @@ -153,20 +153,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the BidAsk Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, string timezone = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; 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), diff --git a/Artesian/Artesian.SDK/Factory/IMarketData.cs b/Artesian/Artesian.SDK/Factory/IMarketData.cs index 9524591..9086661 100644 --- a/Artesian/Artesian.SDK/Factory/IMarketData.cs +++ b/Artesian/Artesian.SDK/Factory/IMarketData.cs @@ -169,11 +169,12 @@ public interface IMarketAssessmentWritable /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } /// @@ -237,7 +238,7 @@ public interface IBidAskWritable /// DeferDataGeneration /// The Cancellation Token /// - Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); + Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default); } /// /// Interface for Auction Bid Write @@ -299,7 +300,7 @@ public interface IAuctionMarketDataWritable /// DeferDataGeneration /// The Cancellation Token /// - 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); } /// /// Interface for timeserie write @@ -367,6 +368,6 @@ public interface ITimeserieWritable /// DeferDataGeneration /// The Cancellation Token /// - 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); } } \ No newline at end of file diff --git a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs index f527724..6270234 100644 --- a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs +++ b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs @@ -154,20 +154,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; 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), diff --git a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs index bffa75f..5191cf6 100644 --- a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs @@ -175,20 +175,20 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) + /// Timezone of the delete range. Default is CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - 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 = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; 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), From b40d27a5ff8ea4d485163e1f913b6f190d8cd351 Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Fri, 21 Jun 2024 10:51:20 +0200 Subject: [PATCH 3/5] fix --- .../Dto/DeleteCurveData/DeleteCurveData.cs | 2 +- Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs | 14 +++++++++++--- Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs | 13 ++++++++++--- Artesian/Artesian.SDK/Factory/BidAsk.cs | 13 ++++++++++--- Artesian/Artesian.SDK/Factory/MarketAssessment.cs | 13 ++++++++++--- .../Artesian.SDK/Factory/VersionedTimeSerie.cs | 13 ++++++++++--- 6 files changed, 52 insertions(+), 16 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index e0d6be4..bb3b880 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -56,7 +56,7 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version) public LocalDateTime? Version { get; set; } /// - /// The timezone of the Range to delete. It is applied only if the curve Granularity is less than Day. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// [Required] [MessagePack.Key(2)] diff --git a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs index d815077..ee240d6 100644 --- a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs @@ -150,16 +150,24 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; + var tz = (string.IsNullOrEmpty(timezone) + && _entity.OriginalGranularity.IsTimeGranularity()) + ? "CET" + : (string.IsNullOrEmpty(timezone) + && !_entity.OriginalGranularity.IsTimeGranularity()) + ? _entity.OriginalTimezone + : timezone; + + var timeZone = DateTimeZoneProviders.Tzdb[tz]; var data = new DeleteCurveData(_identifier) { diff --git a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs index 68dfd6e..f4eeb72 100644 --- a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs @@ -162,16 +162,23 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; + var tz = (string.IsNullOrEmpty(timezone) + && _entity.OriginalGranularity.IsTimeGranularity()) + ? "CET" + : (string.IsNullOrEmpty(timezone) + && !_entity.OriginalGranularity.IsTimeGranularity()) + ? _entity.OriginalTimezone + : timezone; + var timeZone = DateTimeZoneProviders.Tzdb[tz]; var data = new DeleteCurveData(_identifier) { diff --git a/Artesian/Artesian.SDK/Factory/BidAsk.cs b/Artesian/Artesian.SDK/Factory/BidAsk.cs index a298708..bd9ab79 100644 --- a/Artesian/Artesian.SDK/Factory/BidAsk.cs +++ b/Artesian/Artesian.SDK/Factory/BidAsk.cs @@ -153,16 +153,23 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the BidAsk Time Serie - /// Timezone of the delete range. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, List product = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var timeZone = DateTimeZoneProviders.Tzdb[timezone]; + var tz = (string.IsNullOrEmpty(timezone) + && _entity.OriginalGranularity.IsTimeGranularity()) + ? "CET" + : (string.IsNullOrEmpty(timezone) + && !_entity.OriginalGranularity.IsTimeGranularity()) + ? _entity.OriginalTimezone + : timezone; + var timeZone = DateTimeZoneProviders.Tzdb[tz]; var data = new DeleteCurveData(_identifier) { diff --git a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs index 6270234..1576a42 100644 --- a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs +++ b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs @@ -154,16 +154,23 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie - /// Timezone of the delete range. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = "CET", bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) + public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, List product = null, string timezone = null, bool deferCommandExecution = false, bool deferDataGeneration = true, CancellationToken ctk = default) { Ensure.Any.IsNotNull(_entity); - var timeZone = DateTimeZoneProviders.Tzdb[timezone]; + var tz = (string.IsNullOrEmpty(timezone) + && _entity.OriginalGranularity.IsTimeGranularity()) + ? "CET" + : (string.IsNullOrEmpty(timezone) + && !_entity.OriginalGranularity.IsTimeGranularity()) + ? _entity.OriginalTimezone + : timezone; + var timeZone = DateTimeZoneProviders.Tzdb[tz]; var data = new DeleteCurveData(_identifier) { diff --git a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs index 5191cf6..473aa42 100644 --- a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs @@ -175,16 +175,23 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. Default is CET + /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token /// - public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeEnd = null, string timezone = "CET", 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 timeZone = DateTimeZoneProviders.Tzdb[timezone]; + var tz = (string.IsNullOrEmpty(timezone) + && _entity.OriginalGranularity.IsTimeGranularity()) + ? "CET" + : (string.IsNullOrEmpty(timezone) + && !_entity.OriginalGranularity.IsTimeGranularity()) + ? _entity.OriginalTimezone + : timezone; + var timeZone = DateTimeZoneProviders.Tzdb[tz]; var data = new DeleteCurveData(_identifier) { From f1c3e7b278ead8bc32721c2734d0e54277a6d416 Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Fri, 21 Jun 2024 17:43:18 +0200 Subject: [PATCH 4/5] fix: comments --- .../Dto/DeleteCurveData/DeleteCurveData.cs | 3 ++- Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs | 14 ++------------ Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs | 13 ++----------- Artesian/Artesian.SDK/Factory/BidAsk.cs | 14 +++----------- Artesian/Artesian.SDK/Factory/MarketAssessment.cs | 13 ++----------- .../Artesian.SDK/Factory/VersionedTimeSerie.cs | 13 ++----------- 6 files changed, 13 insertions(+), 57 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index bb3b880..bc2009e 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace Artesian.SDK.Dto { @@ -56,7 +57,7 @@ public DeleteCurveData(MarketDataIdentifier id, LocalDateTime version) public LocalDateTime? Version { get; set; } /// - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// [Required] [MessagePack.Key(2)] diff --git a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs index ee240d6..235bb46 100644 --- a/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs @@ -150,7 +150,7 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token @@ -159,23 +159,13 @@ public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeE { Ensure.Any.IsNotNull(_entity); - var tz = (string.IsNullOrEmpty(timezone) - && _entity.OriginalGranularity.IsTimeGranularity()) - ? "CET" - : (string.IsNullOrEmpty(timezone) - && !_entity.OriginalGranularity.IsTimeGranularity()) - ? _entity.OriginalTimezone - : timezone; - - var timeZone = DateTimeZoneProviders.Tzdb[tz]; - var data = new DeleteCurveData(_identifier) { 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, }; diff --git a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs index f4eeb72..0133ecb 100644 --- a/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/AuctionTimeSerie.cs @@ -162,7 +162,7 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token @@ -171,22 +171,13 @@ public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeE { Ensure.Any.IsNotNull(_entity); - var tz = (string.IsNullOrEmpty(timezone) - && _entity.OriginalGranularity.IsTimeGranularity()) - ? "CET" - : (string.IsNullOrEmpty(timezone) - && !_entity.OriginalGranularity.IsTimeGranularity()) - ? _entity.OriginalTimezone - : timezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; - var data = new DeleteCurveData(_identifier) { 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, }; diff --git a/Artesian/Artesian.SDK/Factory/BidAsk.cs b/Artesian/Artesian.SDK/Factory/BidAsk.cs index bd9ab79..22a019b 100644 --- a/Artesian/Artesian.SDK/Factory/BidAsk.cs +++ b/Artesian/Artesian.SDK/Factory/BidAsk.cs @@ -153,7 +153,7 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the BidAsk Time Serie - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token @@ -162,22 +162,14 @@ public async Task Delete(LocalDateTime? rangeStart, LocalDateTime? rangeEnd, Lis { Ensure.Any.IsNotNull(_entity); - var tz = (string.IsNullOrEmpty(timezone) - && _entity.OriginalGranularity.IsTimeGranularity()) - ? "CET" - : (string.IsNullOrEmpty(timezone) - && !_entity.OriginalGranularity.IsTimeGranularity()) - ? _entity.OriginalTimezone - : timezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; - + var data = new DeleteCurveData(_identifier) { 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, diff --git a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs index 1576a42..98b3a24 100644 --- a/Artesian/Artesian.SDK/Factory/MarketAssessment.cs +++ b/Artesian/Artesian.SDK/Factory/MarketAssessment.cs @@ -154,7 +154,7 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) /// Product of the MarketAssessment Time Serie - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token @@ -163,22 +163,13 @@ public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeE { Ensure.Any.IsNotNull(_entity); - var tz = (string.IsNullOrEmpty(timezone) - && _entity.OriginalGranularity.IsTimeGranularity()) - ? "CET" - : (string.IsNullOrEmpty(timezone) - && !_entity.OriginalGranularity.IsTimeGranularity()) - ? _entity.OriginalTimezone - : timezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; - var data = new DeleteCurveData(_identifier) { 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, diff --git a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs index 473aa42..7a548e3 100644 --- a/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs +++ b/Artesian/Artesian.SDK/Factory/VersionedTimeSerie.cs @@ -175,7 +175,7 @@ public async Task Save(Instant downloadedAt, bool deferCommandExecution = false, /// /// LocalDateTime start of range to be deleted (in case of null, LocalDateTime MinIso value will be used) /// LocalDateTime end of range to be deleted (in case of null, LocalDateTime MaxIso value will be used) - /// Timezone of the delete range. For DateSerie must be the OriginalTimezone of the Serie. In case null or empty the default is CET for TimeSerie and OriginalTimezone for DateSerie + /// For DateSeries if provided must be equal to MarketData OrignalTimezone Default:MarketData OrignalTimezone. For TimeSeries Default:CET /// DeferCommandExecution /// DeferDataGeneration /// The Cancellation Token @@ -184,22 +184,13 @@ public async Task Delete(LocalDateTime? rangeStart = null, LocalDateTime? rangeE { Ensure.Any.IsNotNull(_entity); - var tz = (string.IsNullOrEmpty(timezone) - && _entity.OriginalGranularity.IsTimeGranularity()) - ? "CET" - : (string.IsNullOrEmpty(timezone) - && !_entity.OriginalGranularity.IsTimeGranularity()) - ? _entity.OriginalTimezone - : timezone; - var timeZone = DateTimeZoneProviders.Tzdb[tz]; - var data = new DeleteCurveData(_identifier) { 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, From 457c51a5376eb47759fbd904739ec1b4e835efe5 Mon Sep 17 00:00:00 2001 From: Jacopo Cina Date: Tue, 25 Jun 2024 11:01:22 +0200 Subject: [PATCH 5/5] fix --- .../Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs index bc2009e..07d210e 100644 --- a/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs +++ b/Artesian/Artesian.SDK/Dto/DeleteCurveData/DeleteCurveData.cs @@ -1,15 +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; -using System.Windows.Forms; namespace Artesian.SDK.Dto {