tarf_monte_carlo 3.63 → 3.68

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1279c9bdedccf7a5f6e8e9d812d3bc49b36c28dc87c3beac88ecd306d57adb13
4
- data.tar.gz: ea114bbaf561a65c7825f16c8f8634543dcd9b4d9b52fc71e3b3a6d2d83714fa
3
+ metadata.gz: 2fa64303581fdfd8f57be13e97367ccd9c07d64bc7e4eeac8cdaa432d9c7dd71
4
+ data.tar.gz: 4b6851b1a03af9c991ad0b9d5396c78c81c88ab94c776191fe856d87699c8a1e
5
5
  SHA512:
6
- metadata.gz: 31c688a15b33b4a647cd52630a2f105c149e25483749c97cbb68292366fbee2bc486e52b9a996e7eccfe0f44f590760abad65c59b541f56c7e0304694b076539
7
- data.tar.gz: f477dc3707480ca223f4d68e89251eb221aff7f5ae832ac10822be3a745821423ab79382371cd870cd067c566ff5346c6d0ddebe149dfcfa30e65911254a52a5
6
+ metadata.gz: da44ef843b722f1e2b2ef1b974c0b0d2d725a9a977a8748b72633fd7b55cf5749a8ea284efcb663923384440062038b5784214a58ad6ea280d3cffc19434c58c
7
+ data.tar.gz: 21318d9c0767bd83ba36ecab123b3189bef337b95c74726beb0e2c99ccc47cd8a356bbde7e14375dc102794dc79ba570b0034fb19c9a2800cc0bc84ac59eff92
@@ -283,14 +283,14 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
283
283
  profit_loss_dash = Spot_dash;
284
284
 
285
285
  // Both Until KI & Exp
286
- if ( ((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign < 0) && ((*(Barrier2_array + leg) - *(Xs_array + leg)) * cp_sign > 0) ){
286
+ if ( (((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign) <= 0) && (((*(Barrier2_array + leg) - *(Xs_array + leg)) * cp_sign) >= 0) ){
287
287
  if ((knockedLeg == -1) && ((*(Barrier_array + leg) - Spot) * cp_sign >= 0)){ knockedLeg = leg; }
288
288
  if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign <= 0)){ knockedLeg2 = leg; }
289
289
 
290
290
  if ((knockedLeg_dash == -1) && ((*(Barrier_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg_dash = leg; }
291
291
  if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign <= 0)){ knockedLeg2_dash = leg; }
292
292
  }
293
- else if( ((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign > 0) && ((*(Barrier2_array + leg) - *(Xs_array + leg)) * cp_sign < 0) ){
293
+ else if( (((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign) >= 0) && (((*(Barrier2_array + leg) - *(Xs_array + leg)) * cp_sign) <= 0) ){
294
294
  if ((knockedLeg == -1) && ((*(Barrier_array + leg) - Spot) * cp_sign <= 0)){ knockedLeg = leg; }
295
295
  if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign >= 0)){ knockedLeg2 = leg; }
296
296
 
@@ -298,20 +298,20 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
298
298
  if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg2_dash = leg; }
299
299
  }
300
300
  // Only Until Exp
301
- else if( (KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP) && ((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign > 0) && ((*(Barrier2_array + leg) - *(Barrier_array + leg)) * cp_sign > 0) ){
301
+ else if( (KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP) && (((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign) >= 0) && (((*(Barrier2_array + leg) - *(Barrier_array + leg)) * cp_sign) >= 0) ){
302
302
  if ((knockedLeg == -1) && ((*(Barrier_array + leg) - Spot) * cp_sign <= 0)){ knockedLeg = leg; }
303
- if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign >= 0)){ knockedLeg2 = leg; }
303
+ if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign <= 0)){ knockedLeg2 = leg; }
304
304
 
305
305
  if ((knockedLeg_dash == -1) && ((*(Barrier_array + leg) - Spot_dash) * cp_sign <= 0)){ knockedLeg_dash = leg; }
306
- if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg2_dash = leg; }
306
+ if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign <= 0)){ knockedLeg2_dash = leg; }
307
307
  }
308
308
 
309
- else if( (KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP) && ((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign < 0) && ((*(Barrier2_array + leg) - *(Barrier_array + leg)) * cp_sign < 0) ){
309
+ else if( (KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP) && (((*(Barrier_array + leg) - *(Xs_array + leg)) * cp_sign) <= 0) && (((*(Barrier2_array + leg) - *(Barrier_array + leg)) * cp_sign) <= 0) ){
310
310
  if ((knockedLeg == -1) && ((*(Barrier_array + leg) - Spot) * cp_sign >= 0)){ knockedLeg = leg; }
311
- if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign <= 0)){ knockedLeg2 = leg; }
311
+ if ((knockedLeg2 == -1) && ((*(Barrier2_array + leg) - Spot) * cp_sign >= 0)){ knockedLeg2 = leg; }
312
312
 
313
313
  if ((knockedLeg_dash == -1) && ((*(Barrier_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg_dash = leg; }
314
- if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign <= 0)){ knockedLeg2_dash = leg; }
314
+ if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg2_dash = leg; }
315
315
  }
316
316
  } else if(KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT){
317
317
  profit_loss = Spot;
@@ -555,13 +555,13 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
555
555
  }
556
556
  } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP){
557
557
  if(knockedLeg2 >= 0){
558
- sim_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[NL-1], dir_sign);
558
+ sim_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim[NL-1], dir_sign);
559
559
  } else if(knockedLeg >= 0) {
560
560
  double equivalent_notional = *( Ns_array + knockedLeg );
561
561
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
562
562
  }
563
563
  if(knockedLeg2_dash >= 0){
564
- sim_dash_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[NL-1], dir_sign);
564
+ sim_dash_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim_dash[NL-1], dir_sign);
565
565
  } else if(knockedLeg_dash >= 0) {
566
566
  double equivalent_notional = *( Ns_array + knockedLeg_dash );
567
567
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
@@ -581,10 +581,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
581
581
  double equivalent_notional = *( Ns_array + knockedLeg );
582
582
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
583
583
  } else {
584
- sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
584
+ sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim[knockedLeg2], dir_sign);
585
585
  }
586
586
  } else if(knockedLeg2 >= 0){
587
- sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
587
+ sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim[knockedLeg2], dir_sign);
588
588
  } else if(knockedLeg >= 0) {
589
589
  double equivalent_notional = *( Ns_array + knockedLeg );
590
590
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
@@ -595,10 +595,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
595
595
  double equivalent_notional = *( Ns_array + knockedLeg_dash );
596
596
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
597
597
  } else {
598
- sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
598
+ sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2_dash ) ), sim_dash[knockedLeg2_dash], dir_sign);
599
599
  }
600
600
  } else if(knockedLeg2_dash >= 0){
601
- sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
601
+ sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2_dash ) ), sim_dash[knockedLeg2_dash], dir_sign);
602
602
  } else if(knockedLeg_dash >= 0) {
603
603
  double equivalent_notional = *( Ns_array + knockedLeg_dash );
604
604
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.63"
6
+ VERSION = "3.68"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarf_monte_carlo
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.63'
4
+ version: '3.68'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek Routh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-14 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler