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

📄 reporter.m

📁 仿真人工金融市场Jackson代码
💻 M
字号:
//  Reporter.m//  This file defines the method of stock valuation for//  fundamental traders....//     -- this trader just reports the fundamental value//     -- we will use this individual to derive the fundamental//	  price//#import "Reporter.h"// Implementation of a fundamental trader ..@implementation Reporter-createEnd {   [super createEnd];   //  let them start out well   expRiskyCFLag = [mktStats getEarningsLag: 0];   [self projectEarnings];return self;}- projectEarnings {   double rho;   if (diagLevel & METHOD_ENTRY)      printf("*** projectEarnings (Reporter) \n");   // Determine expected 1-period ahead price and periodic cash flow   // Use rational expectations forecast.   //  If CF follows ARMA(1,1) process as described in paper,   //    rational expectations forecast of next CF is weighted   //    avg of last CF and last forecast CF   rho = 1+riskyGrowthRate;   riskyCF = [mktStats getEarningsLag:0];   // for initial forecast   if (expRiskyCFLag == 0)     expRiskyCFLag = riskyCF;   risky1CF = 0.75 * expRiskyCFLag +                (rho - 0.75) * riskyCF;   if (diagLevel & REPORTER)      printf ("REPORT_PROJECT (%d) expEarn (%f) expEarnLag (%f) \n",		daysTillEarnings,		risky1CF,		expRiskyCFLag );   // save forecast for next time   expRiskyCFLag = risky1CF;return self;}-step {   double dlyRate, pvif, t1, expP1, t2;   if ((diagLevel & METHOD_ENTRY) ||       (diagLevel & METHOD_SCHED))      printf("*** step (Reporter) \n");   [super step];   if (daysTillEarnings == 0) {         [self projectEarnings];     // Use Gordon Model for now     //   NOTE:  all terms are in qtly terms     riskyValue = risky1CF / 		(discountRate - riskyGrowthRate);    } else {  // must discount expected earnings and expected	     //    price based upon gordon growth model        dlyRate = discountRate / 90;     pvif = pow ((double)1+dlyRate, (double)daysTillEarnings);     t1 = risky1CF / pvif;     expP1 = (risky1CF * (1+riskyGrowthRate))/		(discountRate - riskyGrowthRate);     t2 = expP1 / pvif;     riskyValue = t1 + t2;   }   // Because of limited liability a value less than zero makes   //  no sense.  For that matter, exactly zero doesn't make   //  much sense either, but it is easier than calculating an   //  option value or the like ...   if (riskyValue < 0)      riskyValue = 0;     if (diagLevel & REPORTER)      printf ("REPORT daysLeft (%d) cur riskyCF (%f) earnlag (%f) earnest (%f) val (%f)\n",		daysTillEarnings,		[mktStats getRiskyCF],		[mktStats getEarningsLag: 0],   		expRiskyCFLag,		riskyValue);   // SPECIAL JOB Reporter is to tell MKTSTATS what   //  the fund price is.  Right now this limits us to a   //  SINGLE reporter since we only want this reported   //  one time!!!   [mktStats addFundPrice: riskyValue];   return self;}@end

⌨️ 快捷键说明

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