tarf_monte_carlo 3.54 → 3.55

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: e0d7cdafaf4865a66b7bbe6452a9ad3dd90c3ced070778cd288bf304cb3e2417
4
- data.tar.gz: 79894b25d74fc53dfe3151009122e846323b18e31ba4ab71f4cced7edcad6eae
3
+ metadata.gz: '06542868a0a9e3446d59880a36f2cc1f2d46c09ecf446c71fcad3ec235b08938'
4
+ data.tar.gz: a6922adce8b10804cf0b7c09e837d91736863c7f97de606d1d7bd0ec2c80fe11
5
5
  SHA512:
6
- metadata.gz: c513bd0d5cbc5b2d8e3a66334131cf0d95b094510a6fb42f1862b478448b605c1e04a2714f552e9a7234bf1eeb1bd3297e034dbec69445e13ad2bf3ff2c65b58
7
- data.tar.gz: c0ce2f67ed9a9c32f1ddaef031350535c2522bd6bfde0c80bb493189b684f68aab392fbbf773b85d1d92a11fc3d488501e5d5e8ca87e3d8f9458694c8297f9e3
6
+ metadata.gz: 6508270dcdc5a5958d2de0aec826a3141d0a315a72561798903315b9d0b37a49f960a9376e7b302f79a408996098cb13e715096fd123a0f536a15414d06c029a
7
+ data.tar.gz: 8a6fb8e1a8554fbda71200c360db164ec4bf07953f672b7bd6982f4c2b7d394c7930dac88931f801a93438568e5976be490d31d25c334beb82d8748ca18d49d9
@@ -469,7 +469,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
469
469
  metrics[1][point_pos+1] = (knockedLeg_dash >= 0) ? ( *( Xs_array + (knockedLeg_dash) ) ) : 0;
470
470
  metrics[3][point_pos+1] = knockedLeg_dash;
471
471
  }
472
- } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI){
472
+ } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP){
473
473
  if(knockedLeg2 >= 0){
474
474
  sim_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[NL-1], dir_sign);
475
475
  } else if(knockedLeg >= 0) {
@@ -483,6 +483,43 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
483
483
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
484
484
  }
485
485
 
486
+ if ((point_pos < DATAPOINTS) && (sim_count % INTERVAL) == 0){
487
+ metrics[0][point_pos] = sim[NL-1];
488
+ metrics[1][point_pos] = (knockedLeg >= 0) ? ( *( Xs_array + (knockedLeg) ) ) : 0;
489
+ metrics[3][point_pos] = knockedLeg;
490
+ metrics[0][point_pos+1] = sim_dash[NL-1];
491
+ metrics[1][point_pos+1] = (knockedLeg_dash >= 0) ? ( *( Xs_array + (knockedLeg_dash) ) ) : 0;
492
+ metrics[3][point_pos+1] = knockedLeg_dash;
493
+ }
494
+ } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI){
495
+ if(knockedLeg >= 0 && knockedLeg2 >= 0){
496
+ if(knockedLeg < knockedLeg2){
497
+ double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
498
+ sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
499
+ } else {
500
+ sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
501
+ }
502
+ } else if(knockedLeg2 >= 0){
503
+ sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
504
+ } else if(knockedLeg >= 0) {
505
+ double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
506
+ sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
507
+ }
508
+
509
+ if(knockedLeg_dash >= 0 && knockedLeg2_dash >= 0){
510
+ if(knockedLeg_dash < knockedLeg2_dash){
511
+ double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
512
+ sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
513
+ } else {
514
+ sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
515
+ }
516
+ } else if(knockedLeg2_dash >= 0){
517
+ sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
518
+ } else if(knockedLeg_dash >= 0) {
519
+ double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
520
+ sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
521
+ }
522
+
486
523
  if ((point_pos < DATAPOINTS) && (sim_count % INTERVAL) == 0){
487
524
  metrics[0][point_pos] = sim[NL-1];
488
525
  metrics[1][point_pos] = (knockedLeg >= 0) ? ( *( Xs_array + (knockedLeg) ) ) : 0;
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.54"
6
+ VERSION = "3.55"
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.54'
4
+ version: '3.55'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek Routh