tarf_monte_carlo 3.31 → 3.32
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 +2 -13
- 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: 2fd5c07e07e1a0fa016c6f8137c1e2b964f031b7210dca898e4d1006c0781ff4
|
4
|
+
data.tar.gz: 95210edd7247efc5785fec37c5c13cbe64f86a7509570382f19234174a021e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9da6d59b8810e6ff75ca95a02c66f59081dfc368bca41de0b809a6c14468b5c1935e07bcb3ba8108766b423177b43d454788fd62c44566747c2f2122a412626
|
7
|
+
data.tar.gz: a954cdf5255f86459bae5c6c171b9232dfce4ec4fa13e1f1ef8d5ebfe18beac0defbcbb3ba6d33fbe05af28c889b28031139b60d5e2cac1fd4a468099c387d77
|
@@ -193,7 +193,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
193
193
|
// first create a 1-D array of pointers, and then, for each array entry, create another 1-D array.
|
194
194
|
//
|
195
195
|
double **metrics;
|
196
|
-
double data[4][NL];
|
197
196
|
metrics = ( double** ) malloc( DATAPOINTS * sizeof(double*) );
|
198
197
|
for( metric = 0; metric < DATAPOINTS; metric++ ) {
|
199
198
|
metrics[metric] = ( double* ) malloc( NL * sizeof(double) );
|
@@ -217,10 +216,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
217
216
|
sim_dash[leg] = 0.0;
|
218
217
|
sim_dash_pos[leg] = 0.0;
|
219
218
|
sim_dash_neg[leg] = 0.0;
|
220
|
-
data[0][leg] = 0.0;
|
221
|
-
data[1][leg] = 0.0;
|
222
|
-
data[2][leg] = 0.0;
|
223
|
-
data[3][leg] = 0.0;
|
224
219
|
}
|
225
220
|
|
226
221
|
int knockedLeg = -1;
|
@@ -374,8 +369,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
374
369
|
sim[leg] = profit_loss;
|
375
370
|
sim_dash[leg] = profit_loss_dash;
|
376
371
|
|
377
|
-
data[0][leg] = sim[leg];
|
378
|
-
data[1][leg] = sim_dash[leg];
|
379
372
|
//
|
380
373
|
// Store spot and spot dash
|
381
374
|
//
|
@@ -392,7 +385,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
392
385
|
Spot_dash = S;
|
393
386
|
}
|
394
387
|
}
|
395
|
-
|
396
388
|
// legs loop end
|
397
389
|
// start from the Knock value
|
398
390
|
double ko_so_far = K, ko_so_far_dash = K;
|
@@ -411,9 +403,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
411
403
|
else{
|
412
404
|
sim_dash_pos[NL-1] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + 0 ) ), sim_dash[NL-1]);
|
413
405
|
}
|
414
|
-
|
415
|
-
data[2][NL-1] = sim_pos[NL-1];
|
416
|
-
data[3][NL-1] = sim_dash_pos[NL-1];
|
417
406
|
} else if(KType == FX_AMERICAN_BARRIER_KNOCKOUT_DISCRETE){
|
418
407
|
if(knockedLeg >= 0){
|
419
408
|
sim_pos[knockedLeg] = get_equivalent_rebate(rebate_conversion_sign, ( *( Rebate_array + knockedLeg ) ), sim[knockedLeg]);
|
@@ -595,11 +584,11 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
595
584
|
//
|
596
585
|
// rb_p(rb_str_new2("Converting metrics"));
|
597
586
|
VALUE final_metrics = rb_ary_new();
|
598
|
-
for(metric = 0; metric <
|
587
|
+
for(metric = 0; metric < DATAPOINTS; metric++) {
|
599
588
|
VALUE leg_metrics = rb_ary_new();
|
600
589
|
|
601
590
|
for(leg = 0; leg < NL; leg++) {
|
602
|
-
rb_ary_push( leg_metrics, DBL2NUM(
|
591
|
+
rb_ary_push( leg_metrics, DBL2NUM( metrics[metric][leg] ) );
|
603
592
|
}
|
604
593
|
|
605
594
|
rb_ary_push(final_metrics, leg_metrics);
|