tarf_monte_carlo 3.58 → 3.59

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: 393bd0b02941349be6693349a14b57a276a0dd46de997ce6bf467556a0ddeb4b
4
- data.tar.gz: 98742767158d8b544991ce09bc8a532e8e3a67430ee71fda21de47cc49af400c
3
+ metadata.gz: 384c19cb2b52b6b7f0cd0b03f0128fc6401c2455286aa206770233781685a41c
4
+ data.tar.gz: 63d22411c3a1a438f679a8ce421fea26e9b6ad8bc5f479eb66532f9b3087c652
5
5
  SHA512:
6
- metadata.gz: 983d134a318259bce1eb74760cb481c0cb185f341927900907b7df581ea2b1dbd8d5c05304833d1e38e6fa93b3d056eb4de58e42bf542b5c55537452869aa7a2
7
- data.tar.gz: dad8cb62f6b347d2f3719009c7393a30245a24b33cfb85c941467d86215b62334cd505da1f3ca0588422cc700184ac48eb327cf4b409e2d9bbfbd9708a9fe08f
6
+ metadata.gz: b17e9cc3e33b5c21bb5a2e9ab8dcb8912e0bed6522279066a903ca315a3d2b5ca8c3666b5b1687fd63f2060f297b3a0e1e2e4a312c2268bb0e31bb896c88e4e3
7
+ data.tar.gz: 4ac2992778ce44b6a7add5db8dec950ee8ad86ac140f80e064054f3871720a470e66e936eafe424d892e8082c4fe57ffae28df4a05ffa35c92539388fb7a7922
@@ -66,7 +66,6 @@ VALUE cTarfMonteCarlo = Qnil;
66
66
  // Prototype for the initialization method - Ruby calls this, not you
67
67
  void Init_tarf_monte_carlo();
68
68
  double european_payoff(double, double, int, int, double);
69
- double get_equivalent_notional(int, double, float);
70
69
  double get_equivalent_rebate(int, double, float, int);
71
70
  bool barrier_variations(int);
72
71
  bool double_barrier_variations(int);
@@ -99,10 +98,6 @@ double european_payoff(double strike, double spot, int cp_sign, int dir_sign, do
99
98
  return (diff * notional * dir_sign);
100
99
  }
101
100
 
102
- double get_equivalent_notional(int conversion_sign, double notional, float rate){
103
- return (conversion_sign == 1) ? (notional / rate) : notional;
104
- }
105
-
106
101
  double get_equivalent_rebate(int conversion_sign, double rebate, float rate, int dir_sign){
107
102
  double total = (conversion_sign == 1) ? (rebate * rate) : rebate;
108
103
  return (dir_sign * total);
@@ -453,14 +448,14 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
453
448
  double ko_so_far = K, ko_so_far_dash = K;
454
449
  if(KType == FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN){
455
450
  if(knockedLeg >= 0){
456
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
451
+ double equivalent_notional = *( Ns_array + knockedLeg );
457
452
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
458
453
  }
459
454
  else{
460
455
  sim_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[NL-1], dir_sign);
461
456
  }
462
457
  if(knockedLeg_dash >= 0 ){
463
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
458
+ double equivalent_notional = *( Ns_array + knockedLeg_dash );
464
459
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
465
460
  }
466
461
  else{
@@ -544,13 +539,13 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
544
539
  if(knockedLeg2 >= 0){
545
540
  sim_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[NL-1], dir_sign);
546
541
  } else if(knockedLeg >= 0) {
547
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
542
+ double equivalent_notional = *( Ns_array + knockedLeg );
548
543
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
549
544
  }
550
545
  if(knockedLeg2_dash >= 0){
551
546
  sim_dash_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[NL-1], dir_sign);
552
547
  } else if(knockedLeg_dash >= 0) {
553
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
548
+ double equivalent_notional = *( Ns_array + knockedLeg_dash );
554
549
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
555
550
  }
556
551
 
@@ -565,7 +560,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
565
560
  } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI){
566
561
  if(knockedLeg >= 0 && knockedLeg2 >= 0){
567
562
  if(knockedLeg < knockedLeg2){
568
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
563
+ double equivalent_notional = *( Ns_array + knockedLeg );
569
564
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
570
565
  } else {
571
566
  sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
@@ -573,13 +568,13 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
573
568
  } else if(knockedLeg2 >= 0){
574
569
  sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim[knockedLeg2], dir_sign);
575
570
  } else if(knockedLeg >= 0) {
576
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg ) ), sim[NL-1]);
571
+ double equivalent_notional = *( Ns_array + knockedLeg );
577
572
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
578
573
  }
579
574
 
580
575
  if(knockedLeg_dash >= 0 && knockedLeg2_dash >= 0){
581
576
  if(knockedLeg_dash < knockedLeg2_dash){
582
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
577
+ double equivalent_notional = *( Ns_array + knockedLeg_dash );
583
578
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
584
579
  } else {
585
580
  sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
@@ -587,7 +582,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
587
582
  } else if(knockedLeg2_dash >= 0){
588
583
  sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[knockedLeg2_dash], dir_sign);
589
584
  } else if(knockedLeg_dash >= 0) {
590
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + knockedLeg_dash ) ), sim_dash[NL-1]);
585
+ double equivalent_notional = *( Ns_array + knockedLeg_dash );
591
586
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg_dash) ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
592
587
  }
593
588
 
@@ -604,14 +599,14 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
604
599
  sim_pos[knockedLeg] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg ) ), sim[knockedLeg], dir_sign);
605
600
  }
606
601
  else{
607
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + 0 ) ), sim[NL-1]);
602
+ double equivalent_notional = *( Ns_array + 0 );
608
603
  sim_pos[NL-1] = european_payoff(( *( Xs_array + 0 ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
609
604
  }
610
605
  if(knockedLeg_dash >= 0 ){
611
606
  sim_dash_pos[knockedLeg_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg_dash ) ), sim[knockedLeg_dash], dir_sign);
612
607
  }
613
608
  else{
614
- double equivalent_notional = get_equivalent_notional(conversion_sign, ( *( Ns_array + 0 ) ), sim_dash[NL-1]);
609
+ double equivalent_notional = *( Ns_array + 0 );
615
610
  sim_dash_pos[NL-1] = european_payoff(( *( Xs_array + 0 ) ), sim_dash[NL-1], cp_sign, dir_sign, equivalent_notional);
616
611
  }
617
612
 
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.58"
6
+ VERSION = "3.59"
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.58'
4
+ version: '3.59'
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-12 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler