Class: Tastytrade::Models::TradingStatus
- Defined in:
- lib/tastytrade/models/trading_status.rb
Overview
Represents the trading status and permissions for an account
Instance Attribute Summary collapse
-
#account_number ⇒ String
readonly
The account number.
-
#are_far_otm_net_options_restricted ⇒ Boolean
readonly
Whether far OTM net options are restricted.
-
#autotrade_account_type ⇒ String?
readonly
Type of autotrade account (optional).
-
#clearing_account_number ⇒ String?
readonly
Clearing account number (optional).
-
#clearing_aggregation_identifier ⇒ String?
readonly
Clearing aggregation identifier (optional).
-
#cmta_override ⇒ Integer?
readonly
CMTA override value (optional).
-
#day_trade_count ⇒ Integer?
readonly
Current day trade count (optional).
-
#enhanced_fraud_safeguards_enabled_at ⇒ Time?
readonly
When enhanced fraud safeguards were enabled (optional).
-
#equities_margin_calculation_type ⇒ String
readonly
Type of margin calculation for equities.
-
#fee_schedule_name ⇒ String
readonly
Fee schedule applied to the account.
-
#futures_margin_rate_multiplier ⇒ BigDecimal
readonly
Margin rate multiplier for futures.
-
#has_intraday_equities_margin ⇒ Boolean
readonly
Whether intraday equities margin is enabled.
-
#id ⇒ Integer
readonly
Trading status record ID.
-
#is_aggregated_at_clearing ⇒ Boolean
readonly
Whether account is aggregated at clearing.
-
#is_closed ⇒ Boolean
readonly
Whether the account is closed.
-
#is_closing_only ⇒ Boolean
readonly
Whether account is restricted to closing trades only.
-
#is_cryptocurrency_closing_only ⇒ Boolean?
readonly
Whether crypto is closing only (optional).
-
#is_cryptocurrency_enabled ⇒ Boolean
readonly
Whether cryptocurrency trading is enabled.
-
#is_equity_offering_closing_only ⇒ Boolean
readonly
Whether equity offerings are closing only.
-
#is_equity_offering_enabled ⇒ Boolean
readonly
Whether equity offerings are enabled.
-
#is_frozen ⇒ Boolean
readonly
Whether the account is frozen.
-
#is_full_equity_margin_required ⇒ Boolean
readonly
Whether full equity margin is required.
-
#is_futures_closing_only ⇒ Boolean
readonly
Whether futures are restricted to closing only.
-
#is_futures_enabled ⇒ Boolean
readonly
Whether futures trading is enabled.
-
#is_futures_intra_day_enabled ⇒ Boolean
readonly
Whether intraday futures trading is enabled.
-
#is_in_day_trade_equity_maintenance_call ⇒ Boolean
readonly
Whether account is in day trade equity maintenance call.
-
#is_in_margin_call ⇒ Boolean
readonly
Whether account is in margin call.
-
#is_pattern_day_trader ⇒ Boolean
readonly
Whether account is flagged as pattern day trader.
-
#is_portfolio_margin_enabled ⇒ Boolean?
readonly
Whether portfolio margin is enabled (optional).
-
#is_risk_reducing_only ⇒ Boolean?
readonly
Whether only risk-reducing trades are allowed (optional).
-
#is_roll_the_day_forward_enabled ⇒ Boolean
readonly
Whether roll the day forward is enabled.
-
#is_small_notional_futures_intra_day_enabled ⇒ Boolean
readonly
Whether small notional futures intraday is enabled.
-
#options_level ⇒ String
readonly
Options trading permission level.
-
#pdt_reset_on ⇒ Date?
readonly
Date when PDT flag will reset (optional).
-
#short_calls_enabled ⇒ Boolean
readonly
Whether short calls are enabled.
-
#small_notional_futures_margin_rate_multiplier ⇒ BigDecimal
readonly
Margin rate multiplier for small notional futures.
-
#updated_at ⇒ Time
readonly
When the trading status was last updated.
Attributes inherited from Base
Instance Method Summary collapse
-
#active_restrictions ⇒ Array<String>
Get a list of active restrictions.
-
#can_trade_cryptocurrency? ⇒ Boolean
Check if account can trade cryptocurrency.
-
#can_trade_futures? ⇒ Boolean
Check if account can trade futures.
-
#can_trade_options? ⇒ Boolean
Check if account can trade options at any level.
- #crypto_status ⇒ Object
-
#permissions_summary ⇒ Hash
Get trading permissions summary.
-
#restricted? ⇒ Boolean
Check if account has any trading restrictions.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Tastytrade::Models::Base
Instance Attribute Details
#account_number ⇒ String (readonly)
The account number
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def account_number @account_number end |
#are_far_otm_net_options_restricted ⇒ Boolean (readonly)
Whether far OTM net options are restricted
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def @are_far_otm_net_options_restricted end |
#autotrade_account_type ⇒ String? (readonly)
Type of autotrade account (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def autotrade_account_type @autotrade_account_type end |
#clearing_account_number ⇒ String? (readonly)
Clearing account number (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def clearing_account_number @clearing_account_number end |
#clearing_aggregation_identifier ⇒ String? (readonly)
Clearing aggregation identifier (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def clearing_aggregation_identifier @clearing_aggregation_identifier end |
#cmta_override ⇒ Integer? (readonly)
CMTA override value (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def cmta_override @cmta_override end |
#day_trade_count ⇒ Integer? (readonly)
Current day trade count (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def day_trade_count @day_trade_count end |
#enhanced_fraud_safeguards_enabled_at ⇒ Time? (readonly)
When enhanced fraud safeguards were enabled (optional)
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_type ⇒ String (readonly)
Type of margin calculation for equities
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def equities_margin_calculation_type @equities_margin_calculation_type end |
#fee_schedule_name ⇒ String (readonly)
Fee schedule applied to the account
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def fee_schedule_name @fee_schedule_name end |
#futures_margin_rate_multiplier ⇒ BigDecimal (readonly)
Margin rate multiplier for futures
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_margin ⇒ Boolean (readonly)
Whether intraday equities margin is enabled
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def has_intraday_equities_margin @has_intraday_equities_margin end |
#id ⇒ Integer (readonly)
Trading status record ID
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def id @id end |
#is_aggregated_at_clearing ⇒ Boolean (readonly)
Whether account 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_closed ⇒ Boolean (readonly)
Whether the account is closed
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def is_closed @is_closed end |
#is_closing_only ⇒ Boolean (readonly)
Whether account is restricted to closing trades only
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def is_closing_only @is_closing_only end |
#is_cryptocurrency_closing_only ⇒ Boolean? (readonly)
Whether crypto is closing only (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def is_cryptocurrency_closing_only @is_cryptocurrency_closing_only end |
#is_cryptocurrency_enabled ⇒ Boolean (readonly)
Whether cryptocurrency trading is 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_only ⇒ Boolean (readonly)
Whether equity offerings are 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_enabled ⇒ Boolean (readonly)
Whether equity offerings are enabled
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def is_equity_offering_enabled @is_equity_offering_enabled end |
#is_frozen ⇒ Boolean (readonly)
Whether the account is frozen
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def is_frozen @is_frozen end |
#is_full_equity_margin_required ⇒ Boolean (readonly)
Whether full equity margin is 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_only ⇒ Boolean (readonly)
Whether futures are restricted to 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_enabled ⇒ Boolean (readonly)
Whether futures trading is 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_enabled ⇒ Boolean (readonly)
Whether intraday futures trading is 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_call ⇒ Boolean (readonly)
Whether account 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_call ⇒ Boolean (readonly)
Whether account 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_trader ⇒ Boolean (readonly)
Whether account is flagged as 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_enabled ⇒ Boolean? (readonly)
Whether portfolio margin is enabled (optional)
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_only ⇒ Boolean? (readonly)
Whether only risk-reducing trades are allowed (optional)
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_enabled ⇒ Boolean (readonly)
Whether roll the day forward is 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_enabled ⇒ Boolean (readonly)
Whether small notional futures intraday is 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_level ⇒ String (readonly)
Options trading permission level
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def @options_level end |
#pdt_reset_on ⇒ Date? (readonly)
Date when PDT flag will reset (optional)
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def pdt_reset_on @pdt_reset_on end |
#short_calls_enabled ⇒ Boolean (readonly)
Whether short calls are 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_multiplier ⇒ BigDecimal (readonly)
Margin rate multiplier for small notional futures
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_at ⇒ Time (readonly)
When the trading status was last updated
51 52 53 |
# File 'lib/tastytrade/models/trading_status.rb', line 51 def updated_at @updated_at end |
Instance Method Details
#active_restrictions ⇒ Array<String>
Get a 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 restrictions end |
#can_trade_cryptocurrency? ⇒ Boolean
Check if account can trade cryptocurrency
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
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
71 72 73 |
# File 'lib/tastytrade/models/trading_status.rb', line 71 def !.nil? && != "No Permissions" end |
#crypto_status ⇒ Object
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_summary ⇒ Hash
Get trading permissions summary
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/tastytrade/models/trading_status.rb', line 119 def { options: ? : "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
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 |