diff --git a/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/Enums/ValueAmplitudePosition.cs b/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/Enums/ValueAmplitudePosition.cs index 279b5b1..d5ce25b 100644 --- a/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/Enums/ValueAmplitudePosition.cs +++ b/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/Enums/ValueAmplitudePosition.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KLHZ.Trader.Core.Math.Declisions.Dtos.FFT.Enums +namespace KLHZ.Trader.Core.Math.Declisions.Dtos.FFT.Enums { public enum ValueAmplitudePosition { diff --git a/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/FFTAnalyzeResult.cs b/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/FFTAnalyzeResult.cs index 7f2d270..ff40b51 100644 --- a/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/FFTAnalyzeResult.cs +++ b/KLHZ.Trader.Core.Math/Declisions/Dtos/FFT/FFTAnalyzeResult.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KLHZ.Trader.Core.Math.Declisions.Dtos.FFT +namespace KLHZ.Trader.Core.Math.Declisions.Dtos.FFT { public class FFTAnalyzeResult { diff --git a/KLHZ.Trader.Core.Math/Declisions/Utils/FFT.cs b/KLHZ.Trader.Core.Math/Declisions/Utils/FFT.cs index 3c68256..f3acfc0 100644 --- a/KLHZ.Trader.Core.Math/Declisions/Utils/FFT.cs +++ b/KLHZ.Trader.Core.Math/Declisions/Utils/FFT.cs @@ -96,7 +96,7 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils var timeSpan = currentTime - startTime; for (int i = 0; i < harmonics.Length; i++) { - var value = - harmonics[i].Magnitude * System.Math.Sin(2 * System.Math.PI * timeSpan.TotalSeconds / harmonics[i].Period.TotalSeconds + harmonics[i].Phase); + var value = -harmonics[i].Magnitude * System.Math.Sin(2 * System.Math.PI * timeSpan.TotalSeconds / harmonics[i].Period.TotalSeconds + harmonics[i].Phase); sum += value; } return sum; diff --git a/KLHZ.Trader.Core.Math/Declisions/Utils/LocalTrends.cs b/KLHZ.Trader.Core.Math/Declisions/Utils/LocalTrends.cs index bc5ec5f..af287aa 100644 --- a/KLHZ.Trader.Core.Math/Declisions/Utils/LocalTrends.cs +++ b/KLHZ.Trader.Core.Math/Declisions/Utils/LocalTrends.cs @@ -51,7 +51,7 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils } } - if (x1.Count>1 && x2.Count > 1) + if (x1.Count > 1 && x2.Count > 1) { var line1 = Fit.Line(x1.ToArray(), y1.ToArray()); var line2 = Fit.Line(x2.ToArray(), y2.ToArray()); diff --git a/KLHZ.Trader.Core/Exchange/Services/Trader.cs b/KLHZ.Trader.Core/Exchange/Services/Trader.cs index c16b5cc..61def52 100644 --- a/KLHZ.Trader.Core/Exchange/Services/Trader.cs +++ b/KLHZ.Trader.Core/Exchange/Services/Trader.cs @@ -1,5 +1,4 @@ -using Google.Protobuf.WellKnownTypes; -using KLHZ.Trader.Core.Common; +using KLHZ.Trader.Core.Common; using KLHZ.Trader.Core.Contracts.Declisions.Dtos.Enums; using KLHZ.Trader.Core.Contracts.Messaging.Dtos; using KLHZ.Trader.Core.Contracts.Messaging.Dtos.Interfaces; @@ -20,7 +19,6 @@ using Microsoft.Extensions.Options; using System.Collections.Concurrent; using System.Security.Cryptography; using System.Threading.Channels; -using Telegram.Bot.Types; using Tinkoff.InvestApi; using AssetType = KLHZ.Trader.Core.Exchange.Models.AssetsAccounting.AssetType; @@ -181,7 +179,7 @@ namespace KLHZ.Trader.Core.Exchange.Services var su = sells + buys; if (su != 0) { - await LogPrice(message, "sellsbuysbalance", (sells / su - 0.5m)*2); + await LogPrice(message, "sellsbuysbalance", (sells / su - 0.5m) * 2); } } @@ -328,7 +326,7 @@ namespace KLHZ.Trader.Core.Exchange.Services private async Task CalcTrendDiff(INewPrice message) { var data = await _tradeDataProvider.GetData(message.Figi, TimeSpan.FromHours(1)); - if (data.isFullIntervalExists && LocalTrends.TryCalcTrendDiff(data.timestamps,data.prices, out var res)) + if (data.isFullIntervalExists && LocalTrends.TryCalcTrendDiff(data.timestamps, data.prices, out var res)) { return res; } @@ -363,7 +361,7 @@ namespace KLHZ.Trader.Core.Exchange.Services var assetType = _tradeDataProvider.GetAssetTypeByFigi(message.Figi); var res = mavTask.Result | ltTask.Result; - if ((res & TradingEvent.UptrendStart) == TradingEvent.UptrendStart + if ((res & TradingEvent.UptrendStart) == TradingEvent.UptrendStart && !LongOpeningStops.ContainsKey(message.Figi) && trendTask.Result.HasValue && trendTask.Result.Value > -5