Calculate the efficient frontier

Overview

关于

  1. 代码主要参考Fábio Neves的文章,你可以在他的文章中找到一些细节性的解释:https://towardsdatascience.com/python-markowitz-optimization-b5e1623060f5
  2. 欢迎转发本期视频支持我们

使用说明

  1. 修改起始时间start_dateend_date。需要注意有些公司上市时间可能比较迟,例如B站是在2018年上市,如果你的开始时间是从2015年开始,那么结果可能会不准确。
  2. 修改和添加data_array中的资产代号,数量没有限制,这里使用的是雅虎财经的API,你可以在搜索引擎中以「公司名+雅虎财经(Yahoo Finance)」搜索对应公司代号。例如茅台是「600519.SS」,苹果是「AAPL」,腾讯是「0700.HK」。
  3. 如果运算时间过长,你可以尝试降低sample_num的数值。
  4. 计算结果仅供参考。投资有风险,入市需谨慎。
You might also like...
A tool to help calculate how to split conveyors in Satisfactory into specific ratios.
A tool to help calculate how to split conveyors in Satisfactory into specific ratios.

Satisfactory Splitter Calculator A tool to help calculate how to split conveyors in Satisfactory into specific ratios. Dependencies Python 3.9 PyYAML

This program can calculate the Aerial Distance between two cities.
This program can calculate the Aerial Distance between two cities.

Aerial_Distance_Calculator This program can calculate the Aerial Distance between two cities. This repository include both Jupyter notebook and Python

BMI-Calculator: Program to Calculate Body Mass Index (BMI)

The Body Mass Index (BMI) or Quetelet index is a value derived from the mass (weight) and height of an individual, male or female.

Mnemosyne: efficient learning with powerful digital flash-cards.

Mnemosyne: Optimized Flashcards and Research Project Mnemosyne is: a free, open-source, spaced-repetition flashcard program that helps you learn as ef

Framework for creating efficient data processing pipelines

Aqueduct Framework for creating efficient data processing pipelines. Contact Feel free to ask questions in telegram t.me/avito-ml Key Features Increas

EasyBuild is a software build and installation framework that allows you to manage (scientific) software on High Performance Computing (HPC) systems in an efficient way.

EasyBuild is a software build and installation framework that allows you to manage (scientific) software on High Performance Computing (HPC) systems in an efficient way.

redun aims to be a more expressive and efficient workflow framework

redun yet another redundant workflow engine redun aims to be a more expressive and efficient workflow framework, built on top of the popular Python pr

A simple and efficient computing package for Genshin Impact gacha analysis

GGanalysisLite计算包 这个版本的计算包追求计算速度,而GGanalysis包有着更多计算功能。 GGanalysisLite包通过卷积计算分布列,通过FFT和快速幂加速卷积计算。 测试玩家得到的排名值rank的数学意义是:与抽了同样数量五星的其他玩家相比,测试玩家花费的抽数大于等于比例

A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time

A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time. Works on both Windows and Linux.

Comments
  • 生成组合随机权重的方式有问题

    生成组合随机权重的方式有问题

    您好,看到您是计算有效前沿的代码里最高赞的,但是随机部分有问题,在标的数很多的情况下无法模拟出有效前沿。 代码是通过所有变量取uniform分布,然后除以随机数的sum。在标的很多的情况下,假设标的1的随机数取了最大值1,剩下N-1个标的随机数和期望值是(N-1)/2,也就是即使标的1随机数取了极值,他的权重的期望值也仅仅是2/(N+2)。标的1权重接近100%的情况只在理论上有,在有限暴力穷举下是不会出现的。

    opened by cheesebear 0
Owner
Wyman Lin
Wyman Lin
MDAnalysis tool to calculate membrane curvature.

The MDAkit for membrane curvature analysis is part of the Google Summer of Code program and it is linked to a Code of Conduct.

MDAnalysis 19 Oct 20, 2022
Custom component to calculate estimated power consumption of lights and other appliances

Custom component to calculate estimated power consumption of lights and other appliances. Provides easy configuration to get virtual power consumption sensors in Home Assistant for all your devices which don't have a build in power meter.

Bram Gerritsen 552 Dec 28, 2022
peace-performance (Rust) binding for python. To calculate star ratings and performance points for all osu! gamemodes

peace-performance-python Fast, To calculate star ratings and performance points for all osu! gamemodes peace-performance (Rust) binding for python bas

null 9 Sep 19, 2022
A tool to allow New World players to calculate the best place to put their Attribute Points for their build and level

New World Damage Simulator A tool designed to take a characters base stats including armor and weapons, level, and base damage of their items (slash d

Joseph P Langford 31 Nov 1, 2022
Tindicators is a Python library to calculate the values of various technical indicators

Tindicators is a Python library to calculate the values of various technical indicators

omar 3 Mar 3, 2022
Flames Calculater App used to calculate flames status between two names created using python's Flask web framework.

Flames Finder Web App Flames Calculater App used to calculate flames status between two names created using python's Flask web framework. First, App g

Siva Prakash 4 Jan 2, 2022
A program to calculate the are of a triangle. made with Python.

Area-Calculator What is Area-Calculator? Area-Calculator is a program to find out the area of a triangle easily. fully made with Python. Needed a pyth

Chandula Janith 0 Nov 27, 2021
Script to calculate the italian fiscal code of a person.

fiscal_code Hi! This is my first public repository, so please be kind if it is not well formatted or it contains errors. I started learning Python abo

FrancescoDiMuro 1 Nov 20, 2021
Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero.

Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with places after the decimal.

Shruti Dhave 2 Nov 29, 2021
Script to calculate delegator epoch returns for all pillars

znn_delegator_calculator Script to calculate estimated delegator epoch returns for all Pillars, so you can delegate to the best one. You can find me o

null 2 Dec 3, 2021