Class: Tastytrade::Models::TradingStatus

Inherits:
Base
  • Object
show all
Defined in:
lib/tastytrade/models/trading_status.rb

Overview

Represents the trading status and permissions for an account

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Tastytrade::Models::Base

Instance Attribute Details

#account_numberString (readonly)

The account number

Returns:

  • (String)

    the current value of account_number



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def 
  @account_number
end

#are_far_otm_net_options_restrictedBoolean (readonly)

Whether far OTM net options are restricted

Returns:

  • (Boolean)

    the current value of are_far_otm_net_options_restricted



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def are_far_otm_net_options_restricted
  @are_far_otm_net_options_restricted
end

#autotrade_account_typeString? (readonly)

Type of autotrade account (optional)

Returns:

  • (String, nil)

    the current value of autotrade_account_type



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def 
  @autotrade_account_type
end

#clearing_account_numberString? (readonly)

Clearing account number (optional)

Returns:

  • (String, nil)

    the current value of clearing_account_number



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def 
  @clearing_account_number
end

#clearing_aggregation_identifierString? (readonly)

Clearing aggregation identifier (optional)

Returns:

  • (String, nil)

    the current value of clearing_aggregation_identifier



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def clearing_aggregation_identifier
  @clearing_aggregation_identifier
end

#cmta_overrideInteger? (readonly)

CMTA override value (optional)

Returns:

  • (Integer, nil)

    the current value of cmta_override



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def cmta_override
  @cmta_override
end

#day_trade_countInteger? (readonly)

Current day trade count (optional)

Returns:

  • (Integer, nil)

    the current value of day_trade_count



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def day_trade_count
  @day_trade_count
end

#enhanced_fraud_safeguards_enabled_atTime? (readonly)

When enhanced fraud safeguards were enabled (optional)

Returns:

  • (Time, nil)

    the current value of enhanced_fraud_safeguards_enabled_at



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def enhanced_fraud_safeguards_enabled_at
  @enhanced_fraud_safeguards_enabled_at
end

#equities_margin_calculation_typeString (readonly)

Type of margin calculation for equities

Returns:

  • (String)

    the current value of equities_margin_calculation_type



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def equities_margin_calculation_type
  @equities_margin_calculation_type
end

#fee_schedule_nameString (readonly)

Fee schedule applied to the account

Returns:

  • (String)

    the current value of fee_schedule_name



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def fee_schedule_name
  @fee_schedule_name
end

#futures_margin_rate_multiplierBigDecimal (readonly)

Margin rate multiplier for futures

Returns:

  • (BigDecimal)

    the current value of futures_margin_rate_multiplier



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def futures_margin_rate_multiplier
  @futures_margin_rate_multiplier
end

#has_intraday_equities_marginBoolean (readonly)

Whether intraday equities margin is enabled

Returns:

  • (Boolean)

    the current value of has_intraday_equities_margin



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def has_intraday_equities_margin
  @has_intraday_equities_margin
end

#idInteger (readonly)

Trading status record ID

Returns:

  • (Integer)

    the current value of id



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def id
  @id
end

#is_aggregated_at_clearingBoolean (readonly)

Whether account is aggregated at clearing

Returns:

  • (Boolean)

    the current value of is_aggregated_at_clearing



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_aggregated_at_clearing
  @is_aggregated_at_clearing
end

#is_closedBoolean (readonly)

Whether the account is closed

Returns:

  • (Boolean)

    the current value of is_closed



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_closed
  @is_closed
end

#is_closing_onlyBoolean (readonly)

Whether account is restricted to closing trades only

Returns:

  • (Boolean)

    the current value of is_closing_only



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_closing_only
  @is_closing_only
end

#is_cryptocurrency_closing_onlyBoolean? (readonly)

Whether crypto is closing only (optional)

Returns:

  • (Boolean, nil)

    the current value of is_cryptocurrency_closing_only



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_cryptocurrency_closing_only
  @is_cryptocurrency_closing_only
end

#is_cryptocurrency_enabledBoolean (readonly)

Whether cryptocurrency trading is enabled

