Financial Modeling Using Quantum Computing by Anshul Saxena & Javier Mancilla & Iraitz Montalban & Christophe Pere

Financial Modeling Using Quantum Computing by Anshul Saxena & Javier Mancilla & Iraitz Montalban & Christophe Pere

Author:Anshul Saxena & Javier Mancilla & Iraitz Montalban & Christophe Pere
Language: eng
Format: epub
Publisher: Packt
Published: 2023-07-15T00:00:00+00:00


Portfolio management using traditional machine learning algorithms

Classical implementation

Portfolio optimization is a problem related to the financial services and banking industry that emerged with Markovitz’s seminal paper in 1952 (https://onlinelibrary.wiley.com/doi/full/10.1111/j.1540-6261.1952.tb01525.x). The model describes a set of assets x i ∈ X from which a subset needs to be picked to maximize the revenue, while minimizing the risk at 𝑡 future time steps. For a given period, each asset has an expected return linked to it, and the covariance between assets sets the risk amount in terms of diversification (for the sake of simplicity). The idea behind this diversification is that if we only invest in the assets with the highest revenue, the risk of them being driven by the same factors if our investment fails is bigger than if we diversify our portfolio. We will focus on a single-time-step process, assuming that local optima are part of the longer-time-step trajectory toward the global optima of our portfolio.

Let’s consider, then, a single-time step optimization for the sake of simplicity. The investment comes at a cost. A budget (𝐵) is associated with the investment in a portfolio configuration. It is described by the summation cost of investing in each asset as b i, where i is the index of the particular asset. Ideally, our recommendation should not surpass this condition (∑ b i < B). Hence, this classical optimization problem is often posed as:

∑ i=1 n x i e i− θ∑ i,j=1 n x i x j c ij

s . t. ∑ i=1 n x i b i ≤ B

where x i ∈ {0,1} is the mask associated with the selection of our set of assets and 𝜃 is a Lagrangian operator modulating the amount of risk we want to assume. We have binarized this selection, as it simplifies the calculation. Still, more compelled portfolio investments can be considered to tackle those three aspects of the model (revenue, risk, and budget).

We minimize that very same model, as it will fit better the technical approach we will follow. Thus, the final model would look like this:

− ∑ i=1 n x i e i+ θ∑ i,j=1 n x i x j c ij

s . t. ∑ i=1 n x i b i ≤ B

First, we will load our data to build the optimization problem:

import json data = None with open("binance-data.json", "r") as jsonfile: data = json.load(jsonfile)

From the loaded data, we can store calculated returns, covariance, and costs of assets in respective variables. We will also set up the budget at 50%:

import numpy as np returns = data['mu'] covar = data['sigma'] assets = [] costs = [] for row in data['assets']: assets.append(row["Asset"]) costs.append(float(row["Open"])) # Half the money budget = np.sum(costs)/0.5

Next, let’s plot the bar chart for returns:

import seaborn as sns import matplotlib.pyplot as plt sns.barplot(y=returns, x = assets) plt.show()



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Enterprise LMS with Adobe Learning Manager by Damien Bruyndonckx(3556)
Building Data Science Solutions with Anaconda by Dan Meador(3469)
Simplify Big Data Analytics with Amazon EMR by Sakti Mishra(2692)
Building Modern CLI Applications in Go by Marian Montagnino(1431)
Getting Started with Forex Trading Using Python by Alex Krishtop(1371)
Simplify Big Data Analytics With Amazon EMR: A Beginner's Guide to Learning and Implementing Amazon EMR for Building Data Analytics Solutions by Sakti Mishra(1078)
Natural Language Processing Fundamentals by Sohom Ghosh(704)
Sebastian Raschka Python Machine Learning Unlock deeper insights into Machine Leaning with this vital guide to cutting-edge predictive analytics by Unknown(548)
+ Excel for Finance and Accounting: Learn how to optimize Excel formulas and functions for financial analysis by Suraj Kumar Lohani(517)
Mastering Data Analysis with Python: A Comprehensive Guide to NumPy, Pandas, and Matplotlib by Rajender Kumar(390)
Statistical Data Analysis Using SAS Intermediate Statistical Methods 2nd Edition by Unknown(362)
Fundamentals of Data Engineering by Joe Reis and Matt Housley(341)
Essential Guide to LLMOps by Ryan Doan;(323)
Data Wrangling Using Pandas, SQL, and Java by Oswald Campesato(309)
Hacking SaaS by Eric Mersch(252)
ChatGPT Millions: Ideas to Generate Your First Million Using ChatGPT and AI by Johnson Omar(234)
Microsoft PowerPoint - BATSA presentation D Crow - web.ppt by denslows(231)
MICROSOFT OFFICE 365 FOR BEGINNERS & ADVANCED USERS: THE MOST UPDATED USERG GUIDE TO LEARN MICROSOFT OFFICE 365 (WORD, EXCEL, POWERPOINT, & PUBLISHER) by GIBSON CRYSTAL(229)
Excel 2019 PivotTables: Easy Excel Essentials 2019 - Book 1 by M.L. Humphrey(214)
Confident Data Science: Discover The Essential Skills of Data Science by Adam Ross Nelson(207)