MATLAB代做  | MATLAB代写  | MATLAB有偿编程
首 页
当前位置:MATLAB代做|MATLAB代写|MATLAB有偿编程matlab源码参考源码matlab方面
基于matlab编程金融风险量化分析源码程序        [↓跳到下载地址]
官方主页:源码共享网站:www.buycode.cn

联系方式:客服QQ:1747812398 买代码源码软件站,欢迎咨询

运行环境:Win9X/2000/XP/2003/

源码语言:简体中文

源码类型:源码程序 - 参考源码 - matlab方面

推荐星级:

更新时间:2016-04-05 22:37:15

源码简介

%% Compute Value at Risk for a given portfolio
% This script computes the Value at Risk for a portfolio using 3 different
% techniques, historical simulation, parametric, and Monte Carlo
% simulation. 

%% Import data from Excel


%% Convert price series to return series and visualize historical returns
% This step illustrates converting a price series to a return series using
% the function TICK2RET from the Financial Toolbox.  This function allows
% for calculating simple or logarithmic returns (continuous). 
%
% THIS SECTION REQUIRES THE FOLLOWING MATHWORKS PRODUCTS AND THEIR
% RESPECTIVE DEPENDENCIES:
% * Financial Toolbox

clear variables
load USStockPrices

%% Visualize price series
% Normalize prices starting at $1
normPrices = ret2tick(tick2ret(HistPrices));

% Visualize normPrices from Workspace window
mypick = strcmpi(Tickers, 'GOOG') | strcmpi(Tickers, 'IBM') ...
    | strcmpi(Tickers, 'AAPL');
mypickStockPrices = HistPrices(:, mypick);
mypickNormPrices = normPrices(:, mypick);
mypickTickers = Tickers(mypick);
plot(mypickNormPrices,'DisplayName','mypickNormPrices','YDataSource','mypickNormPrices');figure(gcf)
legend(mypickTickers)

normIndexPrice = ret2tick(tick2ret(pricesIndex));
hold all
plot(normIndexPrice,'DisplayName','Index','YDataSource','normIndexPrice');figure(gcf)

%% Explain simple and logarithmic returns
AAPL = mypickStockPrices(1:11,1); % Take first 11-day prices of AAPL
retSimple = tick2ret(AAPL);
retLog = tick2ret(AAPL, [], 'Continuous');
[retLog retSimple]
[retLog log(1+retSimple)]
[exp(retLog)-1 retSimple]
[sum(retLog) prod(1+retSimple)-1] %#ok<*NOPTS>
[exp(sum(retLog))-1, prod(1+retSimple)-1]

%% Simple data analysis, mean, std, correlation, beta
mypickRet = tick2ret(mypickStockPrices, [], 'Continuous');
mean(mypickRet)
std(mypickRet)
% Max drawdown
maxdrawdown(mypickStockPrices)  % From Financial Toolboxes
% Correlation
corrcoef(mypickRet)

% Simple beta calculation
IndexRet = tick2ret(pricesIndex);
AAPLRet = tick2ret(mypickStockPrices(:,1));

% Auto-generate figure
createfigure([mypickNormPrices, normIndexPrice], IndexRet, AAPLRet, ...
    [], [0 0 1])

%% Calculate return from price series
returnsSecurity = tick2ret(HistPrices,[],'Continuous');
totalReturns = sum(returnsSecurity);
numDays = size(HistPrices, 1);

% The heatmap makes use of MATLAB's graphics capabilities.  For more
% information edit the M-file "makeHeatmap.m"
makeHeatmap(totalReturns(end, :), Tickers, numDays, 'returns', 'matlab');

% [EOF]


提 示:本站所有源码只提供浏览,需要定制的朋友可以联系在线客服!
注意:价格根据项目的难易程度来定价格业务咨询

基于matlab编程金融风险量化分析源码程序 --下载地址

注意:为避免不必要的误会,本站项目里的源码只公开部分需要的联系在线客服

本站长期招聘程序代写高手,欢迎加入华南地区matlab团队

想创业却没有经验的人

无论你是否有过网上开店的经验,都可以随时联系在线客服,建立自己独立的网站
想开网店却不知道如何入手

淘宝创业成本低而且风险小,如果想开淘宝店的朋友可以联系在线客服。
想兼职创业,却不擅长交际与服务的人

在家创业月入5000元。网站程序+百套群发工具+网赚资料+域名+空间+本站终身代理资格,这样你网赚的条件全具备了。每天3小时管理、推广、收钱。
缺乏能快速赢利型产品的人

导入多种最新流行营销软件+网赚教程,让入驻者轻松加盟、复制有效成交技巧、快速赚钱。

源码评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论

浏览说明

* 本站所有源码全部公开,随时随地浏览!
* MATLAB软件如用于商业用途,请购买正版!
* 如果您发现下载链接错误,请点击报告错误谢谢!
* 站内提供的所有软件包含破解及注册码均是由网上搜集,若侵犯了你的版权利益,敬请来信通知我们!
Copyright © 2008-2014 www.buycode.cn. All Rights Reserved.
页面执行时间:218.75000 毫秒