{"id":16306,"date":"2021-09-07T02:24:56","date_gmt":"2021-09-06T18:24:56","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=16306"},"modified":"2023-08-10T13:58:04","modified_gmt":"2023-08-10T05:58:04","slug":"efficient-frontier","status":"publish","type":"insight","link":"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/","title":{"rendered":"Efficient Frontier"},"content":{"rendered":"\n<p>Use trial database to determine the weight of your portfolio.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1_14-Xpp-bopsje2181AWYIOw.jpg\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo Creds:&nbsp;<a href=\"https:\/\/unsplash.com\/photos\/ESsGNnhUiCg\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a11f84996e27\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a11f84996e27\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Highlights\" >Highlights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Preface\" >Preface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#The_Editing_Environment_and_Modules_Required\" >The Editing Environment and Modules Required<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Database_Used\" >Database Used<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Data_Retrieval\" >Data Retrieval<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Portfolio_calculation\" >Portfolio calculation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Efficient_Frontier\" >Efficient Frontier<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Volatility\" >Volatility<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Minimal_Volatility_Portfolio_MVP\" >Minimal Volatility Portfolio (MVP)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#MVP_under_the_same_rate_of_return\" >MVP under the same rate of return<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Sample_after_combined_efficient_frontier\" >Sample after combined efficient frontier<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/efficient-frontier\/#Related_Link\" >Related Link<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"afe2\"><span class=\"ez-toc-section\" id=\"Highlights\"><\/span><strong>Highlights<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficulty\uff1a\u2605\u2605\u2605\u2606\u2606<\/li>\n\n\n\n<li>Calculate and visualize efficient frontier.<\/li>\n\n\n\n<li>Advise\uff1aThis article will introduces the theory roughly. It will not be discussed in detail. Readers who are interested in theory can search for relevant literature. The mathematical calculations will be relatively complicated, using lot of functional programming to increase efficiency and reduce memory requirements. We use plotly module to visualize the result, and the interactive charts allow us to deeply understand the power of result.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4c27\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span><strong>Preface<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"ef4d\">Most people often have hard time to determine the weight of portfolio. However, Harry Markowitz, the Nobel Prize winner in economics, gives us a theory based on the volatility and correlation of stocks. Simulated by different weights on portfolio, we can put the restrictions like given the total risk is the same, to find the highest expected rate of return. In this way, we can choose the weight distribution of portfolio according to our own risk tolerance!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4b7f\"><span class=\"ez-toc-section\" id=\"The_Editing_Environment_and_Modules_Required\"><\/span><strong>The Editing Environment and Modules Required<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"d5f1\">Mac OS and Jupyter Notebook<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># basic<br>import numpy as np<br>import pandas as pd<br># plot<br>import matplotlib.pyplot as plt<br>import matplotlib<br>import plotly.express as px<br>import plotly.graph_objects as go<br># API<br>import tejapi<br>tejapi.ApiConfig.api_key = 'Your Key'<br>tejapi.ApiConfig.ignoretz = True<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"443d\"><span class=\"ez-toc-section\" id=\"Database_Used\"><\/span><strong>Database Used<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/datatables.html?db=TRAIL&amp;t=%E8%A9%A6%E7%94%A8%E8%B3%87%E6%96%99%E5%BA%AB\" rel=\"noreferrer noopener\" target=\"_blank\">Trial Database<\/a>&nbsp;: \u2018 TRAIL\/TAPRCD \u2019<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"83e1\"><span class=\"ez-toc-section\" id=\"Data_Retrieval\"><\/span><strong>Data Retrieval<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"a4b7\"><strong>Step 1.&nbsp;<\/strong>We use TSMC (2330), Evergreen (2603), and President Chain Store (2912) as examples of investment portfolios. The date is selected for 2020, and the option columns selected roi.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = tejapi.get('TRAIL\/TAPRCD',<br>                  coid=['2330', '2603', '2912'],<br>                  mdate={'gte': '2020-01-01', 'lte': '2020-12-<br>                          31'},<br>                  opts={\"sort\": \"mdate.desc\", 'columns': [<br>                        'coid', 'mdate', 'roi']},<br>                  paginate=True)<\/pre>\n\n\n\n<p id=\"d282\"><strong>Step 2.&nbsp;<\/strong>Reset index value, data pivot, column name with stock code<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = data.set_index('mdate')<br>returns = data.pivot(columns='coid')<br>returns.columns = [columns[1] for columns in returns.columns]<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/16mnrlLGUChVr3LuGSxIbzg.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">returns<\/figcaption><\/figure>\n\n\n\n<p id=\"b4d0\"><strong>Step 3.&nbsp;<\/strong>Calculate average return, covariance matrix<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mean_returns = returns.mean()<br>cov_matrix = returns.cov()<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1r4ynOrlAb8yxTNh3rrOrJQ.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">mean and covariance<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"f622\"><span class=\"ez-toc-section\" id=\"Portfolio_calculation\"><\/span><strong>Portfolio calculation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"6ad2\">We need to randomly generate portfolio weights and use a large number of simulations to find the efficiency frontier. We need to record its return, standard deviation, and weight for each investment group.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def portfolio_performance(weights, mean_returns, cov_matrix):<br>    returns = np.sum(mean_returns*weights )<br>    std = np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights))) <br>    return std, returns<\/pre>\n\n\n\n<p id=\"f7ff\">The number of portfolios we want to simulate.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">num_portfolios = 5000<\/pre>\n\n\n\n<p id=\"0886\">Put the function into the function which calculate random investment portfolio to get the results of each investment portfolio.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def random_portfolios(num_portfolios, mean_returns, cov_matrix):<br>    results = np.zeros((3,num_portfolios))<br>    weights_record = []<br>    for i in range(num_portfolios):<br>        weights = np.random.random(len(coid))<br>        weights \/= np.sum(weights)<br>        weights_record.append(weights)<br>        portfolio_std_dev, portfolio_return = <br>        portfolio_performance(weights, mean_returns, cov_matrix)<br>        results[0,i] = portfolio_std_dev<br>        results[1,i] = portfolio_return<br>        results[2,i] = (portfolio_return) \/ portfolio_std_dev<br>    return results, weights_record<\/pre>\n\n\n\n<p id=\"cfbd\">Start the simulation and save the results in&nbsp;<code>results<\/code>&nbsp;and&nbsp;<code>weights_record<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">results = np.zeros((3,num_portfolios))<br>weights_record = []<br>for i in range(num_portfolios):<br>    weights = np.random.random(len(coid))<br>    weights \/= np.sum(weights)<br>    weights_record.append(weights)<br>    portfolio_std_dev, portfolio_return = <br>    portfolio_performance(weights, mean_returns, cov_matrix)<br>    results[0,i] = portfolio_std_dev<br>    results[1,i] = portfolio_return<br>    results[2,i] = (portfolio_return) \/ portfolio_std_dev<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1Uevzzcxe2NKrhkw_k2X-9A.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Random Portfolio<\/figcaption><\/figure>\n\n\n\n<p id=\"fd83\">Visualization: The first number of the text box represents the risk, the second number represents the reward, and the second row of the array represents the weight of the investment.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def protfolios_allocation(mean_returns, cov_matrix, <br>                         num_portfolios):<br>    results, weights = random_portfolios(<br>        num_portfolios, mean_returns, cov_matrix)<br>        <br>    fig = go.Figure(data=go.Scatter(x=results[0, :], <br>                                    y=results[1, :],<br>                                    mode='markers',<br>                                    text = weights_record,<br>                                   ))<br>    <br>    fig.update_layout(title='\u6295\u8cc7\u7d44\u5408\u8868\u73fe\u5206\u4f48',<br>                      xaxis_title=\"\u6295\u8cc7\u7d44\u5408\u7e3d\u98a8\u96aa\",<br>                      yaxis_title=\"\u9810\u671f\u5e73\u5747\u5831\u916c\u7387\",)fig.update_xaxes(showspikes=True,spikecolor=\"grey\",<br>                     spikethickness=1, spikedash='solid')fig.update_yaxes(showspikes=True,spikecolor=\"grey\",<br>                     spikethickness=1, spikedash='solid')fig.show()<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1PMuOxEC7tNT10gJpXj-rOA.gif\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Portfolios Allocation<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4b13\"><span class=\"ez-toc-section\" id=\"Efficient_Frontier\"><\/span><strong>Efficient Frontier<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"b46c\">There are two conditions\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The portfolio with the least risk among all portfolios<\/li>\n\n\n\n<li>Portfolio with minimal risk under the same rate of return<\/li>\n<\/ol>\n\n\n\n<p id=\"ce0f\">This type of condition is equivalent to finding the extreme value, we can use optimize under the scipy module to calculate the minimum value.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import scipy.optimize as sco<\/pre>\n\n\n\n<p id=\"89ad\">Here we define four calculation functions<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"60bd\"><span class=\"ez-toc-section\" id=\"Volatility\"><\/span><strong>Volatility<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">def portfolio_volatility(weights, mean_returns, cov_matrix):<br> return portfolio_performance(weights,mean_returns, cov_matrix)[0]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"9897\"><span class=\"ez-toc-section\" id=\"Minimal_Volatility_Portfolio_MVP\"><\/span><strong>Minimal Volatility Portfolio (MVP)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p id=\"c0e7\">We use the optimize calculation under the scipy module to take the extreme value of the Volatility function under the weight limit of 0 to 1, and the algorithm selects SLSQP (Sequential Least Squares Programming) nonlinear programming<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p id=\"5316\">fun\uff1aobjective function<\/p>\n\n\n\n<p id=\"91ae\">args\uff1aparameters that can be set for the objective function<\/p>\n\n\n\n<p id=\"2cca\">method\uff1aOptimal algorithm<\/p>\n\n\n\n<p id=\"335f\">bounds\uff1aRange of each x<\/p>\n\n\n\n<p id=\"2192\">constraints\uff1athe input is a tuple composed of a dictionary, the dictionary is mainly composed of\u2019type\u2019 and\u2019fun\u2019, type can be\u2019eq\u2019 and\u2019ineq\u2019, which are equality constraints and inequality constraints, respectively, fun is the corresponding constraint The condition can be a lambda function.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\">def min_variance(mean_returns, cov_matrix):<br>    num_assets = len(mean_returns)<br>    args = (mean_returns, cov_matrix)<br>    constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})<br>    bound = (0,1)<br>    bounds = tuple(bound for asset in range(num_assets))<br>    result = sco.minimize(portfolio_volatility, num_assets*<br>             [1\/num_assets,], args=args,<br>             method='SLSQP', bounds=bounds, <br>             constraints=constraints)<br>    return result<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7c2f\"><span class=\"ez-toc-section\" id=\"MVP_under_the_same_rate_of_return\"><\/span><strong>MVP under the same rate of return<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p id=\"d777\">Mainly Due to the difference in constraint conditions, the returns should be fixed to a number, and find the minimum of risk.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def efficient_return(mean_returns, cov_matrix, target):<br>    num_assets = len(mean_returns)<br>    args = (mean_returns, cov_matrix)def portfolio_return(weights):<br>        return portfolio_performance(weights, mean_returns, <br>                                     cov_matrix)[1]constraints = ({'type': 'eq', 'fun': lambda x:  <br>                     portfolio_return(x) - target},<br>                   {'type': 'eq', 'fun': lambda x: np.sum(x) - 1})bounds = tuple((0,1) for asset in range(num_assets))<br>    result = sco.minimize(portfolio_volatility, num_assets*<br>                          [1\/num_assets,], args=args,<br>                          method='SLSQP', bounds=bounds, <br>                          constraints=constraints)<br>    return result<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"f681\"><span class=\"ez-toc-section\" id=\"Sample_after_combined_efficient_frontier\"><\/span><strong>Sample after combined efficient frontier<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">def efficient_profolios(mean_returns, cov_matrix, returns_range):<br>    efficients = []<br>    for ret in returns_range:<br>        efficients.append(efficient_return(mean_returns, <br>                          cov_matrix, ret))<br>    return efficients<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1SaYo47LldR98BU09Y5K1Aw.gif\" alt=\"\"\/><figcaption class=\"wp-element-caption\">MVP &amp; Efficient Frontier<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"742a\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"dc60\">The overall structure of the efficient frontier is actually not difficult to understand. Using a large number of simulation calculations to obtain the weighted, you can set the expected return you want and choose the investment portfolio with the least risk. The Plotly interactive chart allows us to move the mouse on chart, it will show the weight distribution of the current investment portfolio. Of course, the truth remained unchanged is\u00a0<strong>\u201cHigh returns with high risks.\u201d<\/strong>\u00a0If you want a higher return on investment, you need to bear greater volatility. The result of these weights is based on the time of selecting the database, the volatility of the stock at that time, so the efficiency frontier obtained will continue to change over time, so the weight needs to be adjusted for a period of time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1271\"><span class=\"ez-toc-section\" id=\"Related_Link\"><\/span><strong>Related Link<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Use trial database to determine the weight of your portfolio. Highlights Preface Most people often have hard time to determine the weight of portfolio. However, Harry Markowitz, the Nobel Prize winner in economics, gives us a theory based on the volatility and correlation of stocks. Simulated by different weights on portfolio, we can put the [&hellip;]<\/p>\n","protected":false},"featured_media":16307,"template":"","tags":[2620,2371,3008],"insight-category":[690,50],"class_list":["post-16306","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-portfolio","tag-python","tag-tejapi-quant","insight-category-data-analysis","insight-category-fintech"],"acf":[],"_links":{"self":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/16306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":1,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/16306\/revisions"}],"predecessor-version":[{"id":16309,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/16306\/revisions\/16309"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media\/16307"}],"wp:attachment":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media?parent=16306"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/tags?post=16306"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight-category?post=16306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}