From 467cd68e730fb56a65521752cb7be38de20a50b6 Mon Sep 17 00:00:00 2001 From: vlad zverzhkhovskiy Date: Wed, 27 Aug 2025 11:34:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/test.yaml | 9 +++++++++ .../Declisions/Utils/HistoryProcessingInstruments.cs | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/test.yaml diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml new file mode 100644 index 0000000..d537e66 --- /dev/null +++ b/.gitea/workflows/test.yaml @@ -0,0 +1,9 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." \ No newline at end of file diff --git a/KLHZ.Trader.Core/Declisions/Utils/HistoryProcessingInstruments.cs b/KLHZ.Trader.Core/Declisions/Utils/HistoryProcessingInstruments.cs index 28992cd..9563976 100644 --- a/KLHZ.Trader.Core/Declisions/Utils/HistoryProcessingInstruments.cs +++ b/KLHZ.Trader.Core/Declisions/Utils/HistoryProcessingInstruments.cs @@ -4,7 +4,7 @@ namespace KLHZ.Trader.Core.Declisions.Utils { internal static class HistoryProcessingInstruments { - internal static PeriodPricesInfo GetPriceDiffForTimeSpan(this PriceHistoryCacheUnit unit, TimeSpan timeShift, TimeSpan timeSpan) + internal static PeriodPricesInfo GetPriceDiffForTimeSpan(this PriceHistoryCacheUnit unit, TimeSpan timeShift, TimeSpan timeSpan, int? pointsShift = null) { var res = new PeriodPricesInfo(false, 0, 0, 0, 0, 0, timeSpan, 0); var data = unit.GetData(); @@ -19,9 +19,11 @@ namespace KLHZ.Trader.Core.Declisions.Utils var intervaEndIndex = -1; var intervaStartIndex = -1; + + int count = 0; for (int i = times.Length - 1; i > -1; i--) { - if (times[i] <= intervalEnd && intervaEndIndex < 0) + if ((times[i] <= intervalEnd || (pointsShift.HasValue && count < pointsShift.Value)) && intervaEndIndex < 0) { intervaEndIndex = i; } @@ -40,6 +42,7 @@ namespace KLHZ.Trader.Core.Declisions.Utils if (intervaStartIndex != intervaEndIndex && intervaEndIndex >= 0) break; } + count++; } if (intervaStartIndex >= 0 && intervaEndIndex >= 0)