tarf_monte_carlo 3.67 → 4.01

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: 4eaec9a6c923daa279367d27ae6d5c7739d54a8d6581395b887429907a028792
4
- data.tar.gz: 91f799dc24f730b68afdd7977cf5dbdca20e3d0d9973d3b3eb78ce044a898d81
3
+ metadata.gz: dcb28d2f1c3f662185c981ea526e2281824674db223f1a985fb21b8d561aaac2
4
+ data.tar.gz: 9dbb8ab79cac6ddd06c9ae051c9be9bf0d3165c40e4264d27dbb370ae3f7d348
5
5
  SHA512:
6
- metadata.gz: 148485ef218f78f3bcda485866fbcb65197e47d052aab4c2266fd4df2512029b79c0ba1fcedc148a0d330444644539fadbef797b2dfaf6524e8586fb580bb0e4
7
- data.tar.gz: fbdef2214f7d80d306b9ace4e007aa49787145fa9b0962d1a11fd0ae836797a231988ea454c979f13f8ed92ad1fcd1995839f4fa1ffea5f6178eb1d134cf39fb
6
+ metadata.gz: babd0341ce343a1d262bbfcfd31e066d6e0f50639e2303f77faa98732a600398fea02f80417754c460b974fc919d81f5f21f1f61e66b230c691d601a4ab723c8
7
+ data.tar.gz: 022d7afcd71ce6f2fcd9db1faa973a2031ac002b21d4220d9ac532a4e7def7e480adab1de19cd9373e6e0c61fbc45947470947a75377fa3fc4e73f4ed5aac51d
@@ -43,8 +43,8 @@
43
43
 
44
44
  #define FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE 13
45
45
  #define FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE 14
46
- #define FX_AMERICAN_BARRIER_WINDOW_KNOCKIN 15
47
- #define FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT 16
46
+ #define FX_AMERICAN_BARRIER_DOUBLE_KNOCKIN 15
47
+ #define FX_AMERICAN_BARRIER_DOUBLE_KNOCKOUT 16
48
48
  #define FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP 17
49
49
  #define FX_AMERICAN_BARRIER_KIKO_UNTIL_KI 18
50
50
  #define FX_AMERICAN_BARRIER_BINARY_IN_DISCRETE 19
@@ -104,11 +104,11 @@ double get_equivalent_rebate(int conversion_sign, double rebate, float rate, int
104
104
  }
105
105
 
106
106
  bool barrier_variations(int KType){
107
- return (KType == FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE || KType == FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI || KType == FX_AMERICAN_BARRIER_BINARY_IN_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_OUT_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_CALLPUT_IN_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_CALLPUT_OUT_DISCRETE);
107
+ return (KType == FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE || KType == FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKIN || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKOUT || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI || KType == FX_AMERICAN_BARRIER_BINARY_IN_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_OUT_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_CALLPUT_IN_DISCRETE || KType == FX_AMERICAN_BARRIER_BINARY_CALLPUT_OUT_DISCRETE);
108
108
  }
109
109
 
110
110
  bool double_barrier_variations(int KType){
111
- return (KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI);
111
+ return (KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKIN || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKOUT || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_EXP || KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI);
112
112
  }
113
113
  // main method for running monte carlo simulation from sidekiq worker/outside method
114
114
  VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
@@ -313,7 +313,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
313
313
  if ((knockedLeg_dash == -1) && ((*(Barrier_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg_dash = leg; }
314
314
  if ((knockedLeg2_dash == -1) && ((*(Barrier2_array + leg) - Spot_dash) * cp_sign >= 0)){ knockedLeg2_dash = leg; }
315
315
  }
316
- } else if(KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT){
316
+ } else if(KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKIN || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKOUT){
317
317
  profit_loss = Spot;
318
318
  profit_loss_dash = Spot_dash;
319
319
 
@@ -464,7 +464,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
464
464
  // legs loop end
465
465
  // start from the Knock value
466
466
  double ko_so_far = K, ko_so_far_dash = K;
467
- if(KType == FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKIN){
467
+ if(KType == FX_AMERICAN_BARRIER_KNOCKIN_DISCRETE || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKIN){
468
468
  if(knockedLeg >= 0){
469
469
  double equivalent_notional = *( Ns_array + knockedLeg );
470
470
  sim_pos[NL-1] = european_payoff(( *( Xs_array + (knockedLeg) ) ), sim[NL-1], cp_sign, dir_sign, equivalent_notional);
@@ -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 + knockedLeg2 ) ), sim[NL-1], dir_sign);
558
+ sim_pos[knockedLeg2] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim[knockedLeg2], 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 + knockedLeg2 ) ), sim_dash[NL-1], dir_sign);
564
+ sim_dash_pos[knockedLeg2_dash] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg2 ) ), sim_dash[knockedLeg2_dash], 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);
@@ -612,7 +612,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
612
612
  metrics[1][point_pos+1] = (knockedLeg_dash >= 0) ? ( *( Xs_array + (knockedLeg_dash) ) ) : 0;
613
613
  metrics[3][point_pos+1] = knockedLeg_dash;
614
614
  }
615
- } else if(KType == FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE || KType == FX_AMERICAN_BARRIER_WINDOW_KNOCKOUT){
615
+ } else if(KType == FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE || KType == FX_AMERICAN_BARRIER_DOUBLE_KNOCKOUT){
616
616
  if(knockedLeg >= 0){
617
617
  sim_pos[knockedLeg] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg ) ), sim[knockedLeg], dir_sign);
618
618
  }
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.67"
6
+ VERSION = "4.01"
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.67'
4
+ version: '4.01'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek Routh