DEV Community

Cover image for #FOSS Fintech in Python: How To Use The Historical Command In The OpenBB Terminal!
Danglewood
Danglewood

Posted on

#FOSS Fintech in Python: How To Use The Historical Command In The OpenBB Terminal!

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: )
Enter fullscreen mode Exit fullscreen mode

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/
Enter fullscreen mode Exit fullscreen mode

Read the documentation here: https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/

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
Enter fullscreen mode Exit fullscreen mode

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  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode

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/<br>

Now we can take these tickers to the comparison analysis menu

ca
Enter fullscreen mode Exit fullscreen mode

The Comparison Analysis Menu (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/)

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
Enter fullscreen mode Exit fullscreen mode

historical -t h -n -s 2022-02-14 (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/comparison_analysis/historical/)

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

Discussion (0)