Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit f8b1d6d

Browse files
authored
Merge branch 'master' into update-pulse-software-documentation
2 parents 3e2a5f0 + 3e37ff9 commit f8b1d6d

21 files changed

Lines changed: 5753 additions & 4005 deletions

legacy_tutorials/aqua/finance/simulation/asian_barrier_spread_pricing.ipynb

Lines changed: 19 additions & 88 deletions
Large diffs are not rendered by default.

legacy_tutorials/aqua/finance/simulation/bull_spread_pricing.ipynb

Lines changed: 34 additions & 132 deletions
Large diffs are not rendered by default.

legacy_tutorials/aqua/finance/simulation/credit_risk_analysis.ipynb

Lines changed: 91 additions & 260 deletions
Large diffs are not rendered by default.

start_here.ipynb

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,42 @@
126126
"4. [Grover Optimizer](tutorials/optimization/4_grover_optimizer.ipynb) - Explore each component of the `GroverOptimizer`, which utilizes the techniques described in GAS, by minimizing a Quadratic Unconstrained Binary Optimization (QUBO) problem\n",
127127
"\n",
128128
"\n",
129-
"5. [ADMM Optimizer](tutorials/optimization/5_admm_optimizer.ipynb) - The ADMM Optimizer can solve classes of mixed-binary constrained optimization problems that often appear in logistic, finance, and operation research."
129+
"5. [ADMM Optimizer](tutorials/optimization/5_admm_optimizer.ipynb) - The ADMM Optimizer can solve classes of mixed-binary constrained optimization problems that often appear in logistic, finance, and operation research.\n",
130+
"\n",
131+
"\n",
132+
"## Finance\n",
133+
"\n",
134+
"1. [Portfolio Optimization](tutorials/finance/1_portfolio_optimization.ipynb) - How to build a portfolio optimization problem and solving it using VQE / QAOA.\n",
135+
"\n",
136+
"\n",
137+
"2. [Portfolio Diversification](tutorials/finance/2_portfolio_diversification.ipynb) - How to build a portfolio diversification problem and solving it using VQE / QAOA.\n",
138+
"\n",
139+
"\n",
140+
"3. [European Call Option Pricing](tutorials/finance/3_european_call_option_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price a European call option.\n",
141+
"\n",
142+
"\n",
143+
"4. [European Put Option Pricing](tutorials/finance/4_european_put_option_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price a European put option.\n",
144+
"\n",
145+
"\n",
146+
"5. [Bull Spread Pricing](tutorials/finance/5_bull_spread_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price a Bull Spread option.\n",
147+
"\n",
148+
"\n",
149+
"6. [Basket Option Pricing](tutorials/finance/6_basket_option_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price a Basket option.\n",
150+
"\n",
151+
"\n",
152+
"7. [Asian Barrier Spread Pricing](tutorials/finance/7_asian_barrier_spread_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price an Asian Barrier Spread option.\n",
153+
"\n",
154+
"\n",
155+
"8. [Fixed Income Pricing](tutorials/finance/8_fixed_income_pricing.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to price a portfolio of fixed income assets.\n",
156+
"\n",
157+
"\n",
158+
"9. [Credit Risk Analysis](tutorials/finance/9_credit_risk_analysis.ipynb) - How to model a quantum circuit that can be used with amplitude estimation to analyse the credit risk of a portfolio of assets that may default.\n",
159+
"\n",
160+
"\n",
161+
"10. [Option Pricing with qGANs](tutorials/finance/10_qgan_option_pricing.ipynb) - How to use a (trained) qGAN to load the uncertainty of a stock price together with amplitude estimation to price a European call option.\n",
162+
"\n",
163+
"\n",
164+
"11. [Loading and Processing Stock-Market Data](tutorials/finance/11_time_series.ipynb) - How to use data providers to generate a portfolio management model, e.g., for portfolio optimization or diversification."
130165
]
131166
},
132167
{
@@ -175,7 +210,7 @@
175210
"name": "python",
176211
"nbconvert_exporter": "python",
177212
"pygments_lexer": "ipython3",
178-
"version": "3.7.7"
213+
"version": "3.7.4"
179214
},
180215
"varInspector": {
181216
"cols": {

tutorials/finance/10_qgan_option_pricing.ipynb

Lines changed: 401 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/finance/11_time_series.ipynb

Lines changed: 583 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/finance/3_portfolio_optimization.ipynb renamed to tutorials/finance/1_portfolio_optimization.ipynb

Lines changed: 63 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@
66
"collapsed": true
77
},
88
"source": [
9-
"# _*Qiskit Finance: Portfolio Optimization*_ \n",
10-
"\n",
11-
"The latest version of this notebook is available on https://github.com/Qiskit/qiskit-tutorials.\n",
12-
"\n",
13-
"***\n",
14-
"## Contributors\n",
15-
"Stefan Woerner<sup>[1]</sup>, Daniel Egger<sup>[1]</sup>, Shaohan Hu<sup>[1]</sup>, Stephen Wood<sup>[1]</sup>, Marco Pistoia<sup>[1]</sup>\n",
16-
"### Affiliation\n",
17-
"- <sup>[1]</sup>IBMQ"
9+
"# _*Portfolio Optimization*_ \n"
1810
]
1911
},
2012
{
@@ -96,7 +88,7 @@
9688
},
9789
{
9890
"cell_type": "code",
99-
"execution_count": 3,
91+
"execution_count": 2,
10092
"metadata": {
10193
"ExecuteTime": {
10294
"end_time": "2020-07-13T20:35:15.224327Z",
@@ -120,7 +112,7 @@
120112
},
121113
{
122114
"cell_type": "code",
123-
"execution_count": 4,
115+
"execution_count": 3,
124116
"metadata": {
125117
"ExecuteTime": {
126118
"end_time": "2020-07-13T20:35:15.231767Z",
@@ -129,9 +121,9 @@
129121
},
130122
"outputs": [],
131123
"source": [
132-
"q = 0.5 # set risk factor\n",
133-
"budget = int(num_assets / 2) # set budget\n",
134-
"penalty = num_assets # set parameter to scale the budget penalty term\n",
124+
"q = 0.5 # set risk factor\n",
125+
"budget = num_assets // 2 # set budget\n",
126+
"penalty = num_assets # set parameter to scale the budget penalty term\n",
135127
"\n",
136128
"qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty)"
137129
]
@@ -145,7 +137,7 @@
145137
},
146138
{
147139
"cell_type": "code",
148-
"execution_count": 5,
140+
"execution_count": 4,
149141
"metadata": {
150142
"ExecuteTime": {
151143
"end_time": "2020-07-13T20:35:15.243604Z",
@@ -189,7 +181,7 @@
189181
},
190182
{
191183
"cell_type": "code",
192-
"execution_count": 6,
184+
"execution_count": 5,
193185
"metadata": {
194186
"ExecuteTime": {
195187
"end_time": "2020-07-13T20:35:15.264319Z",
@@ -201,26 +193,26 @@
201193
"name": "stdout",
202194
"output_type": "stream",
203195
"text": [
204-
"Optimal: selection [1 1 0 0], value -0.0125\n",
196+
"Optimal: selection [1 1 0 0], value 0.0019\n",
205197
"\n",
206198
"----------------- Full result ---------------------\n",
207199
"selection\tvalue\t\tprobability\n",
208200
"---------------------------------------------------\n",
209-
" [1 1 0 0]\t-0.0125\t\t1.0000\n",
210-
" [1 1 1 1]\t15.9925\t\t0.0000\n",
211-
" [0 1 1 1]\t4.0009\t\t0.0000\n",
212-
" [1 0 1 1]\t3.9968\t\t0.0000\n",
213-
" [0 0 1 1]\t0.0052\t\t0.0000\n",
214-
" [1 1 0 1]\t3.9903\t\t0.0000\n",
215-
" [0 1 0 1]\t-0.0014\t\t0.0000\n",
216-
" [1 0 0 1]\t-0.0054\t\t0.0000\n",
217-
" [0 0 0 1]\t4.0029\t\t0.0000\n",
218-
" [1 1 1 0]\t3.9899\t\t0.0000\n",
219-
" [0 1 1 0]\t-0.0020\t\t0.0000\n",
220-
" [1 0 1 0]\t-0.0057\t\t0.0000\n",
221-
" [0 0 1 0]\t4.0024\t\t0.0000\n",
222-
" [0 1 0 0]\t3.9955\t\t0.0000\n",
223-
" [1 0 0 0]\t3.9920\t\t0.0000\n",
201+
" [1 1 0 0]\t0.0019\t\t1.0000\n",
202+
" [1 1 1 1]\t16.0201\t\t0.0000\n",
203+
" [0 1 1 1]\t4.0196\t\t0.0000\n",
204+
" [1 0 1 1]\t4.0186\t\t0.0000\n",
205+
" [0 0 1 1]\t0.0182\t\t0.0000\n",
206+
" [1 1 0 1]\t4.0183\t\t0.0000\n",
207+
" [0 1 0 1]\t0.0178\t\t0.0000\n",
208+
" [1 0 0 1]\t0.0168\t\t0.0000\n",
209+
" [0 0 0 1]\t4.0164\t\t0.0000\n",
210+
" [1 1 1 0]\t4.0038\t\t0.0000\n",
211+
" [0 1 1 0]\t0.0033\t\t0.0000\n",
212+
" [1 0 1 0]\t0.0024\t\t0.0000\n",
213+
" [0 0 1 0]\t4.0019\t\t0.0000\n",
214+
" [0 1 0 0]\t4.0014\t\t0.0000\n",
215+
" [1 0 0 0]\t4.0004\t\t0.0000\n",
224216
" [0 0 0 0]\t16.0000\t\t0.0000\n"
225217
]
226218
}
@@ -244,7 +236,7 @@
244236
},
245237
{
246238
"cell_type": "code",
247-
"execution_count": 8,
239+
"execution_count": 6,
248240
"metadata": {
249241
"ExecuteTime": {
250242
"end_time": "2020-07-13T20:35:26.536878Z",
@@ -256,27 +248,27 @@
256248
"name": "stdout",
257249
"output_type": "stream",
258250
"text": [
259-
"Optimal: selection [0. 1. 0. 1.], value -0.0014\n",
251+
"Optimal: selection [0. 1. 1. 0.], value 0.0033\n",
260252
"\n",
261253
"----------------- Full result ---------------------\n",
262254
"selection\tvalue\t\tprobability\n",
263255
"---------------------------------------------------\n",
264-
" [0 1 0 1]\t-0.0014\t\t0.8753\n",
265-
" [1 0 0 1]\t-0.0054\t\t0.1214\n",
266-
" [1 0 1 0]\t-0.0057\t\t0.0019\n",
267-
" [0 1 1 0]\t-0.0020\t\t0.0008\n",
268-
" [0 0 1 1]\t0.0052\t\t0.0002\n",
269-
" [1 1 0 0]\t-0.0125\t\t0.0002\n",
270-
" [1 0 0 0]\t3.9920\t\t0.0001\n",
271-
" [1 1 1 0]\t3.9899\t\t0.0000\n",
272-
" [0 1 0 0]\t3.9955\t\t0.0000\n",
256+
" [0 1 1 0]\t0.0033\t\t0.9727\n",
257+
" [1 0 1 0]\t0.0024\t\t0.0216\n",
258+
" [0 1 0 1]\t0.0178\t\t0.0028\n",
259+
" [1 1 0 0]\t0.0019\t\t0.0016\n",
260+
" [0 0 1 1]\t0.0182\t\t0.0007\n",
261+
" [1 1 0 1]\t4.0183\t\t0.0005\n",
262+
" [1 0 0 1]\t0.0168\t\t0.0001\n",
263+
" [1 0 1 1]\t4.0186\t\t0.0000\n",
264+
" [1 1 1 1]\t16.0201\t\t0.0000\n",
265+
" [0 1 0 0]\t4.0014\t\t0.0000\n",
266+
" [1 0 0 0]\t4.0004\t\t0.0000\n",
267+
" [0 0 0 1]\t4.0164\t\t0.0000\n",
268+
" [0 0 1 0]\t4.0019\t\t0.0000\n",
269+
" [1 1 1 0]\t4.0038\t\t0.0000\n",
273270
" [0 0 0 0]\t16.0000\t\t0.0000\n",
274-
" [1 0 1 1]\t3.9968\t\t0.0000\n",
275-
" [0 1 1 1]\t4.0009\t\t0.0000\n",
276-
" [0 0 1 0]\t4.0024\t\t0.0000\n",
277-
" [1 1 1 1]\t15.9925\t\t0.0000\n",
278-
" [1 1 0 1]\t3.9903\t\t0.0000\n",
279-
" [0 0 0 1]\t4.0029\t\t0.0000\n"
271+
" [0 1 1 1]\t4.0196\t\t0.0000\n"
280272
]
281273
}
282274
],
@@ -308,7 +300,7 @@
308300
},
309301
{
310302
"cell_type": "code",
311-
"execution_count": 9,
303+
"execution_count": 7,
312304
"metadata": {
313305
"ExecuteTime": {
314306
"end_time": "2020-07-13T20:35:28.570970Z",
@@ -320,27 +312,27 @@
320312
"name": "stdout",
321313
"output_type": "stream",
322314
"text": [
323-
"Optimal: selection [0. 0. 1. 1.], value 0.0052\n",
315+
"Optimal: selection [1. 1. 0. 0.], value 0.0019\n",
324316
"\n",
325317
"----------------- Full result ---------------------\n",
326318
"selection\tvalue\t\tprobability\n",
327319
"---------------------------------------------------\n",
328-
" [0 0 1 1]\t0.0052\t\t0.1681\n",
329-
" [0 1 0 1]\t-0.0014\t\t0.1670\n",
330-
" [0 1 1 0]\t-0.0020\t\t0.1669\n",
331-
" [1 0 0 1]\t-0.0054\t\t0.1664\n",
332-
" [1 0 1 0]\t-0.0057\t\t0.1663\n",
333-
" [1 1 0 0]\t-0.0125\t\t0.1653\n",
334-
" [1 1 1 0]\t3.9899\t\t0.0000\n",
335-
" [0 0 0 1]\t4.0029\t\t0.0000\n",
336-
" [1 1 0 1]\t3.9903\t\t0.0000\n",
337-
" [0 0 1 0]\t4.0024\t\t0.0000\n",
338-
" [0 0 0 0]\t16.0000\t\t0.0000\n",
339-
" [1 1 1 1]\t15.9925\t\t0.0000\n",
340-
" [0 1 0 0]\t3.9955\t\t0.0000\n",
341-
" [1 0 1 1]\t3.9968\t\t0.0000\n",
342-
" [1 0 0 0]\t3.9920\t\t0.0000\n",
343-
" [0 1 1 1]\t4.0009\t\t0.0000\n"
320+
" [1 1 0 0]\t0.0019\t\t0.1674\n",
321+
" [1 0 1 0]\t0.0024\t\t0.1674\n",
322+
" [0 1 1 0]\t0.0033\t\t0.1673\n",
323+
" [1 0 0 1]\t0.0168\t\t0.1660\n",
324+
" [0 1 0 1]\t0.0178\t\t0.1659\n",
325+
" [0 0 1 1]\t0.0182\t\t0.1658\n",
326+
" [1 0 0 0]\t4.0004\t\t0.0000\n",
327+
" [0 1 1 1]\t4.0196\t\t0.0000\n",
328+
" [1 0 1 1]\t4.0186\t\t0.0000\n",
329+
" [0 1 0 0]\t4.0014\t\t0.0000\n",
330+
" [1 1 0 1]\t4.0183\t\t0.0000\n",
331+
" [0 0 1 0]\t4.0019\t\t0.0000\n",
332+
" [1 1 1 0]\t4.0038\t\t0.0000\n",
333+
" [0 0 0 1]\t4.0164\t\t0.0000\n",
334+
" [1 1 1 1]\t16.0201\t\t0.0000\n",
335+
" [0 0 0 0]\t16.0000\t\t0.0000\n"
344336
]
345337
}
346338
],
@@ -363,7 +355,7 @@
363355
},
364356
{
365357
"cell_type": "code",
366-
"execution_count": 10,
358+
"execution_count": 8,
367359
"metadata": {
368360
"ExecuteTime": {
369361
"end_time": "2020-07-13T20:35:29.079589Z",
@@ -374,8 +366,8 @@
374366
{
375367
"data": {
376368
"text/html": [
377-
"<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td>Qiskit</td><td>0.19.6</td></tr><tr><td>Terra</td><td>0.14.2</td></tr><tr><td>Aer</td><td>0.5.2</td></tr><tr><td>Ignis</td><td>0.3.3</td></tr><tr><td>Aqua</td><td>0.7.3</td></tr><tr><td>IBM Q Provider</td><td>0.7.2</td></tr><tr><th>System information</th></tr><tr><td>Python</td><td>3.7.7 (default, May 6 2020, 04:59:01) \n",
378-
"[Clang 4.0.1 (tags/RELEASE_401/final)]</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>4</td></tr><tr><td>Memory (Gb)</td><td>16.0</td></tr><tr><td colspan='2'>Mon Jul 13 16:35:29 2020 EDT</td></tr></table>"
369+
"<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td>Qiskit</td><td>0.19.1</td></tr><tr><td>Terra</td><td>0.14.1</td></tr><tr><td>Aer</td><td>0.5.1</td></tr><tr><td>Ignis</td><td>0.3.0</td></tr><tr><td>Aqua</td><td>0.7.0</td></tr><tr><td>IBM Q Provider</td><td>0.7.0</td></tr><tr><th>System information</th></tr><tr><td>Python</td><td>3.7.4 (default, Aug 13 2019, 15:17:50) \n",
370+
"[Clang 4.0.1 (tags/RELEASE_401/final)]</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>6</td></tr><tr><td>Memory (Gb)</td><td>16.0</td></tr><tr><td colspan='2'>Wed Jul 15 19:59:08 2020 CEST</td></tr></table>"
379371
],
380372
"text/plain": [
381373
"<IPython.core.display.HTML object>"
@@ -427,7 +419,7 @@
427419
"name": "python",
428420
"nbconvert_exporter": "python",
429421
"pygments_lexer": "ipython3",
430-
"version": "3.7.7"
422+
"version": "3.7.4"
431423
},
432424
"varInspector": {
433425
"cols": {

0 commit comments

Comments
 (0)