⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callrndeltahedge.java

📁 金融资产定价,随机过程,MONTE CARLO 模拟 JAVA 程序和文档资料
💻 JAVA
字号:
/* WARANTY NOTICE AND COPYRIGHTThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.Copyright (C) Michael J. Meyermatmjm@mindspring.comspyqqqdia@yahoo.com*//* * CallrnDeltaHedge.java * * Created on March 20, 2002, 9:18 PM */package Examples.Hedging;import Statistics.*;import Market.*;import Options.*;import Hedging.*;import Triggers.*;import TradingStrategies.*;import IO.*;/** <p>Computes the reduction in the variance of the hedge error over the first  *  hedge interval [0,dt] which true variance minimizing deltas  *  {@link Options.Option#minimumVarianceDelta} yield compared to instantaneous  *  analytic deltas. The reduction in variance is expressed as a percentage of  *  the minimal variance and is computed for a variety of strikes and times *  to maturity. This then gives us a feeling how the varience of an *  entire hedge would be reduced by switching from analytic to true *  variance minimizing deltas.</p> * *  <p>Console  *  program, no user interaction. All parameters fixed in source code.</p> * * @author Michael J. Meyer */public class CallrnDeltaHedge {       public static void main(String[] args)   throws java.io.IOException   {             // file writer to write in columns of fixed width w       final int w=35;                     // width of output columns       String fileName="CallrnDeltaHedge.txt";   // output file       FixedFieldWidthFileWriter        fout=new FixedFieldWidthFileWriter(fileName,w);             int nPaths=400000;              double S_0=50, mu=0.3, sigma=0.2, r=0.05, q=0.0, dt =0.1;       String str="S_0="+S_0+", mu="+mu+", sigma="+sigma+", r="+r+", dt="+dt;       fout.write(str+"\n\n\n");              fout.writeField("Time to expiry",20);       fout.writeField("Strike",20);       fout.writeField("Variance reduction",30);       fout.write("\n\n\n");              for(int T=1;T<6;T+=1)       for(double K=40;K<71;K+=5){                      System.out.println("N="+T+", K="+K);                      double Tc=FinMath.round(T*dt,3);        // time to expiry                  // the underlying, nSignChange=8           final ConstantVolatilityAsset           asset=new ConstantVolatilityAsset(T,dt,8,S_0,r,q,mu,sigma);                     // the call            final BlackScholesCall call=new BlackScholesCall(K,asset);                      double prcntReduction=call.hedgeErrorVarianceReduction(nPaths);           prcntReduction=FinMath.round(prcntReduction,4);                      fout.writeField("  T="+Tc+",",20);           fout.writeField("K="+K+",",20);           fout.writeField(" "+prcntReduction,10);           fout.write("\n");           if(K==80)fout.write("\n\n");             } // for T             fout.close();      System.out.println      ("Finished, results in file CallrnDeltaHedge.txt");      } // end main} // end CallHedgeVariance

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -