Position#

class entities.position.Position(strategy, asset, quantity, orders=None, hold=0, available=0)#

Bases: object

This is a Position object. It is used to keep track of the quantity of an asset owned in a strategy. Position objects are retreived from the broker using the get_positions() or get_position() methods.

strategy#

The strategy that owns this position.

Type:

str

asset#

The asset that this position is for.

Type:

Asset

symbol#

The symbol of the asset. e.g. AAPL for Apple stock.

Type:

str

quantity#

The quantity of the asset owned.

Type:

float

orders#

The orders that have been executed for this position.

Type:

list of Order

add_order(order: Order, quantity: Decimal)#
property available#
get_selling_order(quote_asset=None)#

Returns an order that can be used to sell this position.

Parameters:

None

Returns:

order – An order that can be used to sell this position.

Return type:

Order

property hold#
property quantity#
value_type(value)#