INNER CODE UNIT · Python
place_order
ldt9/PyOptionTrader · models/futures/short_strangle.py:385
def place_order(self, contract, order_type='short', order_style='bracket', take_profit_factor=0.50,
stop_loss_factor=3.00, use_vix_position_sizing=True, quantity=1):
'''
Place an order for the strangle strategy:
:param contract: contract to trade
:param order_type: type of order to place (long or short)
:param order_style: style of order to place (bracket, limit or market)
:param take_profit_factor: how much to take profit at
:param stop_loss_factor: how much to stop loss at
:param use_vix_position_sizing: whether to use vix position sizing or not
:param quantity: quantity of contracts to trade if not using VIX position sizing
'''
try:
# get the market price of the combo order
combobars = self.ib.reqHistoricalData(
contract=contract,