Skip to content

BrokerageFactory

QuantConnect.Brokerages.BrokerageFactory

BrokerageFactory(brokerage_type: Type)

Bases: Object, IBrokerageFactory

Provides a base implementation of IBrokerageFactory that provides a helper for reading data from a job's brokerage data dictionary

Initializes a new instance of the BrokerageFactory class for the specified brokerage_type

This codeEntityType is protected.

Parameters:

Name Type Description Default
brokerage_type Type

The type of brokerage created by this factory

required

brokerage_type

brokerage_type: Type

Gets the type of brokerage produced by this factory

brokerage_data

brokerage_data: Dictionary[str, str]

Gets the brokerage data required to run the brokerage from configuration/disk

create_brokerage

create_brokerage(
    job: LiveNodePacket, algorithm: IAlgorithm
) -> IBrokerage

Creates a new IBrokerage instance

Parameters:

Name Type Description Default
job LiveNodePacket

The job packet to create the brokerage for

required
algorithm IAlgorithm

The algorithm instance

required

Returns:

Type Description
IBrokerage

A new brokerage instance.

create_brokerage_message_handler

create_brokerage_message_handler(
    algorithm: IAlgorithm,
    job: AlgorithmNodePacket,
    api: IApi,
) -> IBrokerageMessageHandler

Gets a brokerage message handler

dispose

dispose() -> None

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

get_brokerage_model

get_brokerage_model(
    order_provider: IOrderProvider,
) -> IBrokerageModel

Gets a brokerage model that can be used to model this brokerage's unique behaviors

Parameters:

Name Type Description Default
order_provider IOrderProvider

The order provider

required