Update qa.md

This commit is contained in:
Jeroen Bouma
2023-02-15 09:44:51 +01:00
committed by GitHub
parent 841f0bfa75
commit 3e8585d22e

View File

@@ -12,14 +12,12 @@ The Quantitative Analysis menu is a common menu to three asset classes:
- <a href = "/terminal/guides/intros/forex/" target= "_blank" rel="noreferrer noopener">Forex</a>
- <a href = "/terminal/guides/intros/stocks/" target = "_blank" rel="noreferrer noopener">Stocks</a>
<img width="1110" alt="The Quantitative Analysis menu" src="https://user-images.githubusercontent.com/85772166/183483507-a4bef3e8-6603-46fb-a022-424f18af32d6.png"></img>
<img width="800" alt="image" src="https://user-images.githubusercontent.com/46355364/218976291-b31cf033-636d-4534-8327-062b8d573263.png">
### How to use
Enter the menu, through one of the asset classes listed above, by entering `qa` in the Terminal. The ticker that is loaded before entering the menu will determine the timeframe for the analysis. To alter it, use the `load` function and pick a new `--start` and `--end` for the observation window. The QA functions target a specified column of the data. By default, this is returns. Use the `pick` command to chose a new target column.
<img width="358" alt="Picking a new target column" src="https://user-images.githubusercontent.com/85772166/183483572-6127eaff-69d2-4d67-8e60-8d7756a043b0.png"></img>
The menu is divided into five categories of functions:
- Statistics
@@ -28,41 +26,73 @@ The menu is divided into five categories of functions:
- Risk
- Other
A summary of exportable statistics is displayed with the command, `summary`. The example here shows $APPL.
A summary of exportable statistics is displayed with the command, `summary`. The example here shows AAPL.
<img width="1109" alt="QA summary for Apple" src="https://user-images.githubusercontent.com/85772166/183483647-3414adae-c4de-4b1e-81a5-04a4d8a51e19.png"></img>
```
(🦋) /stocks/qa/ $ summary
A simple line chart for the target column as a time-series is called with the `line` command.
Summary Statistics
┏━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┓
┃ ┃ open ┃ high ┃ low ┃ close ┃ adjclose ┃ volume ┃ dividends ┃ stock splits ┃ returns ┃ logret ┃ logprice ┃
┡━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━┩
│ count │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │ 758.000 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ mean │ 131.385 │ 133.089 │ 129.757 │ 131.491 │ 131.491 │ 109761415.963 │ 0.003 │ 0.005 │ 0.001 │ 0.001 │ 4.849 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ std │ 29.088 │ 29.309 │ 28.833 │ 29.086 │ 29.086 │ 56077677.683 │ 0.027 │ 0.145 │ 0.023 │ 0.023 │ 0.258 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ min │ 55.908 │ 56.011 │ 52.116 │ 54.999 │ 54.999 │ 35195900.000 │ 0.000 │ 0.000 │ -0.129 │ -0.138 │ 4.007 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ 10% │ 79.502 │ 80.013 │ 79.051 │ 79.648 │ 79.648 │ 63139770.000 │ 0.000 │ 0.000 │ -0.026 │ -0.026 │ 4.378 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ 25% │ 118.253 │ 119.721 │ 116.983 │ 118.555 │ 118.555 │ 74846950.000 │ 0.000 │ 0.000 │ -0.011 │ -0.011 │ 4.775 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ 50% │ 136.551 │ 138.402 │ 134.433 │ 136.614 │ 136.614 │ 91962650.000 │ 0.000 │ 0.000 │ 0.001 │ 0.001 │ 4.917 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ 75% │ 149.976 │ 151.796 │ 148.598 │ 150.446 │ 150.446 │ 124897575.000 │ 0.000 │ 0.000 │ 0.014 │ 0.014 │ 5.014 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ 90% │ 166.432 │ 168.413 │ 164.183 │ 165.460 │ 165.460 │ 177115490.000 │ 0.000 │ 0.000 │ 0.026 │ 0.026 │ 5.109 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ max │ 181.299 │ 181.607 │ 177.815 │ 180.684 │ 180.684 │ 426510000.000 │ 0.230 │ 4.000 │ 0.120 │ 0.113 │ 5.197 │
├───────┼─────────┼─────────┼─────────┼─────────┼──────────┼──────────────────────┼───────────┼──────────────┼─────────┼─────────┼──────────┤
│ var │ 846.131 │ 858.993 │ 831.359 │ 845.978 │ 845.978 │ 3144705934370881.500 │ 0.001 │ 0.021 │ 0.001 │ 0.001 │ 0.067 │
└───────┴─────────┴─────────┴─────────┴─────────┴──────────┴──────────────────────┴───────────┴──────────────┴─────────┴─────────┴──────────┘
```
![Line chart of Apple highs over time](https://user-images.githubusercontent.com/85772166/183483733-043f9c21-c408-4526-8c39-16937a05d46a.png)
A simple line chart for the target column as a time-series is called with the `line` command, for example the `returns` column.
![Line Apple](https://user-images.githubusercontent.com/46355364/218976712-2d9c14ce-c89f-484d-81ca-a8f5d1ef6d7b.png)
Optional arguments to this command allows the user to draw and annotate on the chart.
```
2022 Aug 08, 12:14 /stocks/qa/ $ line -h usage: line [--log] [-d] [--ml ML]
[--ms MS] [-h] [--export EXPORT]
(🦋) /stocks/qa/ $ line -h
usage: line [--log] [--ml ML] [--ms MS] [-h] [--export EXPORT]
Show line plot of selected data or highlight specific datetimes.
options: --log Plot with y on log scale (default: False) --ml ML Draw vertical
line markers to highlight certain events (default: ) --ms MS Draw scatter
markers to highlight certain events (default: ) -h, --help show this help
message (default: False) --export EXPORT Export figure into png, jpg, pdf, svg
(default: )
optional arguments:
--log Plot with y on log scale (default: False)
--ml ML Draw vertical line markers to highlight certain events (default: )
--ms MS Draw scatter markers to highlight certain events (default: )
-h, --help show this help message (default: False)
--export EXPORT Export figure into png, jpg, pdf, svg (default: )
For more information and examples, use 'about line' to access the related guide.
(🦋) /stocks/qa/ $
2022 Aug 08, 12:20 /stocks/qa/ $ pick high
Compare the beta between the loaded asset and another, using the `-r` flag to
deviate from the defaulted comparison, $SPY.
2022 Aug 08, 12:34 /stocks/qa/ $ beta -r MSFT
Loading Daily MSFT stock with starting period 2019-08-05 for analysis.
(🦋) /stocks/qa/ $ beta -r MSFT
```
<img width="762" alt="Beta of $AAPL relative to $MSFT" src="https://user-images.githubusercontent.com/85772166/183483898-dac417a8-0afe-46d2-b8e9-e855e8752fc8.png"></img>
![Beta](https://user-images.githubusercontent.com/46355364/218977134-52b00eec-a7f5-4dc9-ba62-343d0b546d30.png)
Most outputs are equipped with an `--export` flag, allowing the user to save the tables as a CSV, JSON, or XLSX file. The exports can then be imported into other menus like <a href="/terminal/guides/intros/econometrics/" target="_blank" rel="noreferrer noopener"> Econometrics</a>. Additional information on each specific command is displayed by attaching `-h` to it.
@@ -71,13 +101,13 @@ Most outputs are equipped with an `--export` flag, allowing the user to save the
Box and Whisker plots for monthly and yearly scales:
```
2022 Aug 08, 12:47 /stocks/qa/ $ bw
(🦋) /stocks/qa/$ bw
```
![Monthly box and whisker plot for Apple](https://user-images.githubusercontent.com/85772166/183483965-a6c2d076-4896-47ec-a314-fc6a574ad8de.png)
```
2022 Aug 08, 12:47 /stocks/qa/ $ bw -y
(🦋) /stocks/qa/ $ bw -y
```
![Yearly box and whisker plot for Apple](https://user-images.githubusercontent.com/85772166/183484096-73eadd0c-1618-4e95-a27b-79e81cd6afad.png)
@@ -85,9 +115,9 @@ Box and Whisker plots for monthly and yearly scales:
Pick `logret` for rate of change to the returns of the asset:
```
2022 Aug 08, 12:47 /stocks/qa/ $ pick logret
(🦋) /stocks/qa/ $ pick logret
2022 Aug 08, 12:51 /stocks/qa/ $ bw -y
(🦋) /stocks/qa/ $ bw -y
```
![Yearly rate of change on returns from Apple](https://user-images.githubusercontent.com/85772166/183484172-5c001e9d-911c-44cd-848c-9ae5ec13dbc2.png)