code cleanup
test / deploy_trader_prod (push) Successful in 7m24s Details

dev
vlad zverzhkhovskiy 2025-10-14 18:01:35 +03:00
parent 4332e3b097
commit b3b7807249
2 changed files with 5 additions and 7 deletions

View File

@ -1,5 +1,4 @@
using Google.Protobuf.WellKnownTypes; using KLHZ.Trader.Core.Common.Extentions;
using KLHZ.Trader.Core.Common.Extentions;
using KLHZ.Trader.Core.Contracts.Common.Enums; using KLHZ.Trader.Core.Contracts.Common.Enums;
using KLHZ.Trader.Core.DataLayer; using KLHZ.Trader.Core.DataLayer;
using KLHZ.Trader.Core.Exchange.Extentions; using KLHZ.Trader.Core.Exchange.Extentions;
@ -10,7 +9,6 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Immutable; using System.Collections.Immutable;
using Telegram.Bot.Types;
using Tinkoff.InvestApi; using Tinkoff.InvestApi;
using Tinkoff.InvestApi.V1; using Tinkoff.InvestApi.V1;
using Asset = KLHZ.Trader.Core.Exchange.Models.AssetsAccounting.Asset; using Asset = KLHZ.Trader.Core.Exchange.Models.AssetsAccounting.Asset;
@ -215,7 +213,7 @@ namespace KLHZ.Trader.Core.Exchange.Services
AccountId = AccountId, AccountId = AccountId,
ConfirmMarginTrade = false, ConfirmMarginTrade = false,
InstrumentId = figi, InstrumentId = figi,
Direction = stopOrdersDirection, Direction = stopOrdersDirection,
PriceType = PriceType.Point, PriceType = PriceType.Point,
Quantity = count, Quantity = count,
StopOrderType = StopOrderType.StopLoss, StopOrderType = StopOrderType.StopLoss,

View File

@ -242,7 +242,7 @@ namespace KLHZ.Trader.Core.Exchange.Services
private async Task<ImmutableDictionary<TradingEvent, decimal>> CalcTimeWindowAverageValue(ITradeDataItem message) private async Task<ImmutableDictionary<TradingEvent, decimal>> CalcTimeWindowAverageValue(ITradeDataItem message)
{ {
var res = TraderUtils.GetInitDict(Constants.BlockingCoefficient); var res = TraderUtils.GetInitDict(Constants.BlockingCoefficient);
var cacheSize = TimeSpan.FromSeconds(60*60); var cacheSize = TimeSpan.FromSeconds(60 * 60);
var data = await _tradeDataProvider.GetDataForTimeWindow(message.Figi, cacheSize, selector: (i) => i.Direction == 1); var data = await _tradeDataProvider.GetDataForTimeWindow(message.Figi, cacheSize, selector: (i) => i.Direction == 1);
var closings = MovingAverage.CheckByWindowAverageMean2(data, data.Length, 15, 300, -5m, 5m); var closings = MovingAverage.CheckByWindowAverageMean2(data, data.Length, 15, 300, -5m, 5m);
//var re = MovingAverage.CheckByWindowAverageMean2(data, 100, 15, 300, -4m, 4m); //var re = MovingAverage.CheckByWindowAverageMean2(data, 100, 15, 300, -4m, 4m);
@ -678,8 +678,8 @@ namespace KLHZ.Trader.Core.Exchange.Services
.ToArray(); .ToArray();
if (message.Price >= levelsByTime[0].LowValue && message.Price < levelsByTime[0].HighValue) if (message.Price >= levelsByTime[0].LowValue && message.Price < levelsByTime[0].HighValue)
{ {
longStopLossShift = message.Price - levelsByTime[0].LowValue+ additionalShift; longStopLossShift = message.Price - levelsByTime[0].LowValue + additionalShift;
shortStopLossShift = levelsByTime[0].HighValue - message.Price+ additionalShift; shortStopLossShift = levelsByTime[0].HighValue - message.Price + additionalShift;
} }
else else
{ {