-
1.
0kankalar bu zıkkım niye çalışmıyo:
6. include <cstdlib>
7. include <ctime>
8. include <iostream>
9. include <cmath>
10. include "normdist.h"
using namespace std;
//normal distribution
double N(const double& z) {
if (z > 6.0) { return 1.0; };
if (z < -6.0) { return 0.0; };
double b1 = 0.31938153;
double b2 = -0.356563782;
double b3 = 1.781477937;
double b4 = -1.821255978;
double b5 = 1.330274429;
double p = 0.2316419;
double c2 = 0.3989423;
double a=fabs(z);
double t = 1.0/(1.0+a*p);
double b = c2*exp((-z)*(z/2.0));
double N = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;
N = 1.0-b*N;
if ( z < 0.0 ) N = 1.0 - N;
return N;
};
// greeks calculation
void option_price_partials_call_black_scholes( double S, // spot price
double X, // Strike (exercise) price,
double r, // interest rate
double sigma, // volatility
double time, // time to maturity
double& Delta, // partial wrt S
double& Gamma, // second prt wrt S
double& Theta, // partial wrt time
double& Vega, // partial wrt sigma
double& Rho){ // partial wrt r
double time_sqrt = sqrt(time);
double d1 = (log(S/X)+r*time)/(sigma*time_sqrt) + 0.5*sigma*time_sqrt;
double d2 = d1-(sigma*time_sqrt);
Delta = N(d1);
Gamma = N(d1)/(S*sigma*time_sqrt);
Theta =- (S*sigma*N(d1)) / (2*time_sqrt) - r*X*exp( -r*time)*N(d2);
Vega = S * time_sqrt * N(d1);
Rho = X * time * exp(-r * time) * N(d2);
};
gelen hata mesajı:
undefined reference to 'Winmain@16'
bu ne beahhhh?
-
2.
+117. satırı çıkarıp zütüne sokarsan düzelir
-
3.
0yoooohhhh olmiyiiiiiiiii
-
4.
0aloooooooooooooo
-
5.
+1amacın nedir aq
-
6.
+1ıı tak yedın ne sıkıme geldın
-
7.
0amaç delta gamma rho bilmem neyi hesaplamak
ya bi bakın 2 dakka çok ufak bişiyi ekgib ama neyi ekgib -
8.
0la laaaaa
- 9.
-
10.
0lan yok mu anlayan
-
11.
+1getchar
getchar
return(0)
}
hadi bana eyvallah -
12.
0lan bi el atın sevaptır
-
13.
0alooooooooo
-
14.
+1if (z > 6.0) { return 1.0; };
iften sonra noktalı virgül kullanılır mı muallak şimdi gibtir git -
15.
0kanka son hali bu:
11. include <cstdlib>
12. include <ctime>
13. include <iostream>
14. include <cmath>
15. include "normdist.h"
using namespace std;
//normal distribution
double N(const double& z) {
if (z > 6.0) { return 1.0; };
if (z < -6.0) { return 0.0; };
double b1 = 0.31938153;
double b2 = -0.356563782;
double b3 = 1.781477937;
double b4 = -1.821255978;
double b5 = 1.330274429;
double p = 0.2316419;
double c2 = 0.3989423;
double a=fabs(z);
double t = 1.0/(1.0+a*p);
double b = c2*exp((-z)*(z/2.0));
double N = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;
N = 1.0-b*N;
if ( z < 0.0 ) N = 1.0 - N;
return N;
};
// greeks calculation
void option_price_partials_call_black_scholes( double S, // spot price
double X, // Strike (exercise) price,
double r, // interest rate
double sigma, // volatility
double time, // time to maturity
double Delta, // partial wrt S
double Gamma, // second prt wrt S
double Theta, // partial wrt time
double Vega, // partial wrt sigma
double Rho){ // partial wrt r
double time_sqrt = sqrt(time);
double d1 = (log(S/X)+r*time)/(sigma*time_sqrt) + 0.5*sigma*time_sqrt;
double d2 = d1-(sigma*time_sqrt);
Delta = N(d1);
Gamma = N(d1)/(S*sigma*time_sqrt);
Theta =- (S*sigma*N(d1)) / (2*time_sqrt) - r*X*exp( -r*time)*N(d2);
Vega = S * time_sqrt * N(d1);
Rho = X * time * exp(-r * time) * N(d2);
};
int main (void) {
double S = 0.0;
double X = 0.0;
double r = 0.0;
double Sigma = 0.0;
double time = 0.0;
double Delta= 0.0;
double Gamma= 0.0;
double Theta= 0.0;
double Vega= 0.0;
double Rho= 0.0;
printf("please enter the parameters S, X, r, Sigma, time:n");
scanf("%lf %lf %lf %lf %lfn", &S, &X, &r, &Sigma, &time);
printf("you entered: S=%f, X=%f,r=%f, Sigma=%f,time=%f",S, X, r, Sigma, time);
option_price_partials_call_black_scholes(S, X, r, Sigma, time, Delta, Gamma, Theta, Vega, Rho);
printf("results are: Delta=%f, Gamma=%f,Theta=%f, Vega=%f,Rho=%f",Delta, Gamma, Theta, Vega, Rho);
}
olmuyo yine olmuyo gibtiimin kodu yine olmuyo -
16.
0lan internete baktım millete obeb-okek vermisler odev diye bize verilen ise bak ak yeaaaa
-
17.
+2cCc Turbo Pascal giber cCc
read(inci);
inci:= spot + giber -
18.
+1son hatayı ver amcık
-
19.
+1} sonrasındaki ; lkeri çıkar kurtul
-
20.
0hata yok ak program çalışıyo ama S disindaki butun degiskenleri 0 aliyor. bu ne is yaaaaa