OpenBB Terminal Routines With Simple Script Technology
In this one minute video, OpenBB Founder Didier Lopes, demonstrates an advanced routine. Continue reading to explore this unique technology and learn how to improve efficiency through workflow.
Routines are executed from the main menu using the command, exe. Help dialogue will be displayed for any function by attaching '-h' to the command string.
2022 Mar 27, 16:36 (✨) / $ exe -h usage: exe [-p PATH] [-i ROUTINE_ARGS] [-h] Execute automated routine script. optional arguments: -p PATH, --path PATH The path or .gst file to run. (default: ) -i ROUTINE_ARGS, --input ROUTINE_ARGS Select multiple inputs to be replaced in the routine and separated by commas. E.g. GME,AMC,BTC-USD (default: None) -h, --help show this help message (default: False)
The script files are located in a folder labeled routines, and have a filename extension of .GST. There is also a folder named scripts containing .GST files that test the functions of the terminal. It is recommended to store user-generated files in the routines folder.
Take a closer look at the contents of the file: example_with_inputs_saved.gst
Notice that the code within the script is merely a terminal command on each line where $ARGV is a variable for the desired ticker(s). The routines have the flexibility to be a specific or variable value for any number of tickers.
If you can operate the Terminal, you can build scripts!
The OpenBB Terminal can be launched to play a routine immediately. It's easy to make changes to the routine with any text editor. I have made modifications to example_with_inputs.gst to look like this:
stocks load $ARGV ta fib ../ca add $ARGV,$ARGV,$ARGV,$ARGV historical -n -s 2009-03-26 hcorr
It can be executed in this manner:
python terminal.py routines/example_with_inputs.gst --input VT,SPY,QQQ,BND,GSG
This generates an output from the terminal that looks like this:
2022 Mar 27, 18:37 (✨) /stocks/ $ load VT Loading Daily VT stock with starting period 2019-03-25 for analysis. Datetime: 2022 Mar 27 18:37 Timezone: America/New_York Currency: USD Market: CLOSED 2022 Mar 27, 18:37 (✨) /stocks/ $ ta 2022 Mar 27, 18:37 (✨) /stocks/ta/ $ fib Fibonacci retracement levels ┏━━━━━━━━━━━┳━━━━━━━━┓ ┃ Fib Level ┃ Price ┃ ┡━━━━━━━━━━━╇━━━━━━━━┩ │ 0.0% │ 108.14 │ ├───────────┼────────┤ │ 23.5% │ 95.06 │ ├───────────┼────────┤ │ 38.2% │ 86.88 │ ├───────────┼────────┤ │ 50.0% │ 80.31 │ ├───────────┼────────┤ │ 61.8% │ 73.74 │ ├───────────┼────────┤ │ 65.0% │ 71.96 │ ├───────────┼────────┤ │ 100.0% │ 52.48 │ └───────────┴────────┘ 2022 Mar 27, 18:37 (✨) /stocks/ $ ca 2022 Mar 27, 18:37 (✨) /stocks/ca/ $ add BND,SPY,QQQ,GSG [Custom] Similar Companies: SPY, QQQ, BND, GSG, VT 2022 Mar 27, 18:37 (✨) /stocks/ca/ $ historical -n -s 2009-03-26 2022 Mar 27, 18:37 (✨) /stocks/ca/ $ hcorr 2022 Mar 27, 18:37 (✨) /stocks/ca/ $
Three charts were created by the script:
Any function of the OpenBB Terminal can be automated, tables and images can be exported for any feature equipped with the '--export' flag. The possibilities are limitless here. Combine data exports with the data cache and import functionality of the economy and econometrics menu to unlock new, powerful, tools at the disposal of the open-source community.
Show us what your routine looks like!