Class: SchwabRb::DataObjects::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/schwab_rb/data_objects/option.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol:, underlying_symbol:, description:, strike:, put_call:, exchange_name:, bid:, ask:, last:, mark:, bid_size:, ask_size:, bid_ask_size:, last_size:, high_price:, low_price:, open_price:, close_price:, total_volume:, trade_time_in_long:, quote_time_in_long:, net_change:, volatility:, delta:, gamma:, theta:, vega:, rho:, open_interest:, time_value:, theoretical_option_value:, theoretical_volatility:, option_deliverables_list:, expiration_date:, days_to_expiration:, expiration_type:, last_trading_day:, multiplier:, settlement_type:, deliverable_note:, percent_change:, mark_change:, mark_percent_change:, intrinsic_value:, extrinsic_value:, option_root:, exercise_type:, high_52_week:, low_52_week:, non_standard:, in_the_money:) ⇒ Option

Returns a new instance of Option.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/schwab_rb/data_objects/option.rb', line 67

def initialize(
  symbol:, underlying_symbol:, description:, strike:, put_call:,
  exchange_name:, bid:, ask:, last:, mark:, bid_size:, ask_size:,
  bid_ask_size:, last_size:, high_price:, low_price:, open_price:,
  close_price:, total_volume:, trade_time_in_long:,
  quote_time_in_long:, net_change:, volatility:, delta:,
  gamma:, theta:, vega:, rho:, open_interest:, time_value:,
  theoretical_option_value:, theoretical_volatility:, option_deliverables_list:,
  expiration_date:, days_to_expiration:, expiration_type:, last_trading_day:, multiplier:,
  settlement_type:, deliverable_note:, percent_change:, mark_change:, mark_percent_change:, intrinsic_value:, extrinsic_value:, option_root:, exercise_type:, high_52_week:, low_52_week:, non_standard:, in_the_money:
)
  @symbol = symbol
  @underlying_symbol = underlying_symbol
  @description = description
  @strike = strike
  @put_call = put_call
  @exchange_name = exchange_name
  @bid = bid
  @ask = ask
  @last = last
  @mark = mark
  @bid_size = bid_size
  @ask_size = ask_size
  @bid_ask_size = bid_ask_size
  @last_size = last_size
  @high_price = high_price
  @low_price = low_price
  @open_price = open_price
  @close_price = close_price
  @total_volume = total_volume
  @trade_time_in_long = trade_time_in_long
  @quote_time_in_long = quote_time_in_long
  @net_change = net_change
  @volatility = volatility
  @delta = delta
  @gamma = gamma
  @theta = theta
  @vega = vega
  @rho = rho
  @open_interest = open_interest
  @time_value = time_value
  @theoretical_option_value = theoretical_option_value
  @theoretical_volatility = theoretical_volatility
  @option_deliverables_list = option_deliverables_list
  @expiration_date = expiration_date
  @days_to_expiration = days_to_expiration
  @expiration_type = expiration_type
  @last_trading_day = last_trading_day
  @multiplier = multiplier
  @settlement_type = settlement_type
  @deliverable_note = deliverable_note
  @percent_change = percent_change
  @mark_change = mark_change
  @mark_percent_change = mark_percent_change
  @intrinsic_value = intrinsic_value
  @extrinsic_value = extrinsic_value
  @option_root = option_root
  @exercise_type = exercise_type
  @high_52_week = high_52_week
  @low_52_week = low_52_week
  @non_standard = non_standard
  @in_the_money = in_the_money
end

Instance Attribute Details

#askObject (readonly)

Returns the value of attribute ask.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def ask
  @ask
end

#ask_sizeObject (readonly)

Returns the value of attribute ask_size.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def ask_size
  @ask_size
end

#bidObject (readonly)

Returns the value of attribute bid.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def bid
  @bid
end

#bid_ask_sizeObject (readonly)

Returns the value of attribute bid_ask_size.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def bid_ask_size
  @bid_ask_size
end

#bid_sizeObject (readonly)

Returns the value of attribute bid_size.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def bid_size
  @bid_size
end

#close_priceObject (readonly)

Returns the value of attribute close_price.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def close_price
  @close_price
end

#days_to_expirationObject (readonly)

