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

📄 emhtrader.m

📁 仿真人工金融市场Jackson代码
💻 M
字号:
//  EMHTrader.m//  This file defines the method of stock valuation for//   traders who believe the markets are efficient....//  An implication of this belief is that they expect the //  price to be correct in all periods.//  Hence, they derive their expected return only from what//  they believe the risky asset should return.  Since they//  expect prices to be correct, their "expected" return won't change.//#import "EMHTrader.h"// Implementation of a EMH fundamental trader ..@implementation EMHTrader- (double) getRiskyValue{   if (diagLevel & METHOD_ENTRY)      printf("*** getRiskyValue (EMHTrader) entry\n");  return (riskyValue);}-step {   ShareRequest * aRequest;   if ((diagLevel & METHOD_ENTRY) ||       (diagLevel & METHOD_SCHED))      printf("*** step (EMHTrader) entry\n");   [super step];   liqNeeds  = [self getLiqNeeds];   wealth = [self getWealth];   [self printWealth];   expRiskyRet = discountRate;    rvar = [mktStats getRiskyRetVar];   optRiskyFraction = (expRiskyRet - riskLessRate)/                      (riskAversion * rvar);   riskyValue = [mktStats getRiskyPrice];   // Calculate units to buy/sell "assuming" price was correct    optRiskyUnits = (wealth * optRiskyFraction) /                   riskyValue;   [self printValue];   [self printPortChoice];   // If he wants more of the risky asset   //   NOTE:  EMH trader simply buys/sells @ mkt price since he   //          believes it is correct.   aRequest = [ShareRequest create: [self getZone]];   [aRequest setTrader: (id *) self];   [aRequest setUnitPrice: -1];   // If he wants more of the risky asset   if (optRiskyUnits > riskyUnits ) {     [aRequest setGrossUnits: optRiskyUnits - riskyUnits];     [aRequest setNetUnits: optRiskyUnits - riskyUnits];     [mktMaker addRiskyDemand: aRequest];   } else {     [aRequest setGrossUnits: riskyUnits - optRiskyUnits];     [aRequest setNetUnits: riskyUnits - optRiskyUnits];     [mktMaker addRiskySupply: aRequest];   }   [self printDemand];    return self;}-print {  printf("FUND TTEST  \n");  return self;}@end

⌨️ 快捷键说明

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