📄 callthetapaths.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*//* * PathBranchDemo.java * * Created on March 29, 2002, 9:10 PM */package Examples.Paths;import Market.*;import Options.*;import Graphics.*;/** <p>Displays paths of the call theta computed along simulated * paths of the unerlying.</p> * * @author Michael J. Meyer */public class CallThetaPaths { /** Displays a new path of the theta of a one year call whenever * the window is clicked. */ public static void main(String[] args) { int T=50, // time steps to horizon nPaths=10000, nSignChange=5, // irrelevant but needed for asset constructor w=600, h=350, xOffset=70, yOffset=70; final double S_0=50, mu=0.24, sigma=0.31, q=0.0, r=0.07, dt=0.02, K=100, depth=Math.abs(K-S_0); final double[] path=new double[T+1]; // 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 y0=call.analyticTheta(0); PathFrame window=new PathFrame ("Call theta",w,h,xOffset,yOffset,T,dt,y0){ public double[] nextPath() { asset.newPath(Market.Flag.MARKET_PROBABILITY); int T=call.get_T(); for(int t=0;t<T+1;t++) path[t]=call.analyticTheta(t); return path; } }; // end Window window.show(); } // end main } // end PathBranchDemo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -