сменил рабочие интервалы
test / deploy_trader_prod (push) Successful in 14m21s Details

dev
vlad zverzhkhovskiy 2025-09-09 15:29:56 +03:00
parent 389a6cbe88
commit bb7fd20225
3 changed files with 29 additions and 29 deletions

View File

@ -31,6 +31,10 @@
return (crossingTimestamp >= time1 && crossingTimestamp <= time2, crossingTimestamp, cross.y);
}
}
//else if (b1 == b2)
//{
// return (true, time2, val2_2);
//}
return (false, DateTime.MinValue, 0);
}
}

View File

@ -20,7 +20,9 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils
return (startTime, sum / count);
}
public static (TradingEvent events, decimal bigWindowAv, decimal smallWindowAv) CheckByWindowAverageMean(DateTime[] timestamps, decimal[] prices, int size, int smallWindow, int bigWindow, TimeSpan timeForUptreandStart, decimal downtrendStartingDetectionMeanfullStep = 3m, decimal uptrendEndingDetectionMeanfullStep = 3m)
public static (TradingEvent events, decimal bigWindowAv, decimal smallWindowAv) CheckByWindowAverageMean(DateTime[] timestamps,
decimal[] prices, int size, int smallWindow, int bigWindow, TimeSpan timeForUptreandStart,
decimal downtrendStartingDetectionMeanfullStep = 3m, decimal uptrendEndingDetectionMeanfullStep = 3m)
{
var res = TradingEvent.None;
var bigWindowAv = 0m;
@ -110,7 +112,7 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils
// если фильтрация окном 120 наползает на окно 15 сверху, потенциальное время открытия лонга и закрытия шорта
if (twavss[size - 1] >= twavbs[size - 1] && twavss[size - 2] < twavbs[size - 2])
{
if (pricesForFinalComparison[crossings[0]] - pricesForFinalComparison[crossings[1]] <= -downtrendStartingDetectionMeanfullStep
if (pricesForFinalComparison[crossings[0]] - pricesForFinalComparison[crossings[1]] <= downtrendStartingDetectionMeanfullStep
&& times[crossings[0]] - times[crossings[1]] >= timeForUptreandStart)
{
res |= TradingEvent.UptrendStart;

View File

@ -166,43 +166,37 @@ namespace KLHZ.Trader.Core.Exchange.Services
var fullData = await _tradeDataProvider.GetData(message.Figi, TimeSpan.FromMinutes(30));
if (fullData.isFullIntervalExists)
{
var max = fullData.prices.Max();
var min = fullData.prices.Min();
if (max - min < 15 && fullData.prices.Last() - fullData.prices.First() < 4 && fullData.prices.Last() - fullData.prices.First() > -4)
if (!message.IsHistoricalData && BotModeSwitcher.CanPurchase())
{
if (!message.IsHistoricalData && BotModeSwitcher.CanPurchase())
var accounts = _tradeDataProvider.Accounts
.Where(a => !a.Value.Assets.ContainsKey(message.Figi))
.ToArray();
var loggedDeclisions = 0;
foreach (var acc in accounts)
{
var accounts = _tradeDataProvider.Accounts
.Where(a => !a.Value.Assets.ContainsKey(message.Figi))
.ToArray();
var loggedDeclisions = 0;
foreach (var acc in accounts)
if (IsBuyAllowed(acc.Value, message.Value, 1, _accountCashPartFutures, _accountCashPart))
{
if (IsBuyAllowed(acc.Value, message.Value, 1, _accountCashPartFutures, _accountCashPart))
if (RandomNumberGenerator.GetInt32(100) > 50)
{
if (RandomNumberGenerator.GetInt32(100) > 50)
await _dataBus.Broadcast(new TradeCommand()
{
await _dataBus.Broadcast(new TradeCommand()
{
AccountId = acc.Value.AccountId,
Figi = message.Figi,
CommandType = Contracts.Messaging.Dtos.Enums.TradeCommandType.MarketBuy,
Count = 1,
RecomendPrice = null,
});
if (loggedDeclisions == 0)
{
await LogDeclision(DeclisionTradeAction.OpenLongReal, message);
OpeningStops[message.Figi] = DateTime.UtcNow.AddMinutes(1);
loggedDeclisions++;
}
AccountId = acc.Value.AccountId,
Figi = message.Figi,
CommandType = Contracts.Messaging.Dtos.Enums.TradeCommandType.MarketBuy,
Count = 1,
RecomendPrice = null,
});
if (loggedDeclisions == 0)
{
await LogDeclision(DeclisionTradeAction.OpenLongReal, message);
OpeningStops[message.Figi] = DateTime.UtcNow.AddMinutes(1);
loggedDeclisions++;
}
}
}
}
await LogDeclision(DeclisionTradeAction.OpenLong, message);
}
await LogDeclision(DeclisionTradeAction.OpenLong, message);
}
}