portfolio optimization examples using financial toolbox™ -凯发k8网页登录
follow a sequence of examples that highlight features of the object. specifically, the examples use the object to show how to set up mean-variance portfolio optimization problems that focus on the two-fund theorem, the impact of transaction costs and turnover constraints, how to obtain portfolios that maximize the sharpe ratio, and how to set up two popular hedge-fund strategies — dollar-neutral and 130-30 portfolios.
set up the data
every example works with moments for monthly total returns of a universe of 30 "blue-chip" stocks. although derived from real data, these data are for illustrative purposes and are not meant to be representative of specific assets or of market performance. the data are contained in the file bluechipstockmoments.mat
with a list of asset identifiers in the variable assetlist
, a mean and covariance of asset returns in the variables assetmean
and assetcovar
, and the mean and variance of cash and market returns in the variables cashmean
, cashvar
, marketmean
, and marketvar
. since most of the analysis requires the use of the standard deviation of asset returns as the proxy for risk, cash, and market variances are converted into standard deviations.
load bluechipstockmoments
mret = marketmean;
mrsk = sqrt(marketvar);
cret = cashmean;
crsk = sqrt(cashvar);
create a portfolio object
first create a "standard" portfolio
object with to incorporate the list of assets, the risk-free rate, and the moments of asset returns into the object.
p = portfolio('assetlist',assetlist,'riskfreerate',cashmean); p = setassetmoments(p,assetmean,assetcovar);
to provide a basis for comparison, set up an equal-weight portfolio and make it the initial portfolio in the object. keep in mind that the hedged portfolios to be constructed later will require a different initial portfolio. once the initial portfolio is created, the function estimates the mean and standard deviation of equal-weight portfolio returns.
p = setinitport(p,1/p.numassets); [ersk,eret] = estimateportmoments(p,p.initport);
a specialized "helper" function portfolioexamples_plot
makes it possible to plot all results to be developed here. the first plot shows the distribution of individual assets according to their means and standard deviations of returns. in addition, the equal-weight, market, and cash portfolios are plotted on the same plot. note that the portfolioexamples_plot
function converts monthly total returns into annualized total returns.
clf; portfolioexamples_plot('asset risks and returns', ... {'scatter', mrsk, mret, {'market'}}, ... {'scatter', crsk, cret, {'cash'}}, ... {'scatter', ersk, eret, {'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
set up a portfolio optimization problem
set up a "standard" or default mean-variance portfolio optimization problem with the function that requires fully-invested long-only portfolios (non-negative weights that must sum to 1
). given this initial problem, estimate the efficient frontier with the functions and , where estimates efficient portfolios and estimates risks and returns for portfolios. the next figure overlays the efficient frontier on the previous plot.
p = setdefaultconstraints(p); pwgt = estimatefrontier(p,20); [prsk,pret] = estimateportmoments(p,pwgt); % plot the efficient frontier. clf; portfolioexamples_plot('efficient frontier', ... {'line', prsk, pret}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
illustrate the tangent line to the efficient frontier
tobin's mutual fund theorem (tobin 1958) says that the portfolio allocation problem is viewed as a decision to allocate between a riskless asset and a risky portfolio. in the mean-variance framework, cash serves as a proxy for a riskless asset and an efficient portfolio on the efficient frontier serves as the risky portfolio such that any allocation between cash and this portfolio dominates all other portfolios on the efficient frontier. this portfolio is called a tangency portfolio because it is located at the point on the efficient frontier where a tangent line that originates at the riskless asset touches the efficient frontier.
given that the object already has the risk-free rate, obtain the tangent line by creating a copy of the object with a budget constraint that permits allocation between 0% and 100% in cash. since the object is a value object, it is easy to create a copy by assigning the output of either or the "set" functions to a new instance of the object. the plot shows the efficient frontier with tobin's allocations that form the tangent line to the efficient frontier.
q = setbudget(p, 0, 1); qwgt = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); % plot efficient frontier with tangent line (0 to 1 cash). clf; portfolioexamples_plot('efficient frontier with tangent line', ... {'line', prsk, pret}, ... {'line', qrsk, qret, [], [], 1}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
note that cash actually has a small risk so that the tangent line does not pass through the cash asset.
obtain range of risks and returns
to obtain efficient portfolios with target values of either risk or return, it is necessary to obtain the range of risks and returns among all portfolios on the efficient frontier. this is accomplished with the function.
[rsk,ret] = estimateportmoments(p,estimatefrontierlimits(p)); display(rsk)
rsk = 2×1
0.0348
0.0903
display(ret)
ret = 2×1
0.0094
0.0179
the range of monthly portfolio returns is between 0.9% and 1.8% and the range for portfolio risks is between 3.5% and 9.0%. in annualized terms, the range of portfolio returns is 11.2% to 21.5% and the range of portfolio risks is 12.1% to 31.3%.
find a portfolio with a targeted return and targeted risk
given the range of risks and returns, it is possible to locate specific portfolios on the efficient frontier that have target values for return and risk using the functions and .
targetreturn = 0.20; % input target annualized return and risk here. targetrisk = 0.15; % obtain portfolios with targeted return and risk. awgt = estimatefrontierbyreturn(p,targetreturn/12); [arsk,aret] = estimateportmoments(p,awgt); bwgt = estimatefrontierbyrisk(p,targetrisk/sqrt(12)); [brsk,bret] = estimateportmoments(p,bwgt); % plot efficient frontier with targeted portfolios. clf; portfolioexamples_plot('efficient frontier with targeted portfolios', ... {'line', prsk, pret}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', arsk, aret, {sprintf('%g%% return',100*targetreturn)}}, ... {'scatter', brsk, bret, {sprintf('%g%% risk',100*targetrisk)}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
to see what these targeted portfolios look like, use the object to set up "blotters" that contain the portfolio weights and asset names (which are obtained from the object).
ablotter = dataset({100*awgt(awgt > 0),'weight'}, 'obsnames', p.assetlist(awgt > 0)); displayportfolio(sprintf('portfolio with %g%% target return', 100*targetreturn), ablotter, false);
portfolio with 20% target return weight cat 1.1445 intc 0.17452 mo 9.6521 msft 0.85862 utx 56.918 wmt 31.253
bblotter = dataset({100*bwgt(bwgt > 0),'weight'}, 'obsnames', p.assetlist(bwgt > 0)); displayportfolio(sprintf('portfolio with %g%% target risk', 100*targetrisk), bblotter, false);
portfolio with 15% target risk weight cat 2.05e-20 ge 2.0341e-21 ibm 4.0381e-21 intc 2.2585 jnj 9.2162 mmm 16.603 mo 15.388 msft 4.4467 pg 4.086 utx 10.281 wmt 25.031 xom 12.69
transactions costs
the object makes it possible to account for transaction costs as part of the optimization problem. although individual costs can be set for each asset, use the scalar expansion features of the portfolio
object's functions to set up uniform transaction costs across all assets and compare efficient frontiers with gross versus net portfolio returns.
buycost = 0.0020; sellcost = 0.0020; q = setcosts(p,buycost,sellcost); qwgt = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); % plot efficient frontiers with gross and net returns. clf; portfolioexamples_plot('efficient frontier with and without transaction costs', ... {'line', prsk, pret, {'gross'}, ':b'}, ... {'line', qrsk, qret, {'net'}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
turnover constraint
in addition to transaction costs, the object can handle turnover constraints. the following example demonstrates that a turnover constraint produces an efficient frontier in the neighborhood of an initial portfolio that may restrict trading. moreover, the introduction of a turnover constraint often implies that multiple trades may be necessary to shift from an initial portfolio to an unconstrained efficient frontier. consequently, the turnover constraint introduces a form of time diversification that can spread trades out over multiple time periods. in this example, note that the sum of purchases and sales from the function confirms that the turnover constraint is satisfied.
buycost = 0.0020; sellcost = 0.0020; turnover = 0.2; q = setcosts(p, buycost,sellcost); q = setturnover(q,turnover); [qwgt,qbuy,qsell] = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); % plot efficient frontier with turnover constraint. clf; portfolioexamples_plot('efficient frontier with turnover constraint', ... {'line', prsk, pret, {'unconstrained'}, ':b'}, ... {'line', qrsk, qret, {sprintf('%g%% turnover', 100*turnover)}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
displaysumoftransactions(turnover, qbuy, qsell)
sum of purchases by portfolio along efficient frontier (max. turnover 20%) 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 sum of sales by portfolio along efficient frontier (max. turnover 20%) 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000
tracking-error constraint
the object can handle tracking-error constraints, where tracking-error is the relative risk of a portfolio compared with a tracking portfolio. in this example, a sub-collection of nine assets forms an equally-weighted tracking portfolio. the goal is to find efficient portfolios with tracking errors that are within 5% of this tracking portfolio.
ii = [15, 16, 20, 21, 23, 25, 27, 29, 30]; % indexes of assets to include in the tracking portfolio. trackingerror = 0.05/sqrt(12); trackingport = zeros(30, 1); trackingport(ii) = 1; trackingport = (1/sum(trackingport))*trackingport; q = settrackingerror(p,trackingerror,trackingport); qwgt = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); [trsk,tret] = estimateportmoments(q,trackingport); % plot the efficient frontier with tracking-error constraint. clf; portfolioexamples_plot('efficient frontier with 5% tracking-error constraint', ... {'line', prsk, pret, {'unconstrained'}, ':b'}, ... {'line', qrsk, qret, {'tracking'}}, ... {'scatter', [mrsk, crsk], [mret, cret], {'market', 'cash'}}, ... {'scatter', trsk, tret, {'tracking'}, 'r'});
combined turnover and tracking-error constraints
this example illustrates the interactions that can occur with combined constraints. in this case, both a turnover constraint relative to an initial equal-weight portfolio and a tracking-error constraint relative to a tracking portfolio must be satisfied. the turnover constraint has a maximum of 30% turnover and the tracking-error constraint has a maximum of 5% tracking error. note that the turnover to get from the initial portfolio to the tracking portfolio is 70% so that an upper bound of 30% turnover means that the efficient frontier will lie somewhere between the initial portfolio and the tracking portfolio.
turnover = 0.3; initport = (1/q.numassets)*ones(q.numassets, 1); ii = [15, 16, 20, 21, 23, 25, 27, 29, 30]; % indexes of assets to include in tracking portfolio. trackingerror = 0.05/sqrt(12); trackingport = zeros(30, 1); trackingport(ii) = 1; trackingport = (1/sum(trackingport))*trackingport; q = setturnover(q,turnover,initport); qwgt = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); [trsk,tret] = estimateportmoments(q,trackingport); [ersk,eret] = estimateportmoments(q,initport); % plot the efficient frontier with combined turnover and tracking-error constraint. clf; portfolioexamples_plot('efficient frontier with turnover and tracking-error constraint', ... {'line', prsk, pret, {'unconstrained'}, ':b'}, ... {'line', qrsk, qret, {'turnover & tracking'}}, ... {'scatter', [mrsk, crsk], [mret, cret], {'market', 'cash'}}, ... {'scatter', trsk, tret, {'tracking'}, 'r'}, ... {'scatter', ersk, eret, {'initial'}, 'b'});
maximize the sharpe ratio
the sharpe ratio (sharpe 1966) is a measure of return-to-risk that plays an important role in portfolio analysis. specifically, a portfolio that maximizes the sharpe ratio is also the tangency portfolio on the efficient frontier from the mutual fund theorem. the maximum sharpe ratio portfolio is located on the efficient frontier with the function and the object is used to list the assets in this portfolio.
p = setinitport(p, 0); swgt = estimatemaxsharperatio(p); [srsk,sret] = estimateportmoments(p,swgt); % plot the efficient frontier with portfolio that attains maximum sharpe ratio. clf; portfolioexamples_plot('efficient frontier with maximum sharpe ratio portfolio', ... {'line', prsk, pret}, ... {'scatter', srsk, sret, {'sharpe'}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
% set up a dataset object that contains the portfolio that maximizes the sharpe ratio. blotter = dataset({100*swgt(swgt > 0),'weight'}, 'obsnames', assetlist(swgt > 0)); displayportfolio('portfolio with maximum sharpe ratio', blotter, false);
portfolio with maximum sharpe ratio weight aa 1.9766e-15 aig 1.9146e-15 axp 1.0611e-15 ba 5.6229e-16 c 2.0142e-15 cat 2.9838e-15 dd 3.1459e-16 dis 5.9796e-16 ge 5.6384e-15 gm 7.3545e-16 hd 2.0404e-11 hon 3.322e-16 hpq 2.0397e-15 ibm 8.9075e-15 intc 2.6638 jnj 9.0044 jpm 5.4252e-16 ko 2.4688e-16 mcd 8.782e-16 mmm 15.502 mo 13.996 mrk 3.235e-16 msft 4.4777 pfe 7.3698e-16 pg 7.4588 sbc 3.8468e-16 utx 6.0056 vz 3.9213e-16 wmt 22.051 xom 18.841
confirm that maximum sharpe ratio is a maximum
the following plot demonstrates that this portfolio (which is located at the dot on the plots) indeed maximizes the sharpe ratio among all portfolios on the efficient frontier.
psratio = (pret - p.riskfreerate) ./ prsk; ssratio = (sret - p.riskfreerate) / srsk; clf; subplot(2,1,1); plot(prsk, pret, 'linewidth', 2); hold on scatter(srsk, sret, 'g', 'filled'); title('\bfefficient frontier'); xlabel('portfolio risk'); ylabel('portfolio return'); hold off subplot(2,1,2); plot(prsk, psratio, 'linewidth', 2); hold on scatter(srsk, ssratio, 'g', 'filled'); title('\bfsharpe ratio'); xlabel('portfolio risk'); ylabel('sharpe ratio'); hold off
illustrate that sharpe is the tangent portfolio
the next plot demonstrates that the portfolio that maximizes the sharpe ratio is also a tangency portfolio (in this case, the budget constraint is opened up to permit between 0% and 100% in cash).
q = setbudget(p, 0, 1); qwgt = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); % plot showing that the sharpe ratio portfolio is the tangency portfolio. clf; portfolioexamples_plot('efficient frontier with maximum sharpe ratio portfolio', ... {'line', prsk, pret}, ... {'line', qrsk, qret, [], [], 1}, ... {'scatter', srsk, sret, {'sharpe'}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
dollar-neutral hedge-fund structure
to illustrate how to use the portfolio optimization tools in hedge fund management, two popular strategies with dollar-neutral and 130-30 portfolios are examined. the dollar-neutral strategy invests equally in long and short positions such that the net portfolio position is 0
. such a portfolio is said to be "dollar-neutral."
to set up a dollar-neutral portfolio, start with the "standard" portfolio problem and set the maximum exposure in long and short positions in the variable exposure
. the bounds for individual asset weights are plus or minus exposure
. since the net position must be dollar-neutral, the budget constraint is 0
and the initial portfolio must be 0
. finally, the one-way turnover constraints provide the necessary long and short restrictions to prevent "double-counting" of long and short positions. the blotter shows the portfolio weights for the dollar-neutral portfolio that maximizes the sharpe ratio. the long and short positions are obtained from the buy and sell trades relative to the initial portfolio.
exposure = 1; q = setbounds(p, -exposure, exposure); q = setbudget(q, 0, 0); q = setonewayturnover(q, exposure, exposure, 0); [qwgt,qlong,qshort] = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); [qswgt,qslong,qsshort] = estimatemaxsharperatio(q); [qsrsk,qsret] = estimateportmoments(q,qswgt); % plot the efficient frontier for a dollar-neutral fund structure with tangency portfolio. clf; portfolioexamples_plot('efficient frontier with dollar-neutral portfolio', ... {'line', prsk, pret, {'standard'}, 'b:'}, ... {'line', qrsk, qret, {'dollar-neutral'}, 'b'}, ... {'scatter', qsrsk, qsret, {'sharpe'}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
% set up a dataset object that contains the portfolio that maximizes the sharpe ratio. blotter = dataset({100*qswgt(abs(qswgt) > 1.0e-4), 'weight'}, ... {100*qslong(abs(qswgt) > 1.0e-4), 'long'}, ... {100*qsshort(abs(qswgt) > 1.0e-4), 'short'}, ... 'obsnames', assetlist(abs(qswgt) > 1.0e-4)); displayportfolio('dollar-neutral portfolio with maximum sharpe ratio', blotter, true, 'dollar-neutral');
dollar-neutral portfolio with maximum sharpe ratio weight long short aa 0.5088 0.5088 0 aig 3.0394 3.0394 0 axp 0.92797 0.92797 0 ba -3.4952 0 3.4952 c 14.003 14.003 0 cat 3.7261 3.7261 0 dd -18.063 0 18.063 dis -4.8236 0 4.8236 ge -3.6178 0 3.6178 gm -3.7211 0 3.7211 hd 1.101 1.101 0 hon -1.4349 0 1.4349 hpq 0.09909 0.09909 0 ibm -8.0585 0 8.0585 intc 1.7693 1.7693 0 jnj 1.3696 1.3696 0 jpm -2.5271 0 2.5271 ko -14.205 0 14.205 mcd 3.91 3.91 0 mmm 7.5995 7.5995 0 mo 4.0856 4.0856 0 mrk 3.747 3.747 0 msft 4.0769 4.0769 0 pfe -9.096 0 9.096 pg 1.6493 1.6493 0 sbc -5.2547 0 5.2547 utx 5.7454 5.7454 0 vz -2.438 0 2.438 wmt 0.84844 0.84844 0 xom 18.529 18.529 0 confirm dollar-neutral portfolio (net, long, short) 0.0000 76.7350 76.7350
130/30 fund structure
finally, the turnover constraints are used to set up a 130-30 portfolio structure, which is a structure with a net long position but permits leverage with long and short positions up to a maximum amount of leverage. in the case of a 130-30 portfolio, the leverage is 30%.
to set up a 130-30 portfolio, start with the "standard" portfolio problem and set the maximum value for leverage in the variable leverage
. the bounds for individual asset weights range between -leverage
and 1 leverage
. since the net position must be long, the budget constraint is 1
and, once again, the initial portfolio is 0
. finally, the one-way turnover constraints provide the necessary long and short restrictions to prevent "double-counting" of long and short positions. the blotter shows the portfolio weights for the 130-30 portfolio that maximizes the sharpe ratio. the long and short positions are obtained from the buy and sell trades relative to the initial portfolio.
leverage = 0.3; q = setbounds(p, -leverage, 1 leverage); q = setbudget(q, 1, 1); q = setonewayturnover(q, 1 leverage, leverage); [qwgt,qbuy,qsell] = estimatefrontier(q,20); [qrsk,qret] = estimateportmoments(q,qwgt); [qswgt,qslong,qsshort] = estimatemaxsharperatio(q); [qsrsk,qsret] = estimateportmoments(q,qswgt); % plot the efficient frontier for a 130-30 fund structure with tangency portfolio. clf; portfolioexamples_plot(sprintf('efficient frontier with %g-%g portfolio', ... 100*(1 leverage),100*leverage), ... {'line', prsk, pret, {'standard'}, 'b:'}, ... {'line', qrsk, qret, {'130-30'}, 'b'}, ... {'scatter', qsrsk, qsret, {'sharpe'}}, ... {'scatter', [mrsk, crsk, ersk], [mret, cret, eret], {'market', 'cash', 'equal'}}, ... {'scatter', sqrt(diag(p.assetcovar)), p.assetmean, p.assetlist, '.r'});
% set up a dataset object that contains the portfolio that maximizes the sharpe ratio. blotter = dataset({100*qswgt(abs(qswgt) > 1.0e-4), 'weight'}, ... {100*qslong(abs(qswgt) > 1.0e-4), 'long'}, ... {100*qsshort(abs(qswgt) > 1.0e-4), 'short'}, ... 'obsnames', assetlist(abs(qswgt) > 1.0e-4)); displayportfolio(sprintf('%g-%g portfolio with maximum sharpe ratio', 100*(1 leverage), 100*leverage), blotter, true, sprintf('%g-%g', 100*(1 leverage), 100*leverage));
130-30 portfolio with maximum sharpe ratio weight long short dd -9.5565 0 9.5565 hon -6.0244 0 6.0244 intc 4.0335 4.0335 0 jnj 7.1234 7.1234 0 jpm -0.44583 0 0.44583 ko -13.646 0 13.646 mmm 20.908 20.908 0 mo 14.433 14.433 0 msft 4.5592 4.5592 0 pg 17.243 17.243 0 sbc -0.32712 0 0.32712 utx 5.3584 5.3584 0 wmt 21.018 21.018 0 xom 35.323 35.323 0 confirm 130-30 portfolio (net, long, short) 100.0000 130.0000 30.0000
references
r. c. grinold and r. n. kahn. active portfolio management. 2nd ed.,2000.
h. m. markowitz. "portfolio selection." journal of finance. vol. 1, no. 1, pp. 77-91, 1952.
j. lintner. "the valuation of risk assets and the selection of risky investments in stock portfolios and capital budgets." review of economics and statistics. vol. 47, no. 1, pp. 13-37, 1965.
h. m. markowitz. portfolio selection: efficient diversification of investments. john wiley & sons, inc., 1959.
w. f. sharpe. "mutual fund performance." journal of business. vol. 39, no. 1, part 2, pp. 119-138, 1966.
j. tobin. "liquidity preference as behavior towards risk." review of economic studies. vol. 25, no.1, pp. 65-86, 1958.
j. l. treynor and f. black. "how to use security analysis to improve portfolio selection." journal of business. vol. 46, no. 1, pp. 68-86, 1973.
local functions
function displaysumoftransactions(turnover, qbuy, qsell) fprintf('sum of purchases by portfolio along efficient frontier (max. turnover %g%%)\n', ... 100*turnover); fprintf('%.4f ', 100*sum(qbuy)), sprintf('\n\n'); fprintf('\n') fprintf('sum of sales by portfolio along efficient frontier (max. turnover %g%%)\n', ... 100*turnover); fprintf('%.4f ', 100*sum(qsell)); end function displayportfolio(description, blotter, longshortflag, portfoliotype) fprintf('%s\n', description); disp(blotter); if (longshortflag) fprintf('confirm %s portfolio\n', portfoliotype); fprintf(' (net, long, short)\n'); fprintf('%.4f ' , [ sum(blotter.weight), sum(blotter.long), sum(blotter.short) ]); end end
see also
| | | | | | | | |