From 2ddc515d5ac946686e801807fcf8e6d56e0575a2 Mon Sep 17 00:00:00 2001 From: Alexandre Catarino Date: Tue, 28 Jan 2025 14:51:11 +0000 Subject: [PATCH] Adds Collective2 Payload To Logs With Debugging Enabled --- .../Portfolio/SignalExports/Collective2SignalExport.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Common/Algorithm/Framework/Portfolio/SignalExports/Collective2SignalExport.cs b/Common/Algorithm/Framework/Portfolio/SignalExports/Collective2SignalExport.cs index 71da9770d39d..b86f5946c351 100644 --- a/Common/Algorithm/Framework/Portfolio/SignalExports/Collective2SignalExport.cs +++ b/Common/Algorithm/Framework/Portfolio/SignalExports/Collective2SignalExport.cs @@ -274,14 +274,17 @@ private bool SendPositions(string message) //Parse it var responseObject = response.Content.ReadFromJsonAsync().Result; + //For debugging purposes, append the message sent to Collective2 to the algorithms log + var debuggingMessage = Logging.Log.DebuggingEnabled ? $" | Message={message}" : string.Empty; + if (!response.IsSuccessStatusCode) { - _algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}"); + _algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}{debuggingMessage}"); return false; } else if (responseObject.Results.Count > 0) { - _algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}"); + _algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}{debuggingMessage}"); } return true;