Position management (#12)
* Update position worker * Update todo * Update todo * Update worker base url
This commit is contained in:
@@ -18,7 +18,7 @@ using OpenApiSecurityScheme = NSwag.OpenApiSecurityScheme;
|
||||
|
||||
// Builder
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.WebHost.UseUrls("http://localhost:5001");
|
||||
// builder.WebHost.UseUrls("http://localhost:5001");
|
||||
builder.Configuration.SetBasePath(AppContext.BaseDirectory);
|
||||
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json");
|
||||
|
||||
@@ -163,16 +163,18 @@ public class TradingBot : Bot, ITradingBot
|
||||
Logger.LogInformation(
|
||||
$"Time : {DateTime.Now} - Server time {DateTime.Now.ToUniversalTime()} - Bot : {Name} - Type {BotType} - Ticker : {Ticker}");
|
||||
|
||||
var previousCandleCount = OptimizedCandles.Count;
|
||||
|
||||
var previousLastCandle = OptimizedCandles.LastOrDefault();
|
||||
|
||||
if (!IsForBacktest)
|
||||
await UpdateCandles();
|
||||
|
||||
if (OptimizedCandles.Count > previousCandleCount || IsForBacktest)
|
||||
|
||||
var currentLastCandle = OptimizedCandles.LastOrDefault();
|
||||
|
||||
if (currentLastCandle != previousLastCandle || IsForBacktest)
|
||||
await UpdateSignals(OptimizedCandles);
|
||||
else
|
||||
Logger.LogInformation($"No need to update signals for {Ticker}");
|
||||
|
||||
|
||||
if (!IsForWatchingOnly)
|
||||
await ManagePositions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user