Lean  $LEAN_TAG$
QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport Class Reference

Exports signals of desired positions to Collective2 API using JSON and HTTPS. Accepts signals in quantity(number of shares) i.e symbol:"SPY", quant:40 More...

Inheritance diagram for QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport:
[legend]

Classes

class  C2Symbol
 The Collective2 symbol More...
 
class  Collective2Position
 Stores position's needed information to be serialized in JSON format and then sent to Collective2 API More...
 

Public Member Functions

 Collective2SignalExport (string apiKey, int systemId)
 Collective2SignalExport constructor. It obtains the entry information for Collective2 API requests. See API documentation at https://trade.collective2.com/c2-api More...
 
override bool Send (SignalExportTargetParameters parameters)
 Creates a JSON message with the desired positions using the expected Collective2 API format and then sends it More...
 
- Public Member Functions inherited from QuantConnect.Algorithm.Framework.Portfolio.SignalExports.BaseSignalExport
void Dispose ()
 If created, dispose of HttpClient we used for the requests to the different 3rd party API's More...
 

Protected Member Functions

bool ConvertHoldingsToCollective2 (SignalExportTargetParameters parameters, out List< Collective2Position > positions)
 Converts a list of targets to a list of Collective2 positions More...
 
int ConvertPercentageToQuantity (IAlgorithm algorithm, PortfolioTarget target)
 Converts a given percentage of a position into the number of shares of it More...
 
string CreateMessage (List< Collective2Position > positions)
 Serializes the list of desired positions with the needed credentials in JSON format More...
 

Properties

override string Name = "Collective2" [get]
 The name of this signal export More...
 
- Properties inherited from QuantConnect.Algorithm.Framework.Portfolio.SignalExports.BaseSignalExport
abstract string Name [get]
 The name of this signal export More...
 
virtual HashSet< SecurityTypeAllowedSecurityTypes [get]
 Default hashset of allowed Security types More...
 

Additional Inherited Members

- Protected Attributes inherited from QuantConnect.Algorithm.Framework.Portfolio.SignalExports.BaseSignalExport
HttpClient HttpClient => _lazyClient.Value
 Property to access a HttpClient More...
 

Detailed Description

Exports signals of desired positions to Collective2 API using JSON and HTTPS. Accepts signals in quantity(number of shares) i.e symbol:"SPY", quant:40

Definition at line 32 of file Collective2SignalExport.cs.

Constructor & Destructor Documentation

◆ Collective2SignalExport()

QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.Collective2SignalExport ( string  apiKey,
int  systemId 
)

Collective2SignalExport constructor. It obtains the entry information for Collective2 API requests. See API documentation at https://trade.collective2.com/c2-api

Parameters
apiKeyAPI key provided by Collective2
systemIdTrading system's ID number

Definition at line 81 of file Collective2SignalExport.cs.

Member Function Documentation

◆ Send()

override bool QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.Send ( SignalExportTargetParameters  parameters)
virtual

Creates a JSON message with the desired positions using the expected Collective2 API format and then sends it

Parameters
parametersA list of holdings from the portfolio expected to be sent to Collective2 API and the algorithm being ran
Returns
True if the positions were sent correctly and Collective2 sent no errors, false otherwise

Reimplemented from QuantConnect.Algorithm.Framework.Portfolio.SignalExports.BaseSignalExport.

Definition at line 95 of file Collective2SignalExport.cs.

Here is the call graph for this function:

◆ ConvertHoldingsToCollective2()

bool QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.ConvertHoldingsToCollective2 ( SignalExportTargetParameters  parameters,
out List< Collective2Position positions 
)
protected

Converts a list of targets to a list of Collective2 positions

Parameters
parametersA list of targets from the portfolio expected to be sent to Collective2 API and the algorithm being ran
positionsA list of Collective2 positions
Returns
True if the given targets could be converted to a Collective2Position list, false otherwise

Definition at line 122 of file Collective2SignalExport.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConvertPercentageToQuantity()

int QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.ConvertPercentageToQuantity ( IAlgorithm  algorithm,
PortfolioTarget  target 
)
protected

Converts a given percentage of a position into the number of shares of it

Parameters
algorithmAlgorithm being ran
targetDesired position to be sent to the Collective2 API
Returns
Number of shares hold of the given position/returns>

Definition at line 207 of file Collective2SignalExport.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateMessage()

string QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.CreateMessage ( List< Collective2Position positions)
protected

Serializes the list of desired positions with the needed credentials in JSON format

Parameters
positionsList of Collective2 positions to be sent to Collective2 API
Returns
A JSON request string of the desired positions to be sent by a POST request to Collective2 API

Definition at line 223 of file Collective2SignalExport.cs.

Here is the caller graph for this function:

Property Documentation

◆ Name

override string QuantConnect.Algorithm.Framework.Portfolio.SignalExports.Collective2SignalExport.Name = "Collective2"
getprotected

The name of this signal export

Definition at line 57 of file Collective2SignalExport.cs.


The documentation for this class was generated from the following file: