Skip to content

Commit

Permalink
Updating the logger to support Lambda output
Browse files Browse the repository at this point in the history
  • Loading branch information
mccaffers committed Feb 13, 2024
1 parent 4a117c9 commit dc470c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Interfaces/IRequestOpenTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace backtesting_engine.interfaces;

public interface IRequestOpenTrade
{
void Request(RequestObject reqObj);
Task Request(RequestObject reqObj);
}
4 changes: 3 additions & 1 deletion src/backtesting/Operations/RequestOpenTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ public RequestOpenTrade(IOpenOrder openOrder)
this.openOrder = openOrder;
}

public void Request(RequestObject reqObj)
public Task Request(RequestObject reqObj)
{

// Open trade validation
// If hours are between
// If X amount of trades are open

this.openOrder.Request(reqObj);

return Task.CompletedTask;
}

}
8 changes: 8 additions & 0 deletions src/utilities/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ public static class ConsoleLogger {

private static readonly bool systemLog;
private static readonly bool consoleLog;
private static readonly bool lambdaLog;

static ConsoleLogger () {
_ = bool.TryParse(EnvironmentVariables.Get("systemLog", true), out systemLog);
_ = bool.TryParse(EnvironmentVariables.Get("consoleLog", true), out consoleLog);
_ = bool.TryParse(EnvironmentVariables.Get("lambdaLog", true), out lambdaLog);
}

public static void SystemLog(string message){
Expand All @@ -22,4 +24,10 @@ public static class ConsoleLogger {
}
}

public static void Lambda(string message){
if(lambdaLog){
System.Console.WriteLine(message);
}
}

}

0 comments on commit dc470c2

Please sign in to comment.