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

📄 trader.h

📁 仿真人工金融市场Jackson代码
💻 H
字号:
//  Tim Jares -- Trader.h //  This include file defines the characteristics of traders//   in this market simulation.  It should be general enough//   to define all types of market participants.  Specific//   types of traders should inherit these attributes and//   add their specific beliefs.#import <objectbase/SwarmObject.h>//#import <random.h>#import <math.h>#import "MktStats.h"#import "MktMaker.h"#import "ShareRequest.h"// This is just a sample agent: real models need real agents.@interface Trader: SwarmObject {  //   // status information  //  char   name[64];		// Trader name  double wealth;		// Running wealth total  int    periodOfBankruptcy;    // period wealth went non-positive  double initWealth;		// Initial wealth total  int	 daysTillEarnings;  double riskyPrice;		// Current risky asset price  double riskLessPrice;		// Price of riskless asset/unit  double riskyCF;		// Current risky CF  // personal beliefs/expectations  double riskyValue;		// Perceived risky asset value/unit  double risky1Price;		// Expected 1-period ahead price  double risky1CF;		// Exp. 1-period ahead periodic 				//  cash flow,  e.g., a dividendk  double expRiskyCFLag;		// prior expected risky cash flow  double riskLessRate;		// riskless coupon rate  double riskyGrowthRate;	// Expected risky asset cash flow				//  growth rate  double riskLess1CF;		// Exp. 1-period ahead coupon pmt   double discountRate;		// Rate to discount risky cash flow  double liqNeeds;              // current draw from liq Need distrib.  double cumLiqNeeds;           // track TOTAL liq needs over time.  double liqMean;		// mean value of periodic liquidity needs   double liqVar;		// variance of liq. needs  double optRiskyFraction;	// portfolio choice  double optRiskyUnits;		// port. choice  double expRiskyRet;		// estimate (different for diff traders)  double rvar;			// variance of risky returns  double riskAversion;  id <MT19937gen> randomGenerator;  id <NormalDist> liqNeedDist;  id <NormalDist> biasedForecastDist;  id <NormalDist> unBiasedForecastDist;@public  // make holdings available so periodic payments can be made  double riskyUnits;		// Holdings of risky asset  double riskLessUnits;		// Holdings of riskless asset  double cash;			// Account to trach cash available to				// purchase or to put sales each period.				// If a request to purchase is made with				// no cash, it will be cancelled OR should				// I take the liberty of selling riskless				// holdings ....???  // demand information  double riskyBid;		// price willing to pay  double riskyBidAmt;		// risky units demanded  double riskyOffer;		// price willing to sell at  double riskyOfferAmt;		// risky units supplied  double riskLessBid;		//  double riskLessBidAmt;	// riskLess units demanded  double riskLessOffer;		//  double riskLessOfferAmt;	// riskLess units supplied  id mktMaker;  id mktStats;  int diagLevel;}-createEnd;-setDiagLevel: (int) l;-addRiskyUnits: (double) u;-subtractRiskyUnits: (double) u;-(double) checkRiskyUnits;-addRiskLessUnits: (double) u;-subtractRiskLessUnits: (double) u;-(double) checkRiskLessUnits;-addCash: (double) c;-(double) checkCash;-subtractCash: (double) c;-setEndow: (double) risky : (double) riskless;-setMktMaker: (id) m;-setMktStats: (id) m;-setTraderName: (char *) n;-(double) getLiqNeeds;-setLiqMean: (double) m liqVar: (double) v;-(char *) getTraderName;-(double) getRiskyValue;-(double) getWealth;-(double) getInitWealth;-setBRPeriod: (int) p;-(int) getBRPeriod;-printWealth;-printEstimates;-printValue;-printPortChoice;-printDemand;-step;-print;@end

⌨️ 快捷键说明

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