Position¶
- class entities.position.Position(strategy, asset, quantity, orders=None, hold=0, available=0, avg_fill_price=None)¶
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
- symbol¶
The symbol of the asset. e.g. AAPL for Apple stock.
- Type:
str
- quantity¶
The quantity of the asset owned.
- Type:
float
- hold¶
The assets that are not free in the portfolio. (Crypto: only)
- Type:
float
- available¶
The assets that are free in the portfolio. (Crypto: only)
- Type:
float
- avg_fill_price¶
The average fill price of the position.
- Type:
float
- add_order(order: Order, quantity: Decimal = Decimal('0'))¶
- property available¶
- classmethod from_dict(data)¶
- 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:
- property hold¶
- property quantity¶
- to_dict()¶
- value_type(value)¶