tarf_monte_carlo 3.24 → 3.25
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 +4 -4
- data/ext/tarf_monte_carlo/tarf_monte_carlo.c +18 -2
- 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: 9b578a4483961831037817279e8d1f3d6fe7e55e4312b51ccac26e757e520996
|
|
4
|
+
data.tar.gz: 7ce9ff317c5f1383499ec18c50be613ec4b9955be99101e9c0aa9b7385c67874
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9735f0cac81ddcbe4af47ed5f36daeafa57a3bac7c7d88e5d9bee9bc8dd951810054b6bbeb6e34fdc670cdce21ce13360f22665e6856fc307e84bf71401f110
|
|
7
|
+
data.tar.gz: 2580760d17c4f660431a26e3d7afd018da399eb75691f4e0ff08017b872fe371849b2c76b280de675fddb3df2dcd8b45401281bbedf342997ad1a822443eaf3b
|
|
@@ -81,7 +81,7 @@ VALUE method_box_muller( VALUE self ) {
|
|
|
81
81
|
VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
82
82
|
VALUE MCInputs = rb_ary_shift(args);
|
|
83
83
|
// rb_p(rb_str_new2("MC Inputs:"));
|
|
84
|
-
rb_p(MCInputs);
|
|
84
|
+
// rb_p(MCInputs);
|
|
85
85
|
|
|
86
86
|
// seed value for rand() function
|
|
87
87
|
srand( time(0) );
|
|
@@ -248,6 +248,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
|
248
248
|
profit_loss = 0.0;
|
|
249
249
|
} else if(Spot <= *( CFs_array + leg )){
|
|
250
250
|
profit_loss = Spot - (*( CFs_array + leg ));
|
|
251
|
+
|
|
252
|
+
if (ConvertNotional == 1){
|
|
253
|
+
Ns_array[leg] = *(TempNs_array + leg) / *( CFs_array + leg );
|
|
254
|
+
}
|
|
251
255
|
} else {
|
|
252
256
|
profit_loss = Spot - (*( Xs_array + leg ));
|
|
253
257
|
}
|
|
@@ -256,6 +260,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
|
256
260
|
profit_loss_dash = 0.0;
|
|
257
261
|
} else if(Spot_dash <= *( CFs_array + leg )){
|
|
258
262
|
profit_loss_dash = Spot_dash - (*( CFs_array + leg ));
|
|
263
|
+
|
|
264
|
+
if (ConvertNotional == 1){
|
|
265
|
+
Ns_array[leg] = *(TempNs_array + leg) / *( CFs_array + leg );
|
|
266
|
+
}
|
|
259
267
|
} else {
|
|
260
268
|
profit_loss_dash = Spot_dash - (*( Xs_array + leg ));
|
|
261
269
|
}
|
|
@@ -283,6 +291,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
|
283
291
|
profit_loss = 0.0;
|
|
284
292
|
} else if(Spot >= *( CFs_array + leg )){
|
|
285
293
|
profit_loss = ( ( *( CFs_array + leg ) ) - Spot );
|
|
294
|
+
|
|
295
|
+
if (ConvertNotional == 1){
|
|
296
|
+
Ns_array[leg] = *(TempNs_array + leg) / *( CFs_array + leg );
|
|
297
|
+
}
|
|
286
298
|
} else {
|
|
287
299
|
profit_loss = ( ( *( Xs_array + leg ) ) - Spot );
|
|
288
300
|
}
|
|
@@ -291,6 +303,10 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
|
291
303
|
profit_loss_dash = 0.0;
|
|
292
304
|
} else if(Spot_dash >= *( CFs_array + leg )){
|
|
293
305
|
profit_loss_dash = ( ( *( CFs_array + leg ) ) - Spot_dash );
|
|
306
|
+
|
|
307
|
+
if (ConvertNotional == 1){
|
|
308
|
+
Ns_array[leg] = *(TempNs_array + leg) / *( CFs_array + leg );
|
|
309
|
+
}
|
|
294
310
|
} else {
|
|
295
311
|
profit_loss_dash = ( ( *( Xs_array + leg ) ) - Spot_dash );
|
|
296
312
|
}
|
|
@@ -367,7 +383,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
|
367
383
|
} else if( KType == POINTS || KType == PIVOT_POINTS || KType == COLLAR_POINTS || KType == DOUBLE_STRIKE_POINTS ) {
|
|
368
384
|
for( leg = 0; leg < NL; ++leg ) {
|
|
369
385
|
// simulation normal
|
|
370
|
-
rb_p(DBL2NUM(*(Ns_array + leg )));
|
|
386
|
+
// rb_p(DBL2NUM(*(Ns_array + leg )));
|
|
371
387
|
if ( ko_so_far > 0.0 ) {
|
|
372
388
|
if( sim[leg] >= 0.0 ) {
|
|
373
389
|
// knock out condition
|