tarf_monte_carlo 3.15.3 → 3.20
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 +11 -0
- data/lib/tarf_monte_carlo/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 478124623904e792457d4c59815dc76473342bb48ea19e8f7b35e010849c2032
|
4
|
+
data.tar.gz: 8b51b8b9d812ef9c47aa51d57f0bdb5e65077599119a869481e4572ba322efde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db4c7d170d374489ef253bb85dc0186a28d8fc46960d8ae9a22cbcccf833d68c063fc1854d33511e566554bfa95eb2669586785d6a489ce8e9f410bd1fefae82
|
7
|
+
data.tar.gz: c4b038f20823c922a4065730edcbdeca24d918d5ea68f5eb1f2b95ffd87d21661ca83adc4acb30e9dd55cbc8ede6e13370a5ca576ff636836c4b3b7f3deca1dd
|
@@ -98,6 +98,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
98
98
|
int KType = NUM2INT( rb_hash_aref(MCInputs, rb_str_new2("knockout_type")) );
|
99
99
|
double S = NUM2DBL( rb_hash_aref(MCInputs, rb_str_new2("spot_rate")) );
|
100
100
|
int Ko_compare_mult = NUM2INT( rb_hash_aref(MCInputs, rb_str_new2("multiplier")) );
|
101
|
+
int ConvertNotional = NUM2INT( rb_hash_aref(MCInputs, rb_str_new2("convert_notional")) );
|
101
102
|
|
102
103
|
// assign leg specific attributes
|
103
104
|
double *pvs_pos = ( double* ) malloc( SCount * sizeof(double) );
|
@@ -208,6 +209,15 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
208
209
|
} else {
|
209
210
|
profit_loss = (*( USts_array + leg )) - Spot;
|
210
211
|
}
|
212
|
+
|
213
|
+
if (ConvertNotional == 1){
|
214
|
+
if(Spot < *( Ps_array + leg )){
|
215
|
+
Ns_array[leg] = *(Ns_array + leg) / *( LSts_array + leg );
|
216
|
+
} else {
|
217
|
+
Ns_array[leg] = *(Ns_array + leg) / *( USts_array + leg );
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
211
221
|
// dash
|
212
222
|
if ( Spot_dash < *( LSts_array + leg ) ) {
|
213
223
|
profit_loss_dash = Spot_dash - (*( LSts_array + leg ));
|
@@ -315,6 +325,7 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
315
325
|
if( KType == ABSOLUTE || KType == PIVOT_ABSOLUTE || KType == COLLAR_ABSOLUTE || KType == DOUBLE_STRIKE_ABSOLUTE ) {
|
316
326
|
for( leg = 0; leg < NL; ++leg ) {
|
317
327
|
// simulation normal
|
328
|
+
rb_p(*(Ns_array +leg ));
|
318
329
|
if( ko_so_far > 0.0 ) {
|
319
330
|
if( sim[leg] >= 0.0 ) {
|
320
331
|
// knock out condition
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tarf_monte_carlo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: '3.20'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivek Routh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|