Portfolio optimization on Dirac
Device: Dirac-1
Introduction
This approach seeks to identify a sub-portfolio of stocks that have superior risk-return profiles compared to the full portfolio. This identifies opportunities for an investor to simplify their investment strategy without sacrificing (and potentially enhancing) the risk-adjusted return. While the expected return on a portfolio is relatively straightforward to optimize by itself, optimizing against risk is more subtle when choosing a set of assets that individually have high returns. The reason that optimizing against risk is more challenging is because asset performances can be correlated. Intuitively, one can see that investing in two highly-correlated assets is more risky than if they are uncorrelated or even anti-correlated. If one of a highly correlated asset is performing poorly, the other in the pair is likely to do so as well. Thus, the variance of a portfolio with both assets can be significantly higher than it would be if they were uncorrelated. Minimizing the overall variance for the return of a portfolio therefore needs to take into account the covariance between the assets, making this a fundamentally quadratic problem, ideal for our Dirac-1 solver.
Importance
Investments need not only give a good return on average, but also need to balance the potential risks. This balance will depend on the goal of the investor. For example, someone investing their retirement fund is likely to favor modest returns with low risks because the consequences of major losses are severe. On the other hand, someone who is day-trading in the hopes of having more money for entertainment might be willing to take more risks. There are of course many other scenarios with other risk levels. In general, the portfolio optimization problem is viewed as being a multi-objective problem. The goal is to balance the objective of maximizing return with the objective of minimizing risk. Even with multiple objectives there is still a sense of optimality, a portfolio is said to be "efficient" or "Pareto optimal" if the only ways to decrease risk would be to also decrease return. Regardless of one's appetite for risk, it never makes sense to invest in a non-Pareto-Optimal portfolio, so our goal is to find those that are Pareto optimal and match the appetite for risk which is parameterized by a term in our description. It is worth noting that this tutorial is based on a relatively simplified but still commonly used model of portfolio optimization. Various efforts exist to take into account more complex structure in the distribution of expected returns, in particular the failure to capture extreme events.
Applications
Portfolios diversification is necessary to achieve satisfactory outcomes for investors, making the kind of portfolio optimization discussed here (and potentially more complex variants) highly important. In spite of its simplicity, the model of diversification presented here, often referred to as modern portfolio theory, is still used. Improvements of the models presented here comprise a subject known as post-modern portfolio theory. One improvement is to consider a quantity known as downside risk instead of variance. Downside risk only takes into account the risk of portfolio elements underperforming a goal, rather than their total variation. Since the goal of diversification is to protect from risk, this approach can yield better performance.
Methodology
Let K be the total number of available stocks to choose from (here ), that is the size of the stock pool. We want to choose a subset of () stocks such that the portfolio risk is minimized, while the portfolio expected return is maximized, that is
where is the daily returns of the portfolio over some period of time, and are the variance and expectation of daily returns, is a hyper-parameter, and are binary variables representing inclusion or exclusion of a stock. A large value means the focus of optimization is to increase return, whereas a small value indicates the reduction of risk is more important. As we can take both long and short positions on stocks, we assume that corresponds to long positions on stocks 1 to .
As we are choosing a subset of stocks, we also need the following constraint,
Assuming that the same amount is invested on each of the K' selected stocks, the portfolio daily return at time t over a time period denoted by m can be expanded as follows,
where is the daily return of stock i at time in time period . The expectation of portfolio daily return over time period can thus be expanded as,
and the variance portfolio daily return over time period m is expanded as,
where is the covariant function.
The problem then reduces to
where
To avoid an over-fit on the portfolio data, we can minimize the average of the cost function over overlapping time periods, that is . The problem becomes,
subject to,
Implementation
The above-mentioned approach was used to construct an optimal portfolio based on the constituents of the Nasdaq-100 index. The following constituents were used,
In [3]:
- import pandas as pd
- from IPython.display import display, HTML
- df = pd.read_csv("nasdaq100_stocks.csv")
- display(HTML(df[["Company", "Symbol"]].to_html()))
Out [ ]:
Company | Symbol | |
---|---|---|
0 | Microsoft Corp | MSFT |
1 | Apple Inc | AAPL |
2 | Amazon.com Inc | AMZN |
3 | Alphabet Inc | GOOG |
4 | Alphabet Inc | GOOGL |
5 | NVIDIA Corp | NVDA |
6 | Tesla Inc | TSLA |
7 | Meta Platforms Inc | META |
8 | PepsiCo Inc | PEP |
9 | Broadcom Inc | AVGO |
10 | Costco Wholesale Corp | COST |
11 | Cisco Systems Inc | CSCO |
12 | T-Mobile US Inc | TMUS |
13 | Adobe Inc | ADBE |
14 | Texas Instruments Inc | TXN |
15 | Comcast Corp | CMCSA |
16 | Honeywell International Inc | HON |
17 | Amgen Inc | AMGN |
18 | Netflix Inc | NFLX |
19 | QUALCOMM Inc | QCOM |
20 | Starbucks Corp | SBUX |
21 | Intel Corp | INTC |
22 | Intuit Inc | INTU |
23 | Gilead Sciences Inc | GILD |
24 | Advanced Micro Devices Inc | AMD |
25 | Automatic Data Processing Inc | ADP |
26 | Intuitive Surgical Inc | ISRG |
27 | Mondelez International Inc | MDLZ |
28 | Applied Materials Inc | AMAT |
29 | Analog Devices Inc | ADI |
30 | Regeneron Pharmaceuticals Inc | REGN |
31 | PayPal Holdings Inc | PYPL |
32 | Moderna Inc | MRNA |
33 | Booking Holdings Inc | BKNG |
34 | Vertex Pharmaceuticals Inc | VRTX |
35 | CSX Corp | CSX |
36 | Fiserv Inc | FISV |
37 | Lam Research Corp | LRCX |
38 | Activision Blizzard Inc | ATVI |
39 | Micron Technology Inc | MU |
40 | KLA Corp | KLAC |
41 | Monster Beverage Corp | MNST |
42 | O'Reilly Automotive Inc | ORLY |
43 | Keurig Dr Pepper Inc | KDP |
44 | ASML Holding NV | ASML |
45 | Synopsys Inc | SNPS |
46 | Kraft Heinz Co/The | KHC |
47 | Charter Communications Inc | CHTR |
48 | American Electric Power Co Inc | AEP |
49 | Marriott International Inc/MD | MAR |
50 | Palo Alto Networks Inc | PANW |
51 | Cintas Corp | CTAS |
52 | Cadence Design Systems Inc | CDNS |
53 | MercadoLibre Inc | MELI |
54 | Dexcom Inc | DXCM |
55 | Exelon Corp | EXC |
56 | Biogen Inc | BIIB |
57 | AstraZeneca PLC ADR | AZN |
58 | NXP Semiconductors NV | NXPI |
59 | Paychex Inc | PAYX |
60 | Enphase Energy Inc | ENPH |
61 | Autodesk Inc | ADSK |
62 | Pinduoduo Inc ADR | PDD |
63 | Ross Stores Inc | ROST |
64 | Fortinet Inc | FTNT |
65 | Microchip Technology Inc | MCHP |
66 | Xcel Energy Inc | XEL |
67 | Lululemon Athletica Inc | LULU |
68 | Airbnb Inc | ABNB |
69 | Workday Inc | WDAY |
70 | PACCAR Inc | PCAR |
71 | Walgreens Boots Alliance Inc | WBA |
72 | IDEXX Laboratories Inc | IDXX |
73 | Electronic Arts Inc | EA |
74 | Marvell Technology Inc | MRVL |
75 | Old Dominion Freight Line Inc | ODFL |
76 | GLOBALFOUNDRIES Inc | GFS |
77 | CoStar Group Inc | CSGP |
78 | Dollar Tree Inc | DLTR |
79 | Illumina Inc | ILMN |
80 | Baker Hughes Co | BKR |
81 | Copart Inc | CPRT |
82 | Constellation Energy Corp | CEG |
83 | Cognizant Technology Solutions Corp | CTSH |
84 | JD.com Inc ADR | JD |
85 | Fastenal Co | FAST |
86 | Verisk Analytics Inc | VRSK |
87 | Seagen Inc | SGEN |
88 | Crowdstrike Holdings Inc | CRWD |
89 | Diamondback Energy Inc | FANG |
90 | Sirius XM Holdings Inc | SIRI |
91 | eBay Inc | EBAY |
92 | Datadog Inc | DDOG |
93 | Warner Bros Discovery Inc | WBD |
94 | ANSYS Inc | ANSS |
95 | Atlassian Corp | TEAM |
96 | Rivian Automotive Inc | RIVN |
97 | Zoom Video Communications Inc | ZM |
98 | Zscaler Inc | ZS |
99 | Align Technology Inc | ALGN |
100 | Lucid Group Inc | LCID |
We got the historical prices of the constituent stocks, as well as those of Nasdaq-100 (NDX) and equal-weighted Nasdaq-100 (QQQE) using the Yahoo Finance Python library,
In [4]:
- # Import libs
- import os
- import pandas as pd
- import yfinance as yf
- # Define some parameters
- OUT_DIR = "data"
- DROP_STOCKS = []
- # Get the list of all existing stocks
- stocks = list(df["Symbol"].unique()) + ["NDX", "QQQE"]
- for stock in stocks:
- try:
- tmp_df = yf.Ticker(stock).history(
- period="max", interval="1d",
- )[["Close"]].rename(
- columns={
- "Close": stock,
- }
- )
- tmp_df["Date"] = tmp_df.index
- tmp_df.to_csv(
- os.path.join(OUT_DIR, "%s.csv" % stock),
- index=False,
- )
- except Exception as exc:
- print("Could not get price for %s" % stock)
- print(exc)
- DROP_STOCKS.append(stock)
- if tmp_df.shape[0] == 0:
- DROP_STOCKS.append(stock)
Out [ ]:
- ATVI: No data found, symbol may be delisted - SGEN: No data found, symbol may be delisted
Let us import some libraries and set some parameters,
In [5]:
- # Import libs
- import os
- import sys
- import time
- import datetime
- import json
- import warnings
- from functools import wraps
- import numpy as np
- import pandas as pd
- from qci_client import QciClient
- warnings.filterwarnings("ignore")
- ALPHA = 1.0 # The coefficient for penalty term (for linear constraint)
- N_SAMPLES = 20 # Number of solution samples
- XI = 5.0 # The xi variable as defined in Methodology
- K_PRIME = 30 # Number of selected stocks
- WINDOW_DAYS = 30 # Size of each sliding window in days
- WINDOW_OVERLAP_DAYS = 15 # Overlap between sliding windows in days
- IN_SAMPLE_DAYS = 180 # Size of the lookback period in days
- OUT_OF_SAMPLE_DAYS = 30 # Size of the horizon window in days
We now define a function that calculates daily returns of all constituent stocks,
In [6]:
- def get_stock_returns(stocks, min_date, max_date):
- min_date = pd.to_datetime(min_date)
- max_date = pd.to_datetime(max_date)
- return_df = None
- for stock in stocks:
- stock_df = pd.read_csv("data/%s.csv" % stock)
- #stock_df["Date"] = stock_df["Date"].astype("datetime64[ns]") # change to fix timezone issue
- stock_df["Date"] = pd.to_datetime([pd.Timestamp(timestamp).date() for timestamp in stock_df["Date"]])
- stock_df = stock_df.fillna(method="ffill").fillna(method="bfill")
- stock_df[stock] = stock_df[stock].pct_change()
- stock_df = stock_df.dropna()
- stock_df = stock_df[
- (stock_df["Date"] >= min_date) & (stock_df["Date"] <= max_date)
- ]
- if return_df is None:
- return_df = stock_df
- else:
- return_df = return_df.merge(stock_df, how="outer", on="Date",)
- return_df = return_df.fillna(method="ffill").fillna(method="bfill")
- return return_df
And a function that calculates the hamiltonian matrix,
In [7]:
- def get_hamiltonian(
- return_df, stocks, min_date, max_date,
- ):
- K = len(stocks)
- # Calculate P and Q
- Q = np.zeros(shape=(K, K), dtype="d")
- P = np.zeros(shape=(K, K), dtype="d")
- m = 0
- min_date = pd.to_datetime(min_date)
- max_date = pd.to_datetime(max_date)
- tmp_date = min_date
- while tmp_date <= max_date:
- tmp_min_date = tmp_date
- tmp_max_date = tmp_date + datetime.timedelta(days=WINDOW_DAYS)
- tmp_df = return_df[
- (return_df["Date"] >= tmp_min_date)
- & (return_df["Date"] <= tmp_max_date)
- ]
- r_list = []
- for i in range(K):
- r_list.append(np.array(tmp_df[stocks[i]]))
- Q += np.cov(r_list)
- for i in range(K):
- for j in range(K):
- P[i][j] += np.mean(r_list[i]) * np.mean(r_list[j])
- tmp_date += datetime.timedelta(
- days=WINDOW_DAYS - WINDOW_OVERLAP_DAYS,
- )
- m += 1
- fct = m
- if fct > 0:
- fct = 1.0 / fct
- P = fct * P
- Q = fct * Q
- # Calculate the Hamiltonian
- H = -P + XI * Q
- # make sure H is symmetric up to machine precision
- H = 0.5 * (H + H.transpose())
- return H
And, we define a function that yields an optimal portfolio given a hamiltonian ,
In [9]:
- def optimize_portfolio(H, stocks, curr_date):
- beg_time = time.time()
- K = len(stocks)
- assert H.shape[0] == K
- assert H.shape[1] == K
- # Generate the constraint
- cons_lhs = np.ones(shape=(K), dtype=np.float32)
- cons_rhs = np.array([-K_PRIME])
- constraints = np.hstack([cons_lhs, cons_rhs])
- # Create json objects
- objective_json = {
- "file_name": "objective_tutorial_eq_wt_port_opt.json",
- "file_config": {
- "objective": {"data": H, "num_variables": K},
- }
- }
- constraint_json = {
- "file_name": "constraints_tutorial_eq_wt_port_opt.json",
- "file_config": {
- "constraints": {
- "data": constraints,
- "num_variables": K,
- "num_constraints": 1,
- }
- }
- }
- job_json = {
- "job_name": "moodys_eqc1_equal_weights",
- "job_tags": ["moody_nasda100_eqc1_equal_weights",],
- "params": {
- "device_type": "csample", #"eqc1",
- "num_samples": N_SAMPLES,
- "alpha": ALPHA,
- },
- }
- # Solve the optimization problem
- token = "your_token"
- api_url = "https://api.qci-prod.com"
- qci = QciClient(api_token=token, url=api_url)
- response_json = qci.upload_file(file=objective_json)
- objective_file_id = response_json["file_id"]
- response_json = qci.upload_file(file=constraint_json)
- constraint_file_id = response_json["file_id"]
- job_params = {
- "device_type": "dirac-1",
- "alpha": ALPHA,
- "num_samples": N_SAMPLES,
- }
- job_json = qci.build_job_body(
- job_type="sample-constraint",
- job_params=job_params,
- constraints_file_id=constraint_file_id,
- objective_file_id=objective_file_id,
- job_name=f"tutorial_eqc1",
- job_tags=["tutorial_eqc1"],
- )
- print(job_json)
- job_response_json = qci.process_job(
- job_body=job_json
- )
- print(job_response_json)
- results = job_response_json["results"]
- energies = results["energies"]
- samples = results["solutions"]
- is_feasibles = results["feasibilities"]
- # The sample solutions are sorted by energy
- sol = None
- for i, item in enumerate(samples):
- sol = item
- is_feasible = is_feasibles[i]
- if is_feasible:
- break
- if not is_feasible:
- print("Solution is not feasible!")
- assert len(sol) == K, "Inconsistent solution size!"
- if sum(sol) != K_PRIME:
- print(
- "Expected to select %d stocks, but selected %d!"
- % (K_PRIME, sum(sol))
- )
- sel_stocks = []
- for i in range(K):
- if sol[i] > 0:
- sel_stocks.append(stocks[i])
- print(
- "In optimize_portfolio; done with checking constraints; %0.2f seconds!"
- % (time.time() - beg_time)
- )
- return sol, sel_stocks
Results
We can now test the approach over a period of time, for example, between 2020-01-15 to 2023-12-30. We define,
In [10]:
- def run(curr_date):
- print("Processing curr date:", curr_date)
- curr_date = pd.to_datetime(curr_date)
- min_ins_date = curr_date - datetime.timedelta(days=IN_SAMPLE_DAYS)
- max_ins_date = curr_date - datetime.timedelta(days=1)
- min_oos_date = curr_date
- max_oos_date = curr_date + datetime.timedelta(days=OUT_OF_SAMPLE_DAYS)
- df = pd.read_csv("nasdaq100_stocks.csv", low_memory=False)
- stocks = list(set(df["Symbol"]) - set(DROP_STOCKS))
- ins_return_df = get_stock_returns(stocks, min_ins_date, max_ins_date)
- oos_return_df = get_stock_returns(stocks, min_oos_date, max_oos_date)
- ins_return_df = ins_return_df.sort_values("Date")
- ins_return_df = ins_return_df.fillna(method="ffill").fillna(0)
- oos_return_df = oos_return_df.sort_values("Date")
- oos_return_df = oos_return_df.fillna(method="ffill").fillna(0)
- H = get_hamiltonian(ins_return_df, stocks, min_ins_date, max_ins_date)
- sol, sel_stocks = optimize_portfolio(H, stocks, curr_date)
- sel_stock_df = pd.DataFrame()
- sel_stock_df["Date"] = [curr_date] * len(sel_stocks)
- sel_stock_df["Stock"] = sel_stocks
- return sel_stock_df
We can then run a backtest,
In [11]:
- min_date = pd.to_datetime("2022-01-13")
- max_date = pd.to_datetime("2022-12-30")
- SEL_STOCK_OUT_FILE = "selected_stocks.csv"
- curr_date = min_date
- while curr_date < max_date:
- tmp_sel_stock_df = run(curr_date)
- if os.path.exists(SEL_STOCK_OUT_FILE):
- tmp_sel_stock_df.to_csv(
- SEL_STOCK_OUT_FILE, index=False, mode="a", header=False,
- )
- else:
- tmp_sel_stock_df.to_csv(
- SEL_STOCK_OUT_FILE, index=False,
- )
- curr_date += datetime.timedelta(days=OUT_OF_SAMPLE_DAYS + 1)
Out [ ]:
Processing curr date: 2022-01-13 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c2e2f98263204a36575fe', 'objective_file_id': '663c2e2f98263204a36575fc', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:00:16 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:00:16 - Job submitted: job_id='663c2e30d448b017e54f94d3' 2024-05-08 19:00:16 - QUEUED 2024-05-08 19:00:18 - RUNNING 2024-05-08 19:06:20 - COMPLETED 2024-05-08 19:06:23 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c2e30d448b017e54f94d3', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c2e2f98263204a36575fe', 'objective_file_id': '663c2e2f98263204a36575fc', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:00:16.175Z', 'queued_at_rfc3339nano': '2024-05-09T02:00:16.177Z', 'running_at_rfc3339nano': '2024-05-09T02:00:17.157Z', 'completed_at_rfc3339nano': '2024-05-09T02:06:19.26Z'}, 'job_result': {'file_id': '663c2f9b98263204a365760c', 'device_usage_s': 289}}, 'status': 'COMPLETED', 'results': {'counts': [1, 5, 3, 2, 3, 1, 2, 1, 1, 1], 'energies': [-899.8930419210621, -899.8929198507496, -899.8929198507496, -899.8927977804371, -899.8927977804371, -899.8926757101246, -899.8926757101246, -899.8926757101246, -899.8924315694996, -899.8919432882496], 'feasibilities': [True, True, True, True, True, True, True, True, True, True], 'objective_values': [0.10694210024122522, 0.10711688613375814, 0.10713816757050866, 0.10715433158390524, 0.10722590058230652, 0.10727914274376713, 0.10737808437841369, 0.10738215101439265, 0.10759349012139721, 0.1080272879179783], 'solutions': [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 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 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 404.23 seconds! Processing curr date: 2022-02-13 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c2fc798263204a3657610', 'objective_file_id': '663c2fc698263204a365760e', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:07:03 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:07:03 - Job submitted: job_id='663c2fc7d448b017e54f94d5' 2024-05-08 19:07:03 - QUEUED 2024-05-08 19:09:31 - RUNNING 2024-05-08 19:15:30 - COMPLETED 2024-05-08 19:15:33 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c2fc7d448b017e54f94d5', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c2fc798263204a3657610', 'objective_file_id': '663c2fc698263204a365760e', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:07:03.586Z', 'queued_at_rfc3339nano': '2024-05-09T02:07:03.587Z', 'running_at_rfc3339nano': '2024-05-09T02:09:31.682Z', 'completed_at_rfc3339nano': '2024-05-09T02:15:28.938Z'}, 'job_result': {'file_id': '663c31c098263204a3657620', 'device_usage_s': 289}}, 'status': 'COMPLETED', 'results': {'counts': [1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1], 'energies': [-899.8142022729097, -899.8142022729097, -899.8142022729097, -899.8142022729097, -899.8140802025972, -899.8139581322847, -899.8137139916597, -899.8137139916597, -899.8135919213472, -899.8135919213472, -899.8135919213472, -899.8133477807222, -899.8129815697847, -899.8126153588472, -899.8121270775972], 'feasibilities': [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True], 'objective_values': [0.18575788376372931, 0.18577369701798177, 0.18584034664480104, 0.1858414619654213, 0.18586864781128645, 0.1859958674393441, 0.1862380560364733, 0.18630508648825628, 0.18635666649934488, 0.18637383714788805, 0.18639694913966914, 0.18660693516442706, 0.18699109848206405, 0.1874137015211155, 0.18791293544574308], 'solutions': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 547.71 seconds! Processing curr date: 2022-03-16 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c31ed98263204a3657624', 'objective_file_id': '663c31ec98263204a3657622', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:16:13 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:16:13 - Job submitted: job_id='663c31edd448b017e54f94d7' 2024-05-08 19:16:13 - QUEUED 2024-05-08 19:18:43 - RUNNING 2024-05-08 19:24:46 - COMPLETED 2024-05-08 19:24:48 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c31edd448b017e54f94d7', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c31ed98263204a3657624', 'objective_file_id': '663c31ec98263204a3657622', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:16:13.54Z', 'queued_at_rfc3339nano': '2024-05-09T02:16:13.541Z', 'running_at_rfc3339nano': '2024-05-09T02:18:42.201Z', 'completed_at_rfc3339nano': '2024-05-09T02:24:44.626Z'}, 'job_result': {'file_id': '663c33ec98263204a3657634', 'device_usage_s': 290}}, 'status': 'COMPLETED', 'results': {'counts': [9, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'energies': [-899.7795925257781, -899.7794704554656, -899.7793483851531, -899.7792263148406, -899.7791042445281, -899.7791042445281, -899.7791042445281, -899.7788601039031, -899.7787380335906, -899.7783718226531, -899.7781276820281], 'feasibilities': [True, True, True, True, True, True, True, True, True, True, True], 'objective_values': [0.22038417108175065, 0.22050534780381642, 0.22068812899164647, 0.22073629780553047, 0.22085410560002844, 0.22087060789000373, 0.2209441019202913, 0.22114139951653097, 0.22128187550407075, 0.22169026435936345, 0.2218611331127795], 'solutions': [[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1,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folio; done with checking constraints; 552.33 seconds! Processing curr date: 2022-04-16 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c341898263204a3657638', 'objective_file_id': '663c341798263204a3657636', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:25:28 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:25:28 - Job submitted: job_id='663c3418d448b017e54f94d9' 2024-05-08 19:25:28 - QUEUED 2024-05-08 19:27:58 - RUNNING 2024-05-08 19:34:00 - COMPLETED 2024-05-08 19:34:03 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3418d448b017e54f94d9', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c341898263204a3657638', 'objective_file_id': '663c341798263204a3657636', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:25:28.74Z', 'queued_at_rfc3339nano': '2024-05-09T02:25:28.74Z', 'running_at_rfc3339nano': '2024-05-09T02:27:57.449Z', 'completed_at_rfc3339nano': '2024-05-09T02:33:59.371Z'}, 'job_result': {'file_id': '663c361798263204a365763c', 'device_usage_s': 288}}, 'status': 'COMPLETED', 'results': {'counts': [14, 2, 3, 1], 'energies': [-899.7645461102991, -899.7643019696741, -899.7640578290491, -899.7640578290491], 'feasibilities': [True, True, True, True], 'objective_values': [0.23549922321350378, 0.2357466216737999, 0.23590463775784443, 0.23598854569161704], 'solutions': [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,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0, 1, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 555.70 seconds! Processing curr date: 2022-05-17 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c364798263204a3657640', 'objective_file_id': '663c364698263204a365763e', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:34:47 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:34:47 - Job submitted: job_id='663c3647d448b017e54f94da' 2024-05-08 19:34:47 - QUEUED 2024-05-08 19:34:50 - RUNNING 2024-05-08 19:40:50 - COMPLETED 2024-05-08 19:40:52 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3647d448b017e54f94da', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c364798263204a3657640', 'objective_file_id': '663c364698263204a365763e', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:34:47.396Z', 'queued_at_rfc3339nano': '2024-05-09T02:34:47.397Z', 'running_at_rfc3339nano': '2024-05-09T02:34:47.656Z', 'completed_at_rfc3339nano': '2024-05-09T02:40:49.716Z'}, 'job_result': {'file_id': '663c37b198263204a3657642', 'device_usage_s': 288}}, 'status': 'COMPLETED', 'results': {'counts': [13, 2, 2, 1, 1, 1], 'energies': [-899.6566471402217, -899.6566471402217, -899.6560367886592, -899.6559147183467, -899.6555485074092, -899.6554264370967], 'feasibilities': [True, True, True, True, True, True], 'objective_values': [0.3433354284001967, 0.3434022979360825, 0.34393717423579084, 0.3441305781822098, 0.3444755036528773, 0.3445996855621417], 'solutions': [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1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 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 406.72 seconds! Processing curr date: 2022-06-17 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c37e098263204a3657646', 'objective_file_id': '663c37df98263204a3657644', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:41:36 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:41:37 - Job submitted: job_id='663c37e1d448b017e54f94db' 2024-05-08 19:41:37 - QUEUED 2024-05-08 19:41:39 - RUNNING 2024-05-08 19:47:39 - COMPLETED 2024-05-08 19:47:42 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c37e1d448b017e54f94db', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c37e098263204a3657646', 'objective_file_id': '663c37df98263204a3657644', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:41:37.12Z', 'queued_at_rfc3339nano': '2024-05-09T02:41:37.121Z', 'running_at_rfc3339nano': '2024-05-09T02:41:38.001Z', 'completed_at_rfc3339nano': '2024-05-09T02:47:39.955Z'}, 'job_result': {'file_id': '663c394b98263204a3657648', 'device_usage_s': 289}}, 'status': 'COMPLETED', 'results': {'counts': [15, 2, 1, 2], 'energies': [-899.5422470805225, -899.54066016646, -899.5402939555225, -899.539927744585], 'feasibilities': [True, True, True, True], 'objective_values': [0.45772844079634695, 0.45934757314383895, 0.4597307237517659, 0.46003288145735216], 'solutions': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 407.07 seconds! Processing curr date: 2022-07-18 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c397a98263204a365764c', 'objective_file_id': '663c397998263204a365764a', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:48:26 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:48:26 - Job submitted: job_id='663c397ad448b017e54f94dc' 2024-05-08 19:48:26 - QUEUED 2024-05-08 19:48:29 - RUNNING 2024-05-08 19:54:31 - COMPLETED 2024-05-08 19:54:34 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c397ad448b017e54f94dc', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c397a98263204a365764c', 'objective_file_id': '663c397998263204a365764a', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:48:26.817Z', 'queued_at_rfc3339nano': '2024-05-09T02:48:26.818Z', 'running_at_rfc3339nano': '2024-05-09T02:48:27.189Z', 'completed_at_rfc3339nano': '2024-05-09T02:54:29.438Z'}, 'job_result': {'file_id': '663c3ae598263204a365764e', 'device_usage_s': 290}}, 'status': 'COMPLETED', 'results': {'counts': [10, 4, 2, 2, 1, 1], 'energies': [-899.5207858788376, -899.5206638085251, -899.5200534569626, -899.5193210350876, -899.5182224022751, -899.5182224022751], 'feasibilities': [True, True, True, True, True, True], 'objective_values': [0.4792130044740021, 0.47938333898512087, 0.4799653098185577, 0.4806714981361283, 0.4817260375288466, 0.48179708239155056], 'solutions': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 409.02 seconds! Processing curr date: 2022-08-18 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3b1698263204a3657652', 'objective_file_id': '663c3b1598263204a3657650', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 19:55:18 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 19:55:18 - Job submitted: job_id='663c3b16d448b017e54f94dd' 2024-05-08 19:55:18 - QUEUED 2024-05-08 19:55:21 - RUNNING 2024-05-08 20:01:21 - COMPLETED 2024-05-08 20:01:24 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3b16d448b017e54f94dd', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3b1698263204a3657652', 'objective_file_id': '663c3b1598263204a3657650', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T02:55:18.634Z', 'queued_at_rfc3339nano': '2024-05-09T02:55:18.635Z', 'running_at_rfc3339nano': '2024-05-09T02:55:18.681Z', 'completed_at_rfc3339nano': '2024-05-09T03:01:20.579Z'}, 'job_result': {'file_id': '663c3c8098263204a3657654', 'device_usage_s': 286}}, 'status': 'COMPLETED', 'results': {'counts': [11, 3, 3, 1, 1, 1], 'energies': [-899.5335581859647, -899.5335581859647, -899.5320933422147, -899.5318492015897, -899.5316050609647, -899.5296519359647], 'feasibilities': [True, True, True, True, True, True], 'objective_values': [0.4664017664446538, 0.4664398583727227, 0.4678700803410983, 0.4681682380335351, 0.4683506506663085, 0.47035568899990987], 'solutions': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,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0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 407.51 seconds! Processing curr date: 2022-09-18 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3cb098263204a3657658', 'objective_file_id': '663c3cb098263204a3657656', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 20:02:08 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 20:02:08 - Job submitted: job_id='663c3cb0d448b017e54f94de' 2024-05-08 20:02:08 - QUEUED 2024-05-08 20:02:11 - RUNNING 2024-05-08 20:08:13 - COMPLETED 2024-05-08 20:08:16 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3cb0d448b017e54f94de', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3cb098263204a3657658', 'objective_file_id': '663c3cb098263204a3657656', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T03:02:08.963Z', 'queued_at_rfc3339nano': '2024-05-09T03:02:08.964Z', 'running_at_rfc3339nano': '2024-05-09T03:02:09.808Z', 'completed_at_rfc3339nano': '2024-05-09T03:08:11.82Z'}, 'job_result': {'file_id': '663c3e1b98263204a365765a', 'device_usage_s': 291}}, 'status': 'COMPLETED', 'results': {'counts': [8, 3, 4, 1, 2, 1, 1], 'energies': [-899.4227949154381, -899.4224287045006, -899.4221845638756, -899.4221845638756, -899.4215742123131, -899.4209638607506, -899.4196210873131], 'feasibilities': [True, True, True, True, True, True, True], 'objective_values': [0.5772660631608205, 0.5775858384986564, 0.5777806791406422, 0.577840727800031, 0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 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 408.86 seconds! Processing curr date: 2022-10-19 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3e4c98263204a365765e', 'objective_file_id': '663c3e4b98263204a365765c', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 20:09:00 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 20:09:00 - Job submitted: job_id='663c3e4cd448b017e54f94df' 2024-05-08 20:09:00 - QUEUED 2024-05-08 20:09:03 - RUNNING 2024-05-08 20:15:06 - COMPLETED 2024-05-08 20:15:08 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3e4cd448b017e54f94df', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3e4c98263204a365765e', 'objective_file_id': '663c3e4b98263204a365765c', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T03:09:00.567Z', 'queued_at_rfc3339nano': '2024-05-09T03:09:00.568Z', 'running_at_rfc3339nano': '2024-05-09T03:09:01.075Z', 'completed_at_rfc3339nano': '2024-05-09T03:15:04.053Z'}, 'job_result': {'file_id': '663c3fb898263204a3657660', 'device_usage_s': 293}}, 'status': 'COMPLETED', 'results': {'counts': [9, 5, 3, 1, 1, 1], 'energies': [-899.3300647028726, -899.3299426325601, -899.3296984919351, -899.3289660700601, -899.3288439997476, -899.3285998591226], 'feasibilities': [True, True, True, True, True, True], 'objective_values': [0.669911826241469, 0.6700147349052503, 0.6702868630702825, 0.671054026013198, 0.6711733120148201, 0.6714170867943335], 'solutions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, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 409.66 seconds! Processing curr date: 2022-11-19 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3fe898263204a3657664', 'objective_file_id': '663c3fe898263204a3657662', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 20:15:53 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 20:15:53 - Job submitted: job_id='663c3fe9d448b017e54f94e0' 2024-05-08 20:15:53 - QUEUED 2024-05-08 20:15:55 - RUNNING 2024-05-08 20:21:55 - COMPLETED 2024-05-08 20:21:58 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c3fe9d448b017e54f94e0', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c3fe898263204a3657664', 'objective_file_id': '663c3fe898263204a3657662', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T03:15:53.145Z', 'queued_at_rfc3339nano': '2024-05-09T03:15:53.148Z', 'running_at_rfc3339nano': '2024-05-09T03:15:53.307Z', 'completed_at_rfc3339nano': '2024-05-09T03:21:55.425Z'}, 'job_result': {'file_id': '663c415398263204a3657666', 'device_usage_s': 289}}, 'status': 'COMPLETED', 'results': {'counts': [11, 6, 1, 1, 1], 'energies': [-899.4116445060379, -899.4116445060379, -899.4116445060379, -899.4114003654129, -899.4088368888504], 'feasibilities': [True, True, True, True, True], 'objective_values': [0.5883300061157691, 0.5883418816354902, 0.5883747574303106, 0.5885856769640764, 0.5911926411056718], 'solutions': [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,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0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 407.19 seconds! Processing curr date: 2022-12-20 00:00:00 {'job_submission': {'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c418298263204a365766a', 'objective_file_id': '663c418298263204a3657668', 'alpha': 1.0}}, 'device_config': {'dirac-1': {'num_samples': 20}}, 'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1']}} 2024-05-08 20:22:43 - Dirac allocation balance = 0 s (unmetered) 2024-05-08 20:22:43 - Job submitted: job_id='663c4183d448b017e54f94e1' 2024-05-08 20:22:43 - QUEUED 2024-05-08 20:22:45 - RUNNING 2024-05-08 20:28:40 - COMPLETED 2024-05-08 20:28:43 - Dirac allocation balance = 0 s (unmetered) {'job_info': {'job_id': '663c4183d448b017e54f94e1', 'job_submission': {'job_name': 'tutorial_eqc1', 'job_tags': ['tutorial_eqc1'], 'problem_config': {'quadratic_linearly_constrained_binary_optimization': {'constraints_file_id': '663c418298263204a365766a', 'objective_file_id': '663c418298263204a3657668', 'alpha': 1, 'atol': 1e-10}}, 'device_config': {'dirac-1': {'num_samples': 20}}}, 'job_status': {'submitted_at_rfc3339nano': '2024-05-09T03:22:43.197Z', 'queued_at_rfc3339nano': '2024-05-09T03:22:43.198Z', 'running_at_rfc3339nano': '2024-05-09T03:22:43.679Z', 'completed_at_rfc3339nano': '2024-05-09T03:28:38.705Z'}, 'job_result': {'file_id': '663c42e698263204a365766c', 'device_usage_s': 289}}, 'status': 'COMPLETED', 'results': {'counts': [12, 3, 1, 2, 1, 1], 'energies': [-899.4937351811574, -899.4934910405324, -899.4930027592824, -899.4923924077199, -899.4917820561574, -899.4914158452199], 'feasibilities': [True, True, True, True, True, True], 'objective_values': [0.5062719196965939, 0.5065549005563347, 0.5070348082132301, 0.5076232649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, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1]]}} In optimize_portfolio; done with checking constraints; 401.66 seconds!
We can now calculate the optimal portfolio values over the period of time it was tested.
In [14]:
- # Import libs
- import sys
- import datetime
- import warnings
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- warnings.filterwarnings("ignore")
- # Set params
- INIT_PORT_VAL = 1000000.0
- OUT_OF_SAMPLE_DAYS = 30
- K_PRIME = 30
- XI = 5.0
- IND_SYMBOL_1 = "QQQE"
- IND_SYMBOL_2 = "NDX"
- SEL_STOCK_FILE = "selected_stocks.csv"
- INDEX_FILE_1 = "data/%s.csv" % IND_SYMBOL_1
- INDEX_FILE_2 = "data/%s.csv" % IND_SYMBOL_2
- MIN_DATE = pd.to_datetime("2022-01-01")
- MAX_DATE = pd.to_datetime("2022-12-31")
- # Read allocation file
- df = pd.read_csv(SEL_STOCK_FILE)
- #df["Date"] = df["Date"].astype("datetime64[ns]")
- df["Date"] = pd.to_datetime([pd.Timestamp(timestamp).date() for timestamp in df["Date"]])
- df = df[(df["Date"] >= MIN_DATE) & (df["Date"] <= MAX_DATE)]
- # Loop through dates and calculate port value
- beg_port_val = INIT_PORT_VAL
- df = df.sort_values("Date")
- adj_dates = sorted(df["Date"].unique())
- num_adj_dates = len(adj_dates)
- dates = None
- port_vals = None
- for i in range(num_adj_dates):
- print(
- "Processing adjustment date %s"
- % pd.to_datetime(adj_dates[i]).strftime("%Y-%m-%d")
- )
- beg_date = pd.to_datetime(adj_dates[i])
- if i < num_adj_dates - 1:
- end_date = pd.to_datetime(adj_dates[i + 1])
- else:
- end_date = beg_date + datetime.timedelta(days=OUT_OF_SAMPLE_DAYS)
- tmp_df = df[df["Date"] == beg_date]
- stocks = tmp_df["Stock"]
- stocks = list(set(stocks))
- stocks = list(set(stocks) - set(DROP_STOCKS) - {"FISV"})
- if end_date > pd.to_datetime("2023-10-20"):
- stocks = list(set(stocks) - {"ATVI"})
- all_dates = [beg_date]
- date0 = beg_date
- while date0 < end_date:
- date0 = date0 + datetime.timedelta(days=1)
- all_dates.append(date0)
- price_df = pd.DataFrame({"Date": all_dates})
- for stock in stocks:
- stock_df = pd.read_csv("data/%s.csv" % stock)
- #stock_df["Date"] = stock_df["Date"].astype("datetime64[ns]")
- stock_df["Date"] = pd.to_datetime([pd.Timestamp(timestamp).date() for timestamp in stock_df["Date"]])
- stock_df = stock_df[
- (stock_df["Date"] >= beg_date) & (stock_df["Date"] <= end_date)
- ]
- if price_df is None:
- price_df = stock_df
- else:
- price_df = price_df.merge(stock_df, on="Date", how="outer")
- price_df = price_df.fillna(method="ffill").fillna(method="bfill")
- price_df = price_df.sort_values("Date")
- tmp_dates = np.array(price_df["Date"])
- tmp_port_vals = np.zeros(shape=(price_df.shape[0]))
- assert price_df.shape[0] > 0
- for stock in stocks:
- prices = np.array(price_df[stock])
- beg_price = prices[0]
- stock_wt = 1.0 / len(stocks)
- if beg_price <= 0:
- print(stock)
- print(price_df[["Date", stock]])
- assert beg_price > 0, "Error in data for %s" % stock # this assertion was failing, when I comment it out we get all NaN values
- stock_count = stock_wt * beg_port_val / beg_price
- tmp_port_vals += stock_count * prices
- if dates is None:
- dates = tmp_dates
- else:
- dates = np.concatenate([dates, tmp_dates])
- if port_vals is None:
- port_vals = tmp_port_vals
- else:
- port_vals = np.concatenate([port_vals, tmp_port_vals])
- beg_port_val = port_vals[-1]
Out [ ]:
Processing adjustment date 2022-01-13 Processing adjustment date 2022-02-13 Processing adjustment date 2022-03-16 Processing adjustment date 2022-04-16 Processing adjustment date 2022-05-17 Processing adjustment date 2022-06-17 Processing adjustment date 2022-07-18 Processing adjustment date 2022-08-18 Processing adjustment date 2022-09-18 Processing adjustment date 2022-10-19 Processing adjustment date 2022-11-19 Processing adjustment date 2022-12-20
We can then plot the optimal portfolio values and compare them with those of Nasdaq-100 and equal-weighted Nasdaq-100 indexes.
In [15]:
- # note these are the results when the beg price assertion from the previous cell was commented, turn into all NaN values
- # Plot
- out_df = pd.DataFrame({"Date": dates, "Port_Val": port_vals})
- out_df["Date"] = out_df["Date"].astype("datetime64[ns]")
- ind_df_1 = pd.read_csv(INDEX_FILE_1)
- #ind_df_1["Date"] = ind_df_1["Date"].astype("datetime64[ns]")
- ind_df_1["Date"] = pd.to_datetime([pd.Timestamp(timestamp).date() for timestamp in ind_df_1["Date"]])
- min_date = out_df["Date"].min()
- max_date = out_df["Date"].max()
- ind_df_1 = ind_df_1[
- (ind_df_1["Date"] >= min_date) & (ind_df_1["Date"] <= max_date)
- ]
- ind_vals_1 = np.array(ind_df_1[IND_SYMBOL_1])
- fct = INIT_PORT_VAL / ind_vals_1[0]
- ind_vals_1 *= fct
- ind_df_2 = pd.read_csv(INDEX_FILE_2)
- #ind_df_2["Date"] = ind_df_2["Date"].astype("datetime64[ns]")
- ind_df_2["Date"] = pd.to_datetime([pd.Timestamp(timestamp).date() for timestamp in ind_df_2["Date"]])
- min_date = out_df["Date"].min()
- max_date = out_df["Date"].max()
- ind_df_2 = ind_df_2[
- (ind_df_2["Date"] >= min_date) & (ind_df_2["Date"] <= max_date)
- ]
- ind_vals_2 = np.array(ind_df_2[IND_SYMBOL_2])
- fct = INIT_PORT_VAL / ind_vals_2[0]
- ind_vals_2 *= fct
- plt.plot(
- out_df["Date"], out_df["Port_Val"],
- ind_df_1["Date"], ind_vals_1,
- ind_df_2["Date"], ind_vals_2,
- )
- plt.xlabel("Date")
- plt.ylabel("Portfolio Value")
- plt.legend(
- [
- "Equal weighted optimal portfolio",
- "Equal weighted Nasdaq 100",
- "Nasdaq 100",
- ]
- )
- plt.show()
Out [ ]:
<Figure size 640x480 with 1 Axes>
Conclusion
In this tutorial, we have examined a specific financial application of Dirac related to portfolio optimization. This problem has a naturally quadratic statement, since it relates to minimizing variance of a portfolio based on the covariance between stocks. There is also a natural constraint in the form of the size of the portfolio.
Like feature selection, QBoost, and dimensionality reduction, this tutorial is a variation on the theme of taking advantage of the correlation structure of an underlying data set. Such problems keep arising both because they have important applications, and because they are naturally expressed as QUBOs given the importance of two-body correlations. You may wish to explore other applications of Quadratic linearly constrained binary optimization. Of course you can also get started with your own problems.