Returns the value of attribute days_to_expiration.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def days_to_expiration
  @days_to_expiration
end

#deliverable_noteObject (readonly)

Returns the value of attribute deliverable_note.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def deliverable_note
  @deliverable_note
end

#deltaObject (readonly)

Returns the value of attribute delta.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def delta
  @delta
end

#descriptionObject (readonly)

Returns the value of attribute description.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def description
  @description
end

#exchange_nameObject (readonly)

Returns the value of attribute exchange_name.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def exchange_name
  @exchange_name
end

#exercise_typeObject (readonly)

Returns the value of attribute exercise_type.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def exercise_type
  @exercise_type
end

#expiration_dateObject (readonly)

Returns the value of attribute expiration_date.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def expiration_date
  @expiration_date
end

#expiration_typeObject (readonly)

Returns the value of attribute expiration_type.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def expiration_type
  @expiration_type
end

#extrinsic_valueObject (readonly)

Returns the value of attribute extrinsic_value.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def extrinsic_value
  @extrinsic_value
end

#gammaObject (readonly)

Returns the value of attribute gamma.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def gamma
  @gamma
end

#high_52_weekObject (readonly)

Returns the value of attribute high_52_week.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def high_52_week
  @high_52_week
end

#high_priceObject (readonly)

Returns the value of attribute high_price.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def high_price
  @high_price
end

#in_the_moneyObject (readonly)

Returns the value of attribute in_the_money.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def in_the_money
  @in_the_money
end

#intrinsic_valueObject (readonly)

Returns the value of attribute intrinsic_value.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def intrinsic_value
  @intrinsic_value
end

#lastObject (readonly)

Returns the value of attribute last.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def last
  @last
end

#last_sizeObject (readonly)

Returns the value of attribute last_size.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def last_size
  @last_size
end

#last_trading_dayObject (readonly)

Returns the value of attribute last_trading_day.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def last_trading_day
  @last_trading_day
end

#low_52_weekObject (readonly)

Returns the value of attribute low_52_week.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def low_52_week
  @low_52_week
end

#low_priceObject (readonly)

Returns the value of attribute low_price.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def low_price
  @low_price
end

#markObject (readonly)

Returns the value of attribute mark.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def mark
  @mark
end

#mark_changeObject (readonly)

Returns the value of attribute mark_change.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def mark_change
  @mark_change
end

#mark_percent_changeObject (readonly)

Returns the value of attribute mark_percent_change.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def mark_percent_change
  @mark_percent_change
end

#multiplierObject (readonly)

Returns the value of attribute multiplier.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def multiplier
  @multiplier
end

#net_changeObject (readonly)

Returns the value of attribute net_change.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def net_change
  @net_change
end

#non_standardObject (readonly)

Returns the value of attribute non_standard.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def non_standard
  @non_standard
end

#open_interestObject (readonly)

Returns the value of attribute open_interest.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def open_interest
  @open_interest
end

#open_priceObject (readonly)

Returns the value of attribute open_price.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def open_price
  @open_price
end

#option_deliverables_listObject (readonly)

Returns the value of attribute option_deliverables_list.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def option_deliverables_list
  @option_deliverables_list
end

#option_rootObject (readonly)

Returns the value of attribute option_root.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def option_root
  @option_root
end

#percent_changeObject (readonly)

Returns the value of attribute percent_change.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def percent_change
  @percent_change
end

#put_callObject (readonly)

Returns the value of attribute put_call.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def put_call
  @put_call
end

#quote_time_in_longObject (readonly)

Returns the value of attribute quote_time_in_long.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def quote_time_in_long
  @quote_time_in_long
end

#rhoObject (readonly)

Returns the value of attribute rho.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def rho
  @rho
end

#settlement_typeObject (readonly)

Returns the value of attribute settlement_type.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def settlement_type
  @settlement_type
end

#strikeObject (readonly)

Returns the value of attribute strike.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def strike
  @strike
end

#symbolObject (readonly)

Returns the value of attribute symbol.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def symbol
  @symbol
end

#theoretical_option_valueObject (readonly)

Returns the value of attribute theoretical_option_value.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def theoretical_option_value
  @theoretical_option_value
end

#theoretical_volatilityObject (readonly)

Returns the value of attribute theoretical_volatility.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def theoretical_volatility
  @theoretical_volatility
end

#thetaObject (readonly)

Returns the value of attribute theta.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def theta
  @theta
end

#time_valueObject (readonly)

Returns the value of attribute time_value.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def time_value
  @time_value
end

#total_volumeObject (readonly)

Returns the value of attribute total_volume.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def total_volume
  @total_volume
end

#trade_time_in_longObject (readonly)

Returns the value of attribute trade_time_in_long.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def trade_time_in_long
  @trade_time_in_long
end

#underlying_symbolObject (readonly)

Returns the value of attribute underlying_symbol.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def underlying_symbol
  @underlying_symbol
end

#vegaObject (readonly)

Returns the value of attribute vega.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def vega
  @vega
end

#volatilityObject (readonly)

Returns the value of attribute volatility.



131
132
133
# File 'lib/schwab_rb/data_objects/option.rb', line 131

def volatility
  @volatility
end

Class Method Details

.build(underyling_symbol, data) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/schwab_rb/data_objects/option.rb', line 10

def build(underyling_symbol, data)
  Option.new(
    symbol: data.fetch(:symbol),
    underlying_symbol: underyling_symbol,
    description: data.fetch(:description),
    strike: data.fetch(:strikePrice),
    put_call: data.fetch(:putCall),
    exchange_name: data.fetch(:exchangeName, nil),
    bid: data.fetch(:bid),
    ask: data.fetch(:ask),
    last: data.fetch(:last),
    mark: data.fetch(:mark),
    bid_size: data.fetch(:bidSize, nil),
    ask_size: data.fetch(:askSize, nil),
    bid_ask_size: data.fetch(:bidAskSize, nil),
    last_size: data.fetch(:lastSize, nil),
    high_price: data.fetch(:highPrice, nil),
    low_price: data.fetch(:lowPrice, nil),
    open_price: data.fetch(:openPrice, nil),
    close_price: data.fetch(:closePrice, nil),
    total_volume: data.fetch(:totalVolume, nil),
    trade_time_in_long: data.fetch(:tradeTimeInLong, nil),
    quote_time_in_long: data.fetch(:quoteTimeInLong, nil),
    net_change: data.fetch(:netChange, nil),
    volatility: data.fetch(:volatility, nil),
    delta: data.fetch(:delta, nil),
    gamma: data.fetch(:gamma, nil),
    theta: data.fetch(:theta, nil),
    vega: data.fetch(:vega, nil),
    rho: data.fetch(:rho, nil),
    open_interest: data.fetch(:openInterest, nil),
    time_value: data.fetch(:timeValue, nil),
    theoretical_option_value: data.fetch(:theoreticalOptionValue, nil),
    theoretical_volatility: data.fetch(:theoreticalVolatility, nil),
    option_deliverables_list: data.fetch(:optionDeliverablesList, nil),
    expiration_date: Date.parse(data.fetch(:expirationDate)),
    days_to_expiration: data.fetch(:daysToExpiration, nil),
    expiration_type: data.fetch(:expirationType, nil),
    last_trading_day: data.fetch(:lastTradingDay, nil),
    multiplier: data.fetch(:multiplier, nil),
    settlement_type: data.fetch(:settlementType, nil),
    deliverable_note: data.fetch(:deliverableNote, nil),
    percent_change: data.fetch(:percentChange, nil),
    mark_change: data.fetch(:markChange, nil),
    mark_percent_change: data.fetch(:markPercentChange, nil),
    intrinsic_value: data.fetch(:intrinsicValue, nil),
    extrinsic_value: data.fetch(:extrinsicValue, nil),
    option_root: data.fetch(:optionRoot, nil),
    exercise_type: data.fetch(:exerciseType, nil),
    high_52_week: data.fetch(:high52Week, nil),
    low_52_week: data.fetch(:low52Week, nil),
    non_standard: data.fetch(:nonStandard, nil),
    in_the_money: data.fetch(:inTheMoney, nil)
  )
end

Instance Method Details

#strike_priceObject



144
145
146
# File 'lib/schwab_rb/data_objects/option.rb', line 144

def strike_price
  strike
end