Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lequant40
Last active June 22, 2021 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lequant40/d0f645a1d41eecfb59a0eea5260ca9cc to your computer and use it in GitHub Desktop.
Save lequant40/d0f645a1d41eecfb59a0eea5260ca9cc to your computer and use it in GitHub Desktop.
fetch('https://api.portfoliooptimizer.io/v1/portfolio/optimization/mean-variance-efficient',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ assets: 13,
assetsReturns: [...],
assetsCovarianceMatrix: [[...], ...],
constraints: {
portfolioVolatility: 0.05/Math.sqrt(260),
maximumAssetsWeights: [0.20,0.10,0.20,0.20,0.20,0.20,0.20,0.20,0.10,0.10,0.20,0.50,0.50],
assetsGroups: [[1,2,3],[4,5,6],[7,8],[9,10,11],[12,13]],
maximumAssetsGroupsWeights: [0.50,0.50,0.25,0.25,0.50]
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment