@@ -41,11 +41,6 @@ public class Collective2SignalExport : BaseSignalExport
4141 /// </summary>
4242 private readonly int _systemId ;
4343
44- /// <summary>
45- /// Collective2 API endpoint
46- /// </summary>
47- private readonly Uri _destination ;
48-
4944 /// <summary>
5045 /// Algorithm being ran
5146 /// </summary>
@@ -56,6 +51,11 @@ public class Collective2SignalExport : BaseSignalExport
5651 /// </summary>
5752 private bool _isZeroPriceWarningPrinted ;
5853
54+ /// <summary>
55+ /// Collective2 API endpoint
56+ /// </summary>
57+ public Uri Destination { get ; set ; }
58+
5959 /// <summary>
6060 /// The name of this signal export
6161 /// </summary>
@@ -83,18 +83,21 @@ public class Collective2SignalExport : BaseSignalExport
8383 /// </summary>
8484 /// <param name="apiKey">API key provided by Collective2</param>
8585 /// <param name="systemId">Trading system's ID number</param>
86- public Collective2SignalExport ( string apiKey , int systemId )
86+ /// <param name="useWhiteLabelApi">Whether to use the white-label API instead of the general one</param>
87+ public Collective2SignalExport ( string apiKey , int systemId , bool useWhiteLabelApi = false )
8788 {
8889 _apiKey = apiKey ;
8990 _systemId = systemId ;
90- _destination = new Uri ( "https://api4-general.collective2.com/Strategies/SetDesiredPositions" ) ;
91+ Destination = new Uri ( useWhiteLabelApi
92+ ? "https://api4-wl.collective2.com/Strategies/SetDesiredPositions"
93+ : "https://api4-general.collective2.com/Strategies/SetDesiredPositions" ) ;
9194 }
9295
9396 /// <summary>
9497 /// Creates a JSON message with the desired positions using the expected
9598 /// Collective2 API format and then sends it
9699 /// </summary>
97- /// <param name="parameters">A list of holdings from the portfolio
100+ /// <param name="parameters">A list of holdings from the portfolio
98101 /// expected to be sent to Collective2 API and the algorithm being ran</param>
99102 /// <returns>True if the positions were sent correctly and Collective2 sent no errors, false otherwise</returns>
100103 public override bool Send ( SignalExportTargetParameters parameters )
@@ -120,7 +123,7 @@ public override bool Send(SignalExportTargetParameters parameters)
120123 /// <summary>
121124 /// Converts a list of targets to a list of Collective2 positions
122125 /// </summary>
123- /// <param name="parameters">A list of targets from the portfolio
126+ /// <param name="parameters">A list of targets from the portfolio
124127 /// expected to be sent to Collective2 API and the algorithm being ran</param>
125128 /// <param name="positions">A list of Collective2 positions</param>
126129 /// <returns>True if the given targets could be converted to a Collective2Position list, false otherwise</returns>
@@ -266,7 +269,7 @@ private bool SendPositions(string message)
266269 HttpClient . DefaultRequestHeaders . Authorization = new System . Net . Http . Headers . AuthenticationHeaderValue ( "Bearer" , _apiKey ) ;
267270
268271 //Send the message
269- using HttpResponseMessage response = HttpClient . PostAsync ( _destination , httpMessage ) . Result ;
272+ using HttpResponseMessage response = HttpClient . PostAsync ( Destination , httpMessage ) . Result ;
270273
271274 //Parse it
272275 var responseObject = response . Content . ReadFromJsonAsync < C2Response > ( ) . Result ;
@@ -333,7 +336,7 @@ private class ResponseStatus
333336 {
334337 /* Example:
335338
336- "ResponseStatus":
339+ "ResponseStatus":
337340 {
338341 "ErrorCode": ""401",
339342 "Message": ""Unauthorized",
0 commit comments