mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-15 05:41:49 +00:00
some changes...
This commit is contained in:
134
website/content/terminal/guides/advanced/data.md
vendored
134
website/content/terminal/guides/advanced/data.md
vendored
@@ -1,100 +1,108 @@
|
||||
---
|
||||
title: Importing and Exporting Data
|
||||
sidebar_position: 3
|
||||
description: The OpenBBUserData folder's default location is the home of the system user account. By default this will be the following paths. 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.
|
||||
keywords: [export, import, data, excel, xlsx, csv, json, png, pdf, jpg, openbbuserdata, where is data exported, market data, financial data, free, openbb terminal]
|
||||
description: The `OpenBBUserData` folder is where files are saved when they are created from within the OpenBB Terminal, like exports and generated reports. It is also where user-generated files are stored.
|
||||
keywords: [export, import, data, excel, xlsx, csv, json, png, pdf, jpg, openbbuserdata, terminal, user, data, presets, screener, portfolio, styles, themes]
|
||||
---
|
||||
|
||||
## 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:
|
||||
The `OpenBBUserData` folder is where files are saved when they are created from within the OpenBB Terminal, like exports and generated reports. It is also where user-generated files are stored, such as:
|
||||
|
||||
- Screener presets
|
||||
- Portfolio files
|
||||
- Exported files
|
||||
- Files to be imported by various functions
|
||||
- Styles and themes
|
||||
|
||||
The folder's location is at the root of user account for the operating system.
|
||||
|
||||
- Linux: `~/home/<YOUR_USERNAME>/OpenBBUserData`
|
||||
- macOS: `Macintosh HD/Users/<YOUR_USERNAME>/OpenBBUserData`
|
||||
- Windows: `C:/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:
|
||||
Most Terminal functions have the ability to export results as a file to the `OpenBBUserData` folder. This can be confirmed by engaging the help dialogue.
|
||||
|
||||
```console
|
||||
/stocks/load AAPL -s 2010-01-01 --export xlsx
|
||||
/economy/ycrv --help
|
||||
```
|
||||
|
||||
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`.
|
||||
|
||||
```console
|
||||
/stocks/load AAPL -s 2010-01-01 --export apple.csv
|
||||
usage: ycrv [-d DATE] [-h] [--export EXPORT] [--sheet-name SHEET_NAME [SHEET_NAME ...]] [--raw]
|
||||
|
||||
Generate country yield curve. The yield curve shows the bond rates at different maturities.
|
||||
|
||||
options:
|
||||
-d DATE, --date DATE Date to get data from FRED. If not supplied, the most recent entry will be used. (default: None)
|
||||
-h, --help show this help message (default: False)
|
||||
--export EXPORT Export raw data into csv, json, xlsx (default: )
|
||||
--sheet-name SHEET_NAME [SHEET_NAME ...]
|
||||
Name of excel sheet to save data to. Only valid for .xlsx files. (default: None)
|
||||
--raw Flag to display raw data (default: False)
|
||||
|
||||
For more information and examples, use 'about ycrv' to access the related guide.
|
||||
|
||||
```
|
||||
|
||||
Which results in the following:
|
||||
For exporting data from tables, the valid output types are:
|
||||
|
||||

|
||||
- CSV
|
||||
- JSON
|
||||
- XLSX
|
||||
|
||||
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:
|
||||
Images can be exported as:
|
||||
|
||||
- JPG
|
||||
- PDF
|
||||
- PNG
|
||||
- SVG
|
||||
|
||||
Deploying the `--export` flag can include just the file type:
|
||||
|
||||
```console
|
||||
/stocks/load AAPL -s 2010-01-01 --export apple.xlsx --sheet-name Market Data
|
||||
/stocks/ $ load aapl --export csv
|
||||
```
|
||||
|
||||
Then enter the `fa` (Fundamental Analysis) menu and type:
|
||||
|
||||
**Income Statement:**
|
||||
|
||||
```console
|
||||
income --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Income Statement
|
||||
Loading Daily data for AAPL with starting period 2020-02-13.
|
||||
Saved file: /Users/danglewood/OpenBBUserData/exports/20230217_204550_OpenBBTerminal_openbb_terminal_load_AAPL.csv
|
||||
```
|
||||
|
||||
**Balance Sheet:**
|
||||
```console
|
||||
balance --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Balance Sheet
|
||||
```
|
||||
|
||||
**Cash Flow Statement:**
|
||||
Or, the file can be named explicitly:
|
||||
|
||||
```console
|
||||
cash --source FinancialModelingPrep -l 10 --export apple.xlsx --sheet-name Cash Flow Statement
|
||||
/stocks/ $ load aapl --export aapl_daily.csv
|
||||
```
|
||||
|
||||
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.
|
||||
```console
|
||||
Loading Daily data for AAPL with starting period 2020-02-13.
|
||||
Saved file: /Users/danglewood/OpenBBUserData/exports/aapl_daily.csv
|
||||
```
|
||||
|
||||

|
||||
When `xlsx` is the file type, an additional argument for the sheet name is available. The purpose of this functionality is to export multiple items to the same spreadsheet; for example:
|
||||
|
||||
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.
|
||||
```console
|
||||
/stocks/load aapl --export watchlist.xlsx --sheet-name AAPL
|
||||
```
|
||||
|
||||

|
||||
```console
|
||||
Loading Daily data for AAPL with starting period 2020-02-13.
|
||||
Saved file: /Users/danglewood/OpenBBUserData/exports/watchlist.xlsx
|
||||
```
|
||||
|
||||
```console
|
||||
/stocks/load msft --export watchlist.xlsx --sheet-name MSFT
|
||||
```
|
||||
|
||||
```console
|
||||
Loading Daily data for MSFT with starting period 2020-02-13.
|
||||
Saved file: /Users/danglewood/OpenBBUserData/exports/watchlist.xlsx
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Importing Data
|
||||
|
||||
Menus, such as [Econometrics](https://docs.openbb.co/terminal/guides/intros/econometrics) or [Portfolio](https://docs.openbb.co/terminal/guides/intros/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.
|
||||
|
||||
## Alternative 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:
|
||||
|
||||
```console
|
||||
userdata --folder /path_to/OpenBBUserData
|
||||
```
|
||||
|
||||

|
||||
|
||||
Reference in New Issue
Block a user