tarf_monte_carlo 3.68 → 3.69

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: 2fa64303581fdfd8f57be13e97367ccd9c07d64bc7e4eeac8cdaa432d9c7dd71
4
- data.tar.gz: 4b6851b1a03af9c991ad0b9d5396c78c81c88ab94c776191fe856d87699c8a1e
3
+ metadata.gz: a09821b8f49b2435d5faac86b35b58e9514de07dcf70200c99d9fe8c2a496cd1
4
+ data.tar.gz: 6f19dd72e7a81ba7ed41f8e40e29a57965acf4e4b5ee78cb1fb2f931d5ae3270
5
5
  SHA512:
6
- metadata.gz: da44ef843b722f1e2b2ef1b974c0b0d2d725a9a977a8748b72633fd7b55cf5749a8ea284efcb663923384440062038b5784214a58ad6ea280d3cffc19434c58c
7
- data.tar.gz: 21318d9c0767bd83ba36ecab123b3189bef337b95c74726beb0e2c99ccc47cd8a356bbde7e14375dc102794dc79ba570b0034fb19c9a2800cc0bc84ac59eff92
6
+ metadata.gz: 3fb2c088e7cd659ebae7db0b3dadb0ddac9e58661ca70383df086ff550f1e7387f384c29f66f216d13b9e0b6f073770521db72815544ac1aa401ac84476a8b93
7
+ data.tar.gz: c686b6a2e6a347ffcb62a293f7b1b39beafae1755b31ab4d9a540b1b8f0b9ce16a3b0ae00ec43447214b4247229d58ea15ae996ee5467205432be179f9fccdb9
@@ -211,6 +211,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
211
211
  //
212
212
  // first create a 1-D array of pointers, and then, for each array entry, create another 1-D array.
213
213
  //
214
+ double testing[SCount];
214
215
  double **metrics;
215
216
  if (barrier_variations(KType)){
216
217
  metrics = ( double** ) malloc( BARRIER_DP * sizeof(double*) );
@@ -234,6 +235,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
234
235
 
235
236
  // run simulations loop
236
237
  for( sim_count = 0; sim_count < SCount; sim_count += 2 ) {
238
+
239
+ testing[sim_count] = -1;
240
+ testing[sim_count+1] = -1;
241
+
237
242
  // initial spot rate for each iteration would be current spot rate
238
243
  double Spot = S, Spot_dash = S;
239
244
  double sim[NL], sim_pos[NL], sim_neg[NL], sim_dash[NL], sim_dash_pos[NL], sim_dash_neg[NL];
@@ -576,6 +581,9 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
576
581
  metrics[3][point_pos+1] = knockedLeg_dash;
577
582
  }
578
583
  } else if(KType == FX_AMERICAN_BARRIER_KIKO_UNTIL_KI){
584
+ testing[sim_count] = knockedLeg2;
585
+ testing[sim_count + 1] = knockedLeg2_dash;
586
+
579
587
  if(knockedLeg >= 0 && knockedLeg2 >= 0){
580
588
  if(knockedLeg < knockedLeg2){
581
589
  double equivalent_notional = *( Ns_array + knockedLeg );
@@ -839,12 +847,18 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
839
847
  }
840
848
  }
841
849
 
850
+ VALUE testing_data = rb_ary_new();
851
+ for(metric = 0; metric < SCount; metric++) {
852
+ rb_ary_push(testing_data, DBL2NUM(testing[metric]));
853
+ }
854
+
842
855
  // rb_p(rb_str_new2("Generating output hash"));
843
856
  VALUE final_pvs = rb_hash_new();
844
857
  rb_hash_aset(final_pvs, rb_str_new2("positive_pv"), DBL2NUM( pvs_pos_sum / SCount ));
845
858
  rb_hash_aset(final_pvs, rb_str_new2("negative_pv"), DBL2NUM( pvs_neg_sum / SCount ));
846
859
  rb_hash_aset(final_pvs, rb_str_new2("total_pv"), DBL2NUM( (pvs_neg_sum + pvs_pos_sum) / SCount ));
847
860
  rb_hash_aset(final_pvs, rb_str_new2("metrics"), final_metrics);
861
+ rb_hash_aset(final_pvs, rb_str_new2("testing"), testing_data);
848
862
 
849
863
  //
850
864
  // free your arrays from memory once you're done using them
@@ -3,5 +3,5 @@
3
3
  # gem yank tarf_monte_carlo -v 2.3
4
4
 
5
5
  module TarfMonteCarlo
6
- VERSION = "3.68"
6
+ VERSION = "3.69"
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.68'
4
+ version: '3.69'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek Routh