bot¶
- class whispertrades.bot.Adjustment(*, number: str, status: str, type: str, days_of_week: DaysOfWeek, days_to_expiration: int, time_of_day: AdjustmentTime, minimum_position_delta: str | None, maximum_position_delta: str | None, minimum_position_profit_percent: str | None, maximum_position_profit_percent: str | None, minimum_position_otm_percent: str | None, maximum_position_otm_percent: str | None, minimum_iv: float | None, maximum_iv: float | None, minimum_vix: float | None, maximum_vix: float | None, minimum_underlying_percent_move_from_open: str | None, maximum_underlying_percent_move_from_open: str | None, minimum_underlying_percent_move_from_close: str | None, maximum_underlying_percent_move_from_close: str | None, variables: list[BotVariable | None])[source]¶
Bases:
BaseModel- days_of_week : DaysOfWeek¶
- days_to_expiration : int¶
- maximum_iv : float | None¶
- maximum_position_delta : str | None¶
- maximum_position_otm_percent : str | None¶
- maximum_position_profit_percent : str | None¶
- maximum_underlying_percent_move_from_close : str | None¶
- maximum_underlying_percent_move_from_open : str | None¶
- maximum_vix : float | None¶
- minimum_iv : float | None¶
- minimum_position_delta : str | None¶
- minimum_position_otm_percent : str | None¶
- minimum_position_profit_percent : str | None¶
- minimum_underlying_percent_move_from_close : str | None¶
- minimum_underlying_percent_move_from_open : str | None¶
- minimum_vix : float | None¶
- number : str¶
- status : str¶
- time_of_day : AdjustmentTime¶
- type : str¶
- variables : list[BotVariable | None]¶
- class whispertrades.bot.AdjustmentTime(*, start_time: time, end_time: time | None)[source]¶
Bases:
BaseModel- end_time : time | None¶
- classmethod from_string(time_range_str: str) AdjustmentTime[source]¶
- start_time : time¶
- class whispertrades.bot.BasicBot(*, name: str, number: str)[source]¶
Bases:
BaseModel- name : str¶
- number : str¶
-
class whispertrades.bot.Bot(data: BotResponse, client: WTClient, auto_refresh: bool =
True)[source]¶ Bases:
object- adjustments : list[Adjustment | None]¶
Adjustments
- auto_refresh : bool¶
auto_refresh toggle inherited from WTClient
- broker_connection : BaseBrokerConnection¶
Broker connection for the bot
- can_disable : bool¶
If the bot can be enabled
- can_enable : bool¶
If the bot can be enabled
- close_all_positions()[source]¶
Close open position(s) for the bot. This is only valid during market hours and while the bot is set to Enabled or Disable on Close. Auth Required: Write Positions
- disable()[source]¶
Disable a bot that is currently enabled. If the bot has open positions, the bot will move to Disable on Close. If there are no open positions, the bot will move to Disabled. Auth Required: Write Bots
- disabled_at : datetime | None¶
Disabled time
- enable()[source]¶
Enable a bot that is currently disabled or disable on close Auth Required: Write Bots
- endpoint : str¶
- entry_condition : EntryCondition¶
Entry condition
- exit_condition : ExitCondition¶
Exit condition
- is_paper : bool¶
If the bot is paper trading
- last_active_at : datetime | None¶
Last active time
- name : str¶
Bot name
- notes : str | None¶
Bot notes
- notifications : list[Notification | None]¶
Notifications
- number : str¶
Bot number
- open_position()[source]¶
Open a new position for the bot. This is only valid during market hours, while the bot is enabled, and while the bot has no more than one position currently open. This API request will ignore any entry filters configured for the bot and will immediately enter a new position when submitted. Auth Required: Write Positions
- status : Literal['Enabled', 'Disabled', 'Disable on Close']¶
Bot status
- symbol : str¶
Instrument ticker for the bot
- type : str¶
Bot type
- variables : list[BotVariable | None]¶
Variables
-
class whispertrades.bot.BotResponse(*, name: str, number: str, broker_connection: BaseBrokerConnection, is_paper: bool, status: 'Enabled' | 'Disabled' | 'Disable on Close', can_enable: bool, can_disable: bool, symbol: str, type: str, notes: str | None, last_active_at: datetime | None, disabled_at: datetime | None, entry_condition: EntryCondition =
None, exit_condition: ExitCondition =None, adjustments: list[Adjustment | None] =None, notifications: list[Notification | None] =None, variables: list[BotVariable | None] =None)[source]¶ Bases:
BasicBot- adjustments : list[Adjustment | None]¶
- broker_connection : BaseBrokerConnection¶
- can_disable : bool¶
- can_enable : bool¶
- disabled_at : datetime | None¶
- entry_condition : EntryCondition¶
- exit_condition : ExitCondition¶
- is_paper : bool¶
- last_active_at : datetime | None¶
- notes : str | None¶
- notifications : list[Notification | None]¶
- status : Literal['Enabled', 'Disabled', 'Disable on Close']¶
- symbol : str¶
- type : str¶
- variables : list[BotVariable | None]¶
-
class whispertrades.bot.BotVariable(*, number: str, name: str, value: str | None, free_text_value: str | None =
None, last_updated_at: datetime | None =None, condition: 'Contains' | 'Equal To' | 'Not Equal To' | 'Less Than' | 'Greater Than' =None, bot_value_to_set: 'Free Text' | 'Bot Open Position Count' | 'Bot Positions Entered Today Count' | 'Bot Positions Exited Today Count' | 'Bot Current Position Delta' | 'Bot Current Position ITM %' | 'Bot Current Position MID Price' | 'Bot Current Position Minutes in Trade' | 'Bot Current Position Days in Trade' | 'Bot Current Position Minutes to Expiration' | 'Bot Current Position DTE' | 'Bot Current Position Profit $' | 'Bot Current Position Profit %' | 'Bot Last Closed Position Today Profit $' | 'Bot Profit Realized Today $' | None =None)[source]¶ Bases:
BaseVariable- bot_value_to_set : Literal['Free Text', 'Bot Open Position Count', 'Bot Positions Entered Today Count', 'Bot Positions Exited Today Count', 'Bot Current Position Delta', 'Bot Current Position ITM %', 'Bot Current Position MID Price', 'Bot Current Position Minutes in Trade', 'Bot Current Position Days in Trade', 'Bot Current Position Minutes to Expiration', 'Bot Current Position DTE', 'Bot Current Position Profit $', 'Bot Current Position Profit %', 'Bot Last Closed Position Today Profit $', 'Bot Profit Realized Today $'] | None¶
- condition : Literal['Contains', 'Equal To', 'Not Equal To', 'Less Than', 'Greater Than']¶
- class whispertrades.bot.DaysOfWeek(*, days_of_week: str)[source]¶
Bases:
BaseModel- days_of_week : str¶
- classmethod validate_days_of_week(days_of_week: str)[source]¶
- class whispertrades.bot.EntryCondition(*, frequency: 'Sequential' | 'Daily' | 'Weekly', allocation_type: 'Leverage Amount' | 'Contract Quantity' | 'Percent of Portfolio', contract_quantity: int | None, percent_of_portfolio: float | None, leverage_amount: float | None, long_call_ratio_quantity: int | None, short_call_ratio_quantity: int | None, long_put_ratio_quantity: int | None, short_put_ratio_quantity: int | None, entry_speed: 'Patient' | 'Normal' | 'Aggressive', maximum_concurrent_positions: int | None, maximum_entries_per_day: int, earliest_time_of_day: time | None, latest_time_of_day: time | None, day_of_week: 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | None, days_of_week: DaysOfWeek | None, minutes_between_positions: int, minimum_starting_premium: str | None, maximum_starting_premium: str | None, minimum_days_to_expiration: int, target_days_to_expiration: int, maximum_days_to_expiration: int, minimum_iv: float | None, maximum_iv: float | None, minimum_vix: float | None, maximum_vix: float | None, minimum_underlying_percent_move_from_open: str | None, maximum_underlying_percent_move_from_open: str | None, minimum_underlying_percent_move_from_close: str | None, maximum_underlying_percent_move_from_close: str | None, same_day_re_entry: 'Profit' | 'Loss' | None, avoid_fomc: str | None, move_strike_selection_with_conflict: bool, variables: list[BotVariable | None], call_short_strike_type: 'Delta' | 'Premium' | None, call_short_strike_minimum_delta: float | None, call_short_strike_target_delta: float | None, call_short_strike_maximum_delta: float | None, call_short_strike_minimum_premium: str | None, call_short_strike_target_premium: str | None, call_short_strike_maximum_premium: str | None, call_short_strike_percent_otm_minimum: str | None, call_short_strike_target_percent_otm: str | None, call_short_strike_percent_otm_maximum: str | None, call_long_strike_type: 'Delta' | 'Premium' | None, call_long_strike_minimum_delta: float | None, call_long_strike_target_delta: float | None, call_long_strike_maximum_delta: float | None, call_long_strike_minimum_premium: str | None, call_long_strike_target_premium: str | None, call_long_strike_maximum_premium: str | None, call_long_strike_percent_otm_minimum: str | None, call_long_strike_target_percent_otm: str | None, call_long_strike_percent_otm_maximum: str | None, call_spread_minimum_width_points: float | None, call_spread_target_width_points: float | None, call_spread_maximum_width_points: float | None, call_spread_minimum_width_percent: str | None, call_spread_target_width_percent: str | None, call_spread_maximum_width_percent: str | None, call_spread_strike_target_delta: float | None, call_spread_strike_target_premium: str | None, restrict_call_spread_width_by: 'Points' | 'Percent' | None, call_spread_smart_width: bool, put_short_strike_type: 'Delta' | 'Premium' | '% OTM' | None, put_short_strike_minimum_delta: float | None, put_short_strike_target_delta: float | None, put_short_strike_maximum_delta: float | None, put_short_strike_minimum_premium: str | None, put_short_strike_target_premium: str | None, put_short_strike_maximum_premium: str | None, put_short_strike_percent_otm_minimum: str | None, put_short_strike_target_percent_otm: str | None, put_short_strike_percent_otm_maximum: str | None, put_long_strike_type: 'Delta' | 'Premium' | '% OTM' | None, put_long_strike_minimum_delta: float | None, put_long_strike_target_delta: float | None, put_long_strike_maximum_delta: float | None, put_long_strike_minimum_premium: str | None, put_long_strike_target_premium: str | None, put_long_strike_maximum_premium: str | None, put_long_strike_percent_otm_minimum: str | None, put_long_strike_target_percent_otm: str | None, put_long_strike_percent_otm_maximum: str | None, put_spread_minimum_width_points: float | None, put_spread_target_width_points: float | None, put_spread_maximum_width_points: float | None, put_spread_minimum_width_percent: str | None, put_spread_target_width_percent: str | None, put_spread_maximum_width_percent: str | None, put_spread_strike_target_delta: float | None, put_spread_strike_target_premium: str | None, restrict_put_spread_width_by: 'Points' | 'Percent' | None, put_spread_smart_width: bool)[source]¶
Bases:
BaseModel- allocation_type : Literal['Leverage Amount', 'Contract Quantity', 'Percent of Portfolio']¶
- avoid_fomc : str | None¶
- call_long_strike_maximum_delta : float | None¶
- call_long_strike_minimum_delta : float | None¶
- call_long_strike_percent_otm_maximum : str | None¶
- call_long_strike_percent_otm_minimum : str | None¶
- call_long_strike_target_delta : float | None¶
- call_long_strike_target_percent_otm : str | None¶
- call_long_strike_type : Literal['Delta', 'Premium'] | None¶
- call_short_strike_maximum_delta : float | None¶
- call_short_strike_minimum_delta : float | None¶
- call_short_strike_percent_otm_maximum : str | None¶
- call_short_strike_percent_otm_minimum : str | None¶
- call_short_strike_target_delta : float | None¶
- call_short_strike_target_percent_otm : str | None¶
- call_short_strike_type : Literal['Delta', 'Premium'] | None¶
- call_spread_maximum_width_percent : str | None¶
- call_spread_maximum_width_points : float | None¶
- call_spread_minimum_width_percent : str | None¶
- call_spread_minimum_width_points : float | None¶
- call_spread_smart_width : bool¶
- call_spread_strike_target_delta : float | None¶
- call_spread_target_width_percent : str | None¶
- call_spread_target_width_points : float | None¶
- contract_quantity : int | None¶
- day_of_week : Literal['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] | None¶
- days_of_week : DaysOfWeek | None¶
- earliest_time_of_day : time | None¶
- entry_speed : Literal['Patient', 'Normal', 'Aggressive']¶
- frequency : Literal['Sequential', 'Daily', 'Weekly']¶
- latest_time_of_day : time | None¶
- leverage_amount : float | None¶
- long_call_ratio_quantity : int | None¶
- long_put_ratio_quantity : int | None¶
- maximum_concurrent_positions : int | None¶
- maximum_days_to_expiration : int¶
- maximum_entries_per_day : int¶
- maximum_iv : float | None¶
- maximum_underlying_percent_move_from_close : str | None¶
- maximum_underlying_percent_move_from_open : str | None¶
- maximum_vix : float | None¶
- minimum_days_to_expiration : int¶
- minimum_iv : float | None¶
- minimum_underlying_percent_move_from_close : str | None¶
- minimum_underlying_percent_move_from_open : str | None¶
- minimum_vix : float | None¶
- minutes_between_positions : int¶
- move_strike_selection_with_conflict : bool¶
- percent_of_portfolio : float | None¶
- put_long_strike_maximum_delta : float | None¶
- put_long_strike_minimum_delta : float | None¶
- put_long_strike_percent_otm_maximum : str | None¶
- put_long_strike_percent_otm_minimum : str | None¶
- put_long_strike_target_delta : float | None¶
- put_long_strike_target_percent_otm : str | None¶
- put_long_strike_type : Literal['Delta', 'Premium', '% OTM'] | None¶
- put_short_strike_maximum_delta : float | None¶
- put_short_strike_minimum_delta : float | None¶
- put_short_strike_percent_otm_maximum : str | None¶
- put_short_strike_percent_otm_minimum : str | None¶
- put_short_strike_target_delta : float | None¶
- put_short_strike_target_percent_otm : str | None¶
- put_short_strike_type : Literal['Delta', 'Premium', '% OTM'] | None¶
- put_spread_maximum_width_percent : str | None¶
- put_spread_maximum_width_points : float | None¶
- put_spread_minimum_width_percent : str | None¶
- put_spread_minimum_width_points : float | None¶
- put_spread_smart_width : bool¶
- put_spread_strike_target_delta : float | None¶
- put_spread_target_width_percent : str | None¶
- put_spread_target_width_points : float | None¶
- restrict_call_spread_width_by : Literal['Points', 'Percent'] | None¶
- restrict_put_spread_width_by : Literal['Points', 'Percent'] | None¶
- same_day_re_entry : Literal['Profit', 'Loss'] | None¶
- short_call_ratio_quantity : int | None¶
- short_put_ratio_quantity : int | None¶
- target_days_to_expiration : int¶
- variables : list[BotVariable | None]¶
- class whispertrades.bot.ExitCondition(*, exit_speed: 'Super Patient' | 'Patient' | 'Normal' | 'Aggressive' | 'Super Aggressive', profit_premium_value: str | None, profit_target_percent: str | None, stop_loss_percent: str | None, loss_premium_value: str | None, itm_percent_stop: str | None, otm_percent_stop: str | None, delta_stop: float | None, monitored_stop_sensitivity: 'Patient' | 'Normal' | 'Aggressive', trail_profit_percent_trigger: str | None, trail_profit_percent_amount: str | None, trail_profit_premium_trigger: str | None, trail_profit_premium_amount: str | None, variables: list[BotVariable | None], close_short_strike_only: bool, sell_abandoned_long_strike: bool, trailing_stop_sensitivity: 'Patient' | 'Normal' | 'Aggressive')[source]¶
Bases:
BaseModel- close_short_strike_only : bool¶
- delta_stop : float | None¶
- exit_speed : Literal['Super Patient', 'Patient', 'Normal', 'Aggressive', 'Super Aggressive']¶
- itm_percent_stop : str | None¶
- monitored_stop_sensitivity : Literal['Patient', 'Normal', 'Aggressive']¶
- otm_percent_stop : str | None¶
- profit_target_percent : str | None¶
- sell_abandoned_long_strike : bool¶
- stop_loss_percent : str | None¶
- trail_profit_percent_amount : str | None¶
- trail_profit_percent_trigger : str | None¶
- trailing_stop_sensitivity : Literal['Patient', 'Normal', 'Aggressive']¶
- variables : list[BotVariable | None]¶
- class whispertrades.bot.Notification(*, number: str, event: 'Order Placed' | 'Order Filled' | 'Order Canceled' | 'Position % In-the-Money' | 'Position % Loss' | 'Position % Profit' | 'Position Days to Expiration' | 'Position Delta (Loss)' | 'Position Expired', type: 'Email')[source]¶
Bases:
BaseModel- event : Literal['Order Placed', 'Order Filled', 'Order Canceled', 'Position % In-the-Money', 'Position % Loss', 'Position % Profit', 'Position Days to Expiration', 'Position Delta (Loss)', 'Position Expired']¶
- number : str¶
- type : Literal['Email']¶