#FOSS Fintech in Python: How To Use The Historical Command In The OpenBB Terminal!
Tags: tutorial, python, opensource, 100daysofcode
Published: 2022-04-09 18:42:18

If it's historical, it's hysterical! Get your lolz on with this blast-from-the-past command. 

historical: this command is used for comparison analysis of price history between two or more companies.
```
2022 Apr 09, 14:14 (🦋) / $ /stocks/ca/historical -h

2022 Apr 09, 14:14 (🦋) /stocks/ $ ca
2022 Apr 09, 14:14 (🦋) /stocks/ca/ $ historical -h
usage: historical [-t {o,h,l,c,a}] [-n] [-s START] [-h] [--export EXPORT]

Historical price comparison between similar companies.

optional arguments:
  -t {o,h,l,c,a}, --type {o,h,l,c,a}
                        Candle data to use: o-open, h-high, l-low, c-close, a-adjusted close. (default: a)
  -n, --normalize       Flag to normalize all prices on same 0-1 scale (default: False)
  -s START, --start START
                        The starting date (format YYYY-MM-DD) of the stock (default: 2021-04-08)
  -h, --help            show this help message (default: False)
  --export EXPORT       Export raw data into csv, json, xlsx and figure into png, jpg, pdf, svg (default: )
```

The screener is well suited for discovery and includes a path to the comparison analysis menu, where this command is found. The first step, from the stock screener, is to populate the terminal with some tickers.

```
/stocks/scr/set unusual_volume/
```
![Read the documentation here: https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5bomt4q1s8iq5klc64q1.png)

With a preset, like unusual_volume, the best results are obtained when the filters are applied to a logical category. We will use 'technical' here to rank the top five tickers with unusual volume, sorted by the trading volume of the current/last session.

```
technical -l 5 -s Volume
```

Prints a table:
```
2022 Apr 09, 13:41 (🦋) /stocks/scr/ $ technical -l 5 -s Volume
                                                       Finviz Screener                                                        
┏━━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┓
┃ Ticker ┃ Beta  ┃ ATR  ┃ SMA20 ┃ SMA50 ┃ SMA200 ┃ 52W High ┃ 52W Low ┃ RSI   ┃ Price ┃ Change ┃ from Open ┃ Gap   ┃ Volume  ┃
┡━━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━┩
│ MDVL   │ 0.94  │ 0.21 │ 0.97  │ 0.75  │ -0.41  │ -0.87    │ 1.49    │ 77.77 │ 1.96  │ 0.39   │ 0.05      │ 0.32  │ 193.7 M │
├────────┼───────┼──────┼───────┼───────┼────────┼──────────┼─────────┼───────┼───────┼────────┼───────────┼───────┼─────────┤
│ PHIO   │ 1.84  │ 0.18 │ 1.67  │ 1.72  │ 0.63   │ -0.18    │ 2.36    │ 90.36 │ 2.35  │ 1.59   │ 1.67      │ -0.03 │ 110.9 M │
├────────┼───────┼──────┼───────┼───────┼────────┼──────────┼─────────┼───────┼───────┼────────┼───────────┼───────┼─────────┤
│ SBFM   │ -2.34 │ 1.32 │ 0.75  │ 0.32  │ -0.62  │ -0.90    │ 2.99    │ 57.73 │ 6.03  │ -0.38  │ -0.20     │ -0.22 │ 90.1 M  │
├────────┼───────┼──────┼───────┼───────┼────────┼──────────┼─────────┼───────┼───────┼────────┼───────────┼───────┼─────────┤
│ ATER   │       │ 0.48 │ 0.75  │ 0.60  │ -0.26  │ -0.85    │ 1.22    │ 73.35 │ 4.67  │ 0.21   │ 0.02      │ 0.18  │ 85.8 M  │
├────────┼───────┼──────┼───────┼───────┼────────┼──────────┼─────────┼───────┼───────┼────────┼───────────┼───────┼─────────┤
│ TWTR   │ 0.80  │ 2.69 │ 0.16  │ 0.25  │ -0.11  │ -0.37    │ 0.48    │ 63.68 │ 46.23 │ -0.04  │ -0.02     │ -0.01 │ 83.1 M  │
└────────┴───────┴──────┴───────┴───────┴────────┴──────────┴─────────┴───────┴───────┴────────┴───────────┴───────┴─────────┘
```

We can now see that the cache has been loaded with five tickers. 
![Read the documentation here: https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zvtvl1c18goq6l2zo8f.png)

Now we can take these tickers to the comparison analysis menu
```
ca
```
![The Comparison Analysis Menu (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfyba41dxz61h2p6uq67.png)

Now using the daily command, historical, the chart below shows a normalized share price, targeting daily highs, and starting from Valentines' Day.
```
historical -t h -n -s 2022-02-14
```
![historical -t h -n -s 2022-02-14 (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s88q3osi9ur3inj74n3r.png)

This should help you get started using the historical command in the OpenBB Terminal. Feel free to stop by the community Discord Server and ask questions, or just say hello!

https://discord.com/invite/Up2QGbMKHY

https://openbb.co

https://twitter.com/openbb_finance