option_lab 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +139 -0
- data/.yard/hooks/before_generate.rb +7 -0
- data/.yardopts +11 -0
- data/Gemfile +26 -0
- data/LICENSE.txt +21 -0
- data/README.md +180 -0
- data/Rakefile +44 -0
- data/docs/OptionLab/BinomialTree.html +1271 -0
- data/docs/OptionLab/BjerksundStensland.html +2022 -0
- data/docs/OptionLab/BlackScholes.html +2388 -0
- data/docs/OptionLab/Engine.html +1716 -0
- data/docs/OptionLab/Models/AmericanModelInputs.html +937 -0
- data/docs/OptionLab/Models/ArrayInputs.html +463 -0
- data/docs/OptionLab/Models/BaseModel.html +223 -0
- data/docs/OptionLab/Models/BinomialModelInputs.html +1161 -0
- data/docs/OptionLab/Models/BlackScholesInfo.html +967 -0
- data/docs/OptionLab/Models/BlackScholesModelInputs.html +851 -0
- data/docs/OptionLab/Models/ClosedPosition.html +445 -0
- data/docs/OptionLab/Models/EngineData.html +2523 -0
- data/docs/OptionLab/Models/EngineDataResults.html +435 -0
- data/docs/OptionLab/Models/Inputs.html +2241 -0
- data/docs/OptionLab/Models/LaplaceInputs.html +777 -0
- data/docs/OptionLab/Models/Option.html +736 -0
- data/docs/OptionLab/Models/Outputs.html +1753 -0
- data/docs/OptionLab/Models/PoPOutputs.html +645 -0
- data/docs/OptionLab/Models/PricingResult.html +848 -0
- data/docs/OptionLab/Models/Stock.html +583 -0
- data/docs/OptionLab/Models/TreeVisualization.html +688 -0
- data/docs/OptionLab/Models.html +251 -0
- data/docs/OptionLab/Plotting.html +548 -0
- data/docs/OptionLab/Support.html +2884 -0
- data/docs/OptionLab/Utils.html +619 -0
- data/docs/OptionLab.html +133 -0
- data/docs/_index.html +376 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +503 -0
- data/docs/file.LICENSE.html +70 -0
- data/docs/file.README.html +263 -0
- data/docs/file_list.html +64 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +263 -0
- data/docs/js/app.js +344 -0
- data/docs/js/full_list.js +242 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1974 -0
- data/docs/top-level-namespace.html +110 -0
- data/examples/american_options.rb +163 -0
- data/examples/covered_call.rb +76 -0
- data/lib/option_lab/binomial_tree.rb +238 -0
- data/lib/option_lab/bjerksund_stensland.rb +276 -0
- data/lib/option_lab/black_scholes.rb +323 -0
- data/lib/option_lab/engine.rb +492 -0
- data/lib/option_lab/models.rb +768 -0
- data/lib/option_lab/plotting.rb +182 -0
- data/lib/option_lab/support.rb +471 -0
- data/lib/option_lab/utils.rb +107 -0
- data/lib/option_lab/version.rb +5 -0
- data/lib/option_lab.rb +134 -0
- data/option_lab.gemspec +43 -0
- metadata +207 -0
@@ -0,0 +1,736 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: OptionLab::Models::Option
|
8
|
+
|
9
|
+
— OptionLab Documentation
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "OptionLab::Models::Option";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (O)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../OptionLab.html" title="OptionLab (module)">OptionLab</a></span></span> » <span class='title'><span class='object_link'><a href="../Models.html" title="OptionLab::Models (module)">Models</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Option</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: OptionLab::Models::Option
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="BaseModel.html" title="OptionLab::Models::BaseModel (class)">BaseModel</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="BaseModel.html" title="OptionLab::Models::BaseModel (class)">BaseModel</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">OptionLab::Models::Option</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/option_lab/models.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
<p>Option position model</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
119
|
+
<ul class="summary">
|
120
|
+
|
121
|
+
<li class="public ">
|
122
|
+
<span class="summary_signature">
|
123
|
+
|
124
|
+
<a href="#action-instance_method" title="#action (instance method)">#<strong>action</strong> ⇒ Object </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute action.</p>
|
142
|
+
</div></span>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
146
|
+
|
147
|
+
<li class="public ">
|
148
|
+
<span class="summary_signature">
|
149
|
+
|
150
|
+
<a href="#expiration-instance_method" title="#expiration (instance method)">#<strong>expiration</strong> ⇒ Object </a>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
</span>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute expiration.</p>
|
168
|
+
</div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
<li class="public ">
|
174
|
+
<span class="summary_signature">
|
175
|
+
|
176
|
+
<a href="#n-instance_method" title="#n (instance method)">#<strong>n</strong> ⇒ Object </a>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
</span>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute n.</p>
|
194
|
+
</div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#premium-instance_method" title="#premium (instance method)">#<strong>premium</strong> ⇒ Object </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute premium.</p>
|
220
|
+
</div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#prev_pos-instance_method" title="#prev_pos (instance method)">#<strong>prev_pos</strong> ⇒ Object </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute prev_pos.</p>
|
246
|
+
</div></span>
|
247
|
+
|
248
|
+
</li>
|
249
|
+
|
250
|
+
|
251
|
+
<li class="public ">
|
252
|
+
<span class="summary_signature">
|
253
|
+
|
254
|
+
<a href="#strike-instance_method" title="#strike (instance method)">#<strong>strike</strong> ⇒ Object </a>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
</span>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute strike.</p>
|
272
|
+
</div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
<li class="public ">
|
278
|
+
<span class="summary_signature">
|
279
|
+
|
280
|
+
<a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> ⇒ Object </a>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
</span>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute type.</p>
|
298
|
+
</div></span>
|
299
|
+
|
300
|
+
</li>
|
301
|
+
|
302
|
+
|
303
|
+
</ul>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<h2>
|
310
|
+
Instance Method Summary
|
311
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
312
|
+
</h2>
|
313
|
+
|
314
|
+
<ul class="summary">
|
315
|
+
|
316
|
+
<li class="public ">
|
317
|
+
<span class="summary_signature">
|
318
|
+
|
319
|
+
<a href="#validate!-instance_method" title="#validate! (instance method)">#<strong>validate!</strong> ⇒ Object </a>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
</span>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
334
|
+
|
335
|
+
</li>
|
336
|
+
|
337
|
+
|
338
|
+
</ul>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
<div id="constructor_details" class="method_details_list">
|
344
|
+
<h2>Constructor Details</h2>
|
345
|
+
|
346
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="BaseModel.html#initialize-instance_method" title="OptionLab::Models::BaseModel#initialize (method)">OptionLab::Models::BaseModel</a></span></p>
|
347
|
+
|
348
|
+
</div>
|
349
|
+
|
350
|
+
<div id="instance_attr_details" class="attr_details">
|
351
|
+
<h2>Instance Attribute Details</h2>
|
352
|
+
|
353
|
+
|
354
|
+
<span id="action=-instance_method"></span>
|
355
|
+
<div class="method_details first">
|
356
|
+
<h3 class="signature first" id="action-instance_method">
|
357
|
+
|
358
|
+
#<strong>action</strong> ⇒ <tt>Object</tt>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</h3><div class="docstring">
|
365
|
+
<div class="discussion">
|
366
|
+
<p>Returns the value of attribute action.</p>
|
367
|
+
|
368
|
+
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
<div class="tags">
|
372
|
+
|
373
|
+
|
374
|
+
</div><table class="source_code">
|
375
|
+
<tr>
|
376
|
+
<td>
|
377
|
+
<pre class="lines">
|
378
|
+
|
379
|
+
|
380
|
+
50
|
381
|
+
51
|
382
|
+
52</pre>
|
383
|
+
</td>
|
384
|
+
<td>
|
385
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
386
|
+
|
387
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span>
|
388
|
+
<span class='ivar'>@action</span>
|
389
|
+
<span class='kw'>end</span></pre>
|
390
|
+
</td>
|
391
|
+
</tr>
|
392
|
+
</table>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
|
396
|
+
<span id="expiration=-instance_method"></span>
|
397
|
+
<div class="method_details ">
|
398
|
+
<h3 class="signature " id="expiration-instance_method">
|
399
|
+
|
400
|
+
#<strong>expiration</strong> ⇒ <tt>Object</tt>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
</h3><div class="docstring">
|
407
|
+
<div class="discussion">
|
408
|
+
<p>Returns the value of attribute expiration.</p>
|
409
|
+
|
410
|
+
|
411
|
+
</div>
|
412
|
+
</div>
|
413
|
+
<div class="tags">
|
414
|
+
|
415
|
+
|
416
|
+
</div><table class="source_code">
|
417
|
+
<tr>
|
418
|
+
<td>
|
419
|
+
<pre class="lines">
|
420
|
+
|
421
|
+
|
422
|
+
50
|
423
|
+
51
|
424
|
+
52</pre>
|
425
|
+
</td>
|
426
|
+
<td>
|
427
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
428
|
+
|
429
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_expiration'>expiration</span>
|
430
|
+
<span class='ivar'>@expiration</span>
|
431
|
+
<span class='kw'>end</span></pre>
|
432
|
+
</td>
|
433
|
+
</tr>
|
434
|
+
</table>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
|
438
|
+
<span id="n=-instance_method"></span>
|
439
|
+
<div class="method_details ">
|
440
|
+
<h3 class="signature " id="n-instance_method">
|
441
|
+
|
442
|
+
#<strong>n</strong> ⇒ <tt>Object</tt>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
</h3><div class="docstring">
|
449
|
+
<div class="discussion">
|
450
|
+
<p>Returns the value of attribute n.</p>
|
451
|
+
|
452
|
+
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
<div class="tags">
|
456
|
+
|
457
|
+
|
458
|
+
</div><table class="source_code">
|
459
|
+
<tr>
|
460
|
+
<td>
|
461
|
+
<pre class="lines">
|
462
|
+
|
463
|
+
|
464
|
+
50
|
465
|
+
51
|
466
|
+
52</pre>
|
467
|
+
</td>
|
468
|
+
<td>
|
469
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
470
|
+
|
471
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_n'>n</span>
|
472
|
+
<span class='ivar'>@n</span>
|
473
|
+
<span class='kw'>end</span></pre>
|
474
|
+
</td>
|
475
|
+
</tr>
|
476
|
+
</table>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
<span id="premium=-instance_method"></span>
|
481
|
+
<div class="method_details ">
|
482
|
+
<h3 class="signature " id="premium-instance_method">
|
483
|
+
|
484
|
+
#<strong>premium</strong> ⇒ <tt>Object</tt>
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
</h3><div class="docstring">
|
491
|
+
<div class="discussion">
|
492
|
+
<p>Returns the value of attribute premium.</p>
|
493
|
+
|
494
|
+
|
495
|
+
</div>
|
496
|
+
</div>
|
497
|
+
<div class="tags">
|
498
|
+
|
499
|
+
|
500
|
+
</div><table class="source_code">
|
501
|
+
<tr>
|
502
|
+
<td>
|
503
|
+
<pre class="lines">
|
504
|
+
|
505
|
+
|
506
|
+
50
|
507
|
+
51
|
508
|
+
52</pre>
|
509
|
+
</td>
|
510
|
+
<td>
|
511
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
512
|
+
|
513
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_premium'>premium</span>
|
514
|
+
<span class='ivar'>@premium</span>
|
515
|
+
<span class='kw'>end</span></pre>
|
516
|
+
</td>
|
517
|
+
</tr>
|
518
|
+
</table>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
|
522
|
+
<span id="prev_pos=-instance_method"></span>
|
523
|
+
<div class="method_details ">
|
524
|
+
<h3 class="signature " id="prev_pos-instance_method">
|
525
|
+
|
526
|
+
#<strong>prev_pos</strong> ⇒ <tt>Object</tt>
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</h3><div class="docstring">
|
533
|
+
<div class="discussion">
|
534
|
+
<p>Returns the value of attribute prev_pos.</p>
|
535
|
+
|
536
|
+
|
537
|
+
</div>
|
538
|
+
</div>
|
539
|
+
<div class="tags">
|
540
|
+
|
541
|
+
|
542
|
+
</div><table class="source_code">
|
543
|
+
<tr>
|
544
|
+
<td>
|
545
|
+
<pre class="lines">
|
546
|
+
|
547
|
+
|
548
|
+
50
|
549
|
+
51
|
550
|
+
52</pre>
|
551
|
+
</td>
|
552
|
+
<td>
|
553
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
554
|
+
|
555
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prev_pos'>prev_pos</span>
|
556
|
+
<span class='ivar'>@prev_pos</span>
|
557
|
+
<span class='kw'>end</span></pre>
|
558
|
+
</td>
|
559
|
+
</tr>
|
560
|
+
</table>
|
561
|
+
</div>
|
562
|
+
|
563
|
+
|
564
|
+
<span id="strike=-instance_method"></span>
|
565
|
+
<div class="method_details ">
|
566
|
+
<h3 class="signature " id="strike-instance_method">
|
567
|
+
|
568
|
+
#<strong>strike</strong> ⇒ <tt>Object</tt>
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
</h3><div class="docstring">
|
575
|
+
<div class="discussion">
|
576
|
+
<p>Returns the value of attribute strike.</p>
|
577
|
+
|
578
|
+
|
579
|
+
</div>
|
580
|
+
</div>
|
581
|
+
<div class="tags">
|
582
|
+
|
583
|
+
|
584
|
+
</div><table class="source_code">
|
585
|
+
<tr>
|
586
|
+
<td>
|
587
|
+
<pre class="lines">
|
588
|
+
|
589
|
+
|
590
|
+
50
|
591
|
+
51
|
592
|
+
52</pre>
|
593
|
+
</td>
|
594
|
+
<td>
|
595
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
596
|
+
|
597
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_strike'>strike</span>
|
598
|
+
<span class='ivar'>@strike</span>
|
599
|
+
<span class='kw'>end</span></pre>
|
600
|
+
</td>
|
601
|
+
</tr>
|
602
|
+
</table>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
|
606
|
+
<span id="type=-instance_method"></span>
|
607
|
+
<div class="method_details ">
|
608
|
+
<h3 class="signature " id="type-instance_method">
|
609
|
+
|
610
|
+
#<strong>type</strong> ⇒ <tt>Object</tt>
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
</h3><div class="docstring">
|
617
|
+
<div class="discussion">
|
618
|
+
<p>Returns the value of attribute type.</p>
|
619
|
+
|
620
|
+
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
<div class="tags">
|
624
|
+
|
625
|
+
|
626
|
+
</div><table class="source_code">
|
627
|
+
<tr>
|
628
|
+
<td>
|
629
|
+
<pre class="lines">
|
630
|
+
|
631
|
+
|
632
|
+
50
|
633
|
+
51
|
634
|
+
52</pre>
|
635
|
+
</td>
|
636
|
+
<td>
|
637
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 50</span>
|
638
|
+
|
639
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
640
|
+
<span class='ivar'>@type</span>
|
641
|
+
<span class='kw'>end</span></pre>
|
642
|
+
</td>
|
643
|
+
</tr>
|
644
|
+
</table>
|
645
|
+
</div>
|
646
|
+
|
647
|
+
</div>
|
648
|
+
|
649
|
+
|
650
|
+
<div id="instance_method_details" class="method_details_list">
|
651
|
+
<h2>Instance Method Details</h2>
|
652
|
+
|
653
|
+
|
654
|
+
<div class="method_details first">
|
655
|
+
<h3 class="signature first" id="validate!-instance_method">
|
656
|
+
|
657
|
+
#<strong>validate!</strong> ⇒ <tt>Object</tt>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
</h3><div class="docstring">
|
664
|
+
<div class="discussion">
|
665
|
+
|
666
|
+
|
667
|
+
</div>
|
668
|
+
</div>
|
669
|
+
<div class="tags">
|
670
|
+
|
671
|
+
<p class="tag_title">Raises:</p>
|
672
|
+
<ul class="raise">
|
673
|
+
|
674
|
+
<li>
|
675
|
+
|
676
|
+
|
677
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
</li>
|
682
|
+
|
683
|
+
</ul>
|
684
|
+
|
685
|
+
</div><table class="source_code">
|
686
|
+
<tr>
|
687
|
+
<td>
|
688
|
+
<pre class="lines">
|
689
|
+
|
690
|
+
|
691
|
+
52
|
692
|
+
53
|
693
|
+
54
|
694
|
+
55
|
695
|
+
56
|
696
|
+
57
|
697
|
+
58
|
698
|
+
59
|
699
|
+
60
|
700
|
+
61
|
701
|
+
62
|
702
|
+
63</pre>
|
703
|
+
</td>
|
704
|
+
<td>
|
705
|
+
<pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 52</span>
|
706
|
+
|
707
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_validate!'>validate!</span>
|
708
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>type must be 'call' or 'put'</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="../Models.html#OPTION_TYPES-constant" title="OptionLab::Models::OPTION_TYPES (constant)">OPTION_TYPES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
709
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>strike must be positive</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_strike'>strike</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_strike'>strike</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
|
710
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>premium must be positive</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_premium'>premium</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_premium'>premium</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
|
711
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>n must be positive</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
|
712
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>action must be 'buy' or 'sell'</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="../Models.html#ACTION_TYPES-constant" title="OptionLab::Models::ACTION_TYPES (constant)">ACTION_TYPES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>
|
713
|
+
|
714
|
+
<span class='comment'># Validate expiration if provided
|
715
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_expiration'>expiration</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
|
716
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>If expiration is an integer, it must be greater than 0</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_expiration'>expiration</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
|
717
|
+
<span class='kw'>end</span>
|
718
|
+
<span class='kw'>end</span></pre>
|
719
|
+
</td>
|
720
|
+
</tr>
|
721
|
+
</table>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
</div>
|
725
|
+
|
726
|
+
</div>
|
727
|
+
|
728
|
+
<div id="footer">
|
729
|
+
Generated on Sun Apr 27 16:09:34 2025 by
|
730
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
731
|
+
0.9.37 (ruby-3.3.3).
|
732
|
+
</div>
|
733
|
+
|
734
|
+
</div>
|
735
|
+
</body>
|
736
|
+
</html>
|