Exporting & Importing Datasets
The OpenBB Terminal offers a variety of ways to export financial data. This can be through XLSX, CSV or JSON but also through PNG, JPG, PDF and SVG giving plenty of flexibility to export the data the way you desire.
The OpenBBUserData Folder
The OpenBBUserData
folder's default location is the home of the system user account. By default this will be the following paths:
- macOS:
Macintosh HD/Users/<YOUR_USERNAME>/OpenBBUserData
- Windows:
C:/Users/<YOUR_USERNAME>/OpenBBUserData
Within the folder you can find files that you have exported as well as files that you wish to import directly into the OpenBB Terminal. For example, this could be an orderbook which you can store in OpenBBUserData/portfolio/holdings
.
This folder contains all things user-created. For example:
- Screener presets
- Portfolio files
- Exported files
- Files to be imported by various functions
- Styles and themes
- Preferred data sources
Note: With a WSL-enabled Windows installation, this folder will be under the Linux partition
Exporting Files
Within many of the functionalities, we offer the capability to export to Excel (xlsx and csv) or JSON. This can be demonstrated with the --export
argument, e.g. if you wish to export to xlsx
you would add --export xlsx
.
For example, if you wish to download market data you can do so from the stocks menu with the following:
/stocks/load AAPL -s 2010-01-01 --export xlsx
This results in the following:
We also allow you to define a file name, for example for the same stock tickers, we can also add in the filename. This time, we export to csv
.
/stocks/load AAPL -s 2010-01-01 --export apple.csv
Which results in the following:
Lastly, when you select the xlsx
option, you can also specify the sheet name with --sheet-name
which allows multiple datasets to be send to the same Excel file. Using the same stock ticker, we can define the following. First, get market data from the stocks
menu:
/stocks/load AAPL -s 2010-01-01 --export apple.xlsx --sheet-name Market Data
Then enter the fa
(Fundamental Analysis) menu and copy and paste the code below. This requires an API key from FinancialModelingPrep which you can obtain for free. Please have a look here.
income --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Income Statement
balance --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Balance Sheet
cash --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Cash Flow Statement
This generates a file for Apple with market data from 2010-01-01 until now and income, balance and cash flow statements over the last 10 years as seen in the image below.
Next to that, we also allow exporting to images, this can be PNG, JPG, PDF and SVG. For example, using our portfolio
menu we can export the charts to any type of format which again can be found within the OpenBBUserData
folder.
Importing Data
Menus, such as Econometrics or Portfolio, allow the user to import their own dataset. Files available to import will be included with the selections made available by auto-complete. In the Econometrics menu, this is activated after pressing the space bar, load -f
The Econometrics menu looks into the exports
and custom_imports/econometrics
folder. For the Portfolio functionalities the portfolio
menu looks into the portfolio/holdings
folder whereas the portfolio/po
menu looks into the portfolio/allocation
and portfolio/optimization
folder for the load
and file
command respectively. Please make sure to read the relevant guides to understand how this works.
Custom Path for OpenBBUserData Folder
The location of this folder can be set by the user from the /settings menu. There should be no need to update paths in this menu unless the folders have been moved manually. If the location of the OpenBBUserData folder must be changed, it is best to move the entire existing folder to the new path. The path is then changed under the settings menu with:
userdata --folder "/complete_path_to/OpenBBUserData"