sell_all_options

Sells all options based on the specified stock. For example, if you call this function with symbol set to “TWTR”, it will sell all options you own that is related to TWTR.

Syntax

Fields

Description

symbol(str)

Symbol of the stock to sell options for.

in_force(str)

Duration the order is in force. Choose from "gtc" (Good 'til canceled) or "gtd" (Good 'til date). Defaults to "gtc".

def sell_all_options(
    self, symbol: str = None, 
    in_force: str = "gtc"
):

in_force can be set to either “gtc” (Good ‘til canceled) or “gtd” (Good ‘til date). “gtd” will keep the sell order active until the current trading day ends. “gtc” will keep the sell order active until it is filled or manually canceled.

A sell order with the provided parameters will only be processed if the broker supports it. For example, trying to sell an option on Alpaca will result in an error, as Alpaca does not support options trading.

Returns

Returns a pyhton dictionary with the following keys and values:

Raises