Returns:

  • (Boolean)

    the current value of is_cryptocurrency_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_cryptocurrency_enabled
  @is_cryptocurrency_enabled
end

#is_equity_offering_closing_onlyBoolean (readonly)

Whether equity offerings are closing only

Returns:

  • (Boolean)

    the current value of is_equity_offering_closing_only



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_equity_offering_closing_only
  @is_equity_offering_closing_only
end

#is_equity_offering_enabledBoolean (readonly)

Whether equity offerings are enabled

Returns:

  • (Boolean)

    the current value of is_equity_offering_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_equity_offering_enabled
  @is_equity_offering_enabled
end

#is_frozenBoolean (readonly)

Whether the account is frozen

Returns:

  • (Boolean)

    the current value of is_frozen



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_frozen
  @is_frozen
end

#is_full_equity_margin_requiredBoolean (readonly)

Whether full equity margin is required

Returns:

  • (Boolean)

    the current value of is_full_equity_margin_required



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_full_equity_margin_required
  @is_full_equity_margin_required
end

#is_futures_closing_onlyBoolean (readonly)

Whether futures are restricted to closing only

Returns:

  • (Boolean)

    the current value of is_futures_closing_only



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_futures_closing_only
  @is_futures_closing_only
end

#is_futures_enabledBoolean (readonly)

Whether futures trading is enabled

Returns:

  • (Boolean)

    the current value of is_futures_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_futures_enabled
  @is_futures_enabled
end

#is_futures_intra_day_enabledBoolean (readonly)

Whether intraday futures trading is enabled

Returns:

  • (Boolean)

    the current value of is_futures_intra_day_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_futures_intra_day_enabled
  @is_futures_intra_day_enabled
end

#is_in_day_trade_equity_maintenance_callBoolean (readonly)

Whether account is in day trade equity maintenance call

Returns:

  • (Boolean)

    the current value of is_in_day_trade_equity_maintenance_call



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_in_day_trade_equity_maintenance_call
  @is_in_day_trade_equity_maintenance_call
end

#is_in_margin_callBoolean (readonly)

Whether account is in margin call

Returns:

  • (Boolean)

    the current value of is_in_margin_call



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_in_margin_call
  @is_in_margin_call
end

#is_pattern_day_traderBoolean (readonly)

Whether account is flagged as pattern day trader

Returns:

  • (Boolean)

    the current value of is_pattern_day_trader



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_pattern_day_trader
  @is_pattern_day_trader
end

#is_portfolio_margin_enabledBoolean? (readonly)

Whether portfolio margin is enabled (optional)

Returns:

  • (Boolean, nil)

    the current value of is_portfolio_margin_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_portfolio_margin_enabled
  @is_portfolio_margin_enabled
end

#is_risk_reducing_onlyBoolean? (readonly)

Whether only risk-reducing trades are allowed (optional)

Returns:

  • (Boolean, nil)

    the current value of is_risk_reducing_only



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_risk_reducing_only
  @is_risk_reducing_only
end

#is_roll_the_day_forward_enabledBoolean (readonly)

Whether roll the day forward is enabled

Returns:

  • (Boolean)

    the current value of is_roll_the_day_forward_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_roll_the_day_forward_enabled
  @is_roll_the_day_forward_enabled
end

#is_small_notional_futures_intra_day_enabledBoolean (readonly)

Whether small notional futures intraday is enabled

Returns:

  • (Boolean)

    the current value of is_small_notional_futures_intra_day_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def is_small_notional_futures_intra_day_enabled
  @is_small_notional_futures_intra_day_enabled
end

#options_levelString (readonly)

Options trading permission level

Returns:

  • (String)

    the current value of options_level



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def options_level
  @options_level
end

#pdt_reset_onDate? (readonly)

Date when PDT flag will reset (optional)

Returns:

  • (Date, nil)

    the current value of pdt_reset_on



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def pdt_reset_on
  @pdt_reset_on
end

#short_calls_enabledBoolean (readonly)

Whether short calls are enabled

Returns:

  • (Boolean)

    the current value of short_calls_enabled



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def short_calls_enabled
  @short_calls_enabled
end

#small_notional_futures_margin_rate_multiplierBigDecimal (readonly)

Margin rate multiplier for small notional futures

Returns:

  • (BigDecimal)

    the current value of small_notional_futures_margin_rate_multiplier



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def small_notional_futures_margin_rate_multiplier
  @small_notional_futures_margin_rate_multiplier
end

#updated_atTime (readonly)

When the trading status was last updated

Returns:

  • (Time)

    the current value of updated_at



51
52
53
# File 'lib/tastytrade/models/trading_status.rb', line 51

def updated_at
  @updated_at
end

Instance Method Details

#active_restrictionsArray<String>

Get a list of active restrictions

Returns:

  • (Array<String>)

    list of active restrictions



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/tastytrade/models/trading_status.rb', line 100

def active_restrictions
  restrictions = []
  restrictions << "Account Closed" if is_closed
  restrictions << "Account Frozen" if is_frozen
  restrictions << "Closing Only" if is_closing_only
  restrictions << "Margin Call" if is_in_margin_call
  restrictions << "Day Trade Equity Maintenance Call" if is_in_day_trade_equity_maintenance_call
  restrictions << "Risk Reducing Only" if is_risk_reducing_only
  restrictions << "Pattern Day Trader" if is_pattern_day_trader
  restrictions << "Futures Closing Only" if is_futures_closing_only
  restrictions << "Cryptocurrency Closing Only" if is_cryptocurrency_closing_only
  restrictions << "Equity Offering Closing Only" if is_equity_offering_closing_only
  restrictions << "Far OTM Net Options Restricted" if are_far_otm_net_options_restricted
  restrictions
end

#can_trade_cryptocurrency?Boolean

Check if account can trade cryptocurrency

Returns:

  • (Boolean)

    true if crypto trading is enabled and not closing only



85
86
87
# File 'lib/tastytrade/models/trading_status.rb', line 85

def can_trade_cryptocurrency?
  is_cryptocurrency_enabled && !is_cryptocurrency_closing_only
end

#can_trade_futures?Boolean

Check if account can trade futures

Returns:

  • (Boolean)

    true if futures trading is enabled and not closing only



78
79
80
# File 'lib/tastytrade/models/trading_status.rb', line 78

def can_trade_futures?
  is_futures_enabled && !is_futures_closing_only
end

#can_trade_options?Boolean

Check if account can trade options at any level

Returns:

  • (Boolean)

    true if options trading is enabled



71
72
73
# File 'lib/tastytrade/models/trading_status.rb', line 71

def can_trade_options?
  !options_level.nil? && options_level != "No Permissions"
end

#crypto_statusObject



130
131
132
133
134
135
136
137
138
# File 'lib/tastytrade/models/trading_status.rb', line 130

def crypto_status
  if can_trade_cryptocurrency?
    "Enabled"
  elsif is_cryptocurrency_enabled
    "Closing Only"
  else
    "Disabled"
  end
end

#permissions_summaryHash

Get trading permissions summary

Returns:

  • (Hash)

    summary of trading permissions



119
120
121
122
123
124
125
126
127
128
# File 'lib/tastytrade/models/trading_status.rb', line 119

def permissions_summary
  {
    options: can_trade_options? ? options_level : "Disabled",
    futures: can_trade_futures? ? "Enabled" : (is_futures_enabled ? "Closing Only" : "Disabled"),
    cryptocurrency: crypto_status,
    short_calls: short_calls_enabled ? "Enabled" : "Disabled",
    pattern_day_trader: is_pattern_day_trader ? "Yes" : "No",
    portfolio_margin: is_portfolio_margin_enabled ? "Enabled" : "Disabled"
  }
end

#restricted?Boolean

Check if account has any trading restrictions

Returns:

  • (Boolean)

    true if account has restrictions



92
93
94
95
# File 'lib/tastytrade/models/trading_status.rb', line 92

def restricted?
  is_closed || is_frozen || is_closing_only || is_in_margin_call ||
    is_in_day_trade_equity_maintenance_call || is_risk_reducing_only == true
end