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 +4 -4
- data/ext/tarf_monte_carlo/tarf_monte_carlo.c +38 -1
- data/lib/tarf_monte_carlo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '06542868a0a9e3446d59880a36f2cc1f2d46c09ecf446c71fcad3ec235b08938'
|
4
|
+
data.tar.gz: a6922adce8b10804cf0b7c09e837d91736863c7f97de606d1d7bd0ec2c80fe11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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;
|