tarf_monte_carlo 3.12 → 3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92b03e70d933ae7e53c9b8816bae025f315a455413684e542d03fb66b391fdb5
4
- data.tar.gz: d18d1ac7aa941de3ebf8e5557635e8301a11002b468055a94c303d569edf9fdf
3
+ metadata.gz: bf901445c70d80f370053ffa90ba2cc6fb3e12b9ad7c372777cae63b92ceecdb
4
+ data.tar.gz: 04331203b779e146db0e48a7eb9d1a0452c31aee17311c5f3c863d2104bc080b
5
5
  SHA512:
6
- metadata.gz: d54912e68221632f24689f1c69c88b8ca44daed63589025adb69910c4952b3819cf26d1ba9bf18e48a3db33bb017c39f7733494144a336633fd8a1da169557d1
7
- data.tar.gz: 2a729f8b99b24bd1d7b7e9dea1d940d08bf0867efc22cb1cc18629f232bec75dd252d8360f82f11f5443af1026845293a13426193e7535af3f2c41df4de991d6
6
+ metadata.gz: b912836d2d1a64d62c9b1d394be9ca89c5dbeb245312ce18d9490751bf61fd1fc9ade361a60446d1a0b1df7928882e5e4d0691b0e8c7528733f9bdfc49ccf6b2
7
+ data.tar.gz: '08248d29944ff3fb8981d7bda9506bd056869575e54cb1ec6aa3be403b945cbe1b11c6bcb1cc42193f5617330d1be6633f4f1c2ab331cd2cc70d4cf455ef7df1'
data/.gitignore CHANGED
File without changes
@@ -124,11 +124,18 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
124
124
  vs_array[leg] = NUM2DBL( rb_ary_entry(vs, leg) );
125
125
  bs_array[leg] = NUM2DBL( rb_ary_entry(bs, leg) );
126
126
  DFs_array[leg] = NUM2DBL( rb_ary_entry(DFs, leg) );
127
- if (KType == PIVOT_POINTS) {
127
+ }
128
+ // extra tarf structures
129
+ if ( KType == PIVOT_POINTS ) {
130
+ for (leg = 0; leg < NL; ++leg) {
128
131
  Ps_array[leg] = NUM2DBL( rb_ary_entry(Ps, leg) );
129
- } else if (KType == COLLAR_POINTS){
132
+ }
133
+ } else if ( KType == COLLAR_POINTS ) {
134
+ for (leg = 0; leg < NL; ++leg) {
130
135
  CFs_array[leg] = NUM2DBL( rb_ary_entry(CFs, leg) );
131
- } else if (KType == DUAL_STRIKE_POINTS){
136
+ }
137
+ } else if ( KType == DUAL_STRIKE_POINTS ) {
138
+ for (leg = 0; leg < NL; ++leg) {
132
139
  LSts_array[leg] = NUM2DBL( rb_ary_entry(LSts, leg) );
133
140
  USts_array[leg] = NUM2DBL( rb_ary_entry(USts, leg) );
134
141
  }
@@ -186,20 +193,16 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
186
193
  profit_loss_dash = ( Spot_dash - ( *( Xs_array + leg ) ) );
187
194
  } else if ( BS == SELL ) {
188
195
  if ( KType == PIVOT_POINTS ) {
189
- if ( Spot <= *( Xs_array + leg ) && Spot < *( Ps_array + leg ) ) {
190
- profit_loss = *( Xs_array + leg ) - Spot;
191
- } else if ( Spot > *( Xs_array + leg ) && Spot >= *( Ps_array + leg ) ) {
192
- profit_loss = *( Xs_array + leg ) - Spot;
193
- } else {
196
+ if ( *( Xs_array + leg ) < Spot && Spot < *( Ps_array + leg ) ) {
194
197
  profit_loss = 0.0;
198
+ } else {
199
+ profit_loss = ( ( *( Xs_array + leg ) ) - Spot );
195
200
  }
196
201
  // dash
197
- if ( Spot_dash <= *( Xs_array + leg ) && Spot_dash < *( Ps_array + leg ) ) {
198
- profit_loss_dash = *( Xs_array + leg ) - Spot_dash;
199
- } else if ( Spot_dash > *( Xs_array + leg ) && Spot_dash >= *( Ps_array + leg ) ) {
200
- profit_loss_dash = *( Xs_array + leg ) - Spot_dash;
201
- } else {
202
+ if ( *( Xs_array + leg ) < Spot_dash && Spot_dash < *( Ps_array + leg ) ) {
202
203
  profit_loss_dash = 0.0;
204
+ } else {
205
+ profit_loss_dash = ( ( *( Xs_array + leg ) ) - Spot_dash );
203
206
  }
204
207
  } else {
205
208
  // profit if spot is lower than market price
@@ -229,7 +232,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
229
232
  }
230
233
  }
231
234
  // legs loop end
232
-
233
235
  // start from the Knock value
234
236
  double ko_so_far = K, ko_so_far_dash = K;
235
237
  if( KType == ABSOLUTE ) {
@@ -272,7 +274,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
272
274
  }
273
275
  }
274
276
  }
275
- } else if( KType == POINTS ) {
277
+ } else if( KType == POINTS || KType == PIVOT_POINTS || KType == COLLAR_POINTS || KType == DUAL_STRIKE_POINTS ) {
276
278
  for( leg = 0; leg < NL; ++leg ) {
277
279
  // simulation normal
278
280
  if ( ko_so_far > 0.0 ) {
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.12"
6
+ VERSION = "3.13"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarf_monte_carlo
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.12'
4
+ version: '3.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek Routh