[ad_1]
What’s the OpenBB Platform?
The OpenBB Platform is an open-source modular monetary evaluation ecosystem. It integrates with near 100 completely different knowledge sources from asset courses comparable to fairness, choices, crypto, foreign exchange, macro economic system, fastened earnings, various datasets, and extra.
Consider it as your open-source model of the Bloomberg Terminal.
Earlier than we dive in deeper, take notice that I’m the OpenBB Platform engineering crew lead and that I’ll do my greatest to verify this text isn’t biased.
Web site: https://openbb.co/products/platform
What are the OpenBB Platform essential options?
The principle OpenBB Platform options come from its structure which consists of the OpenBB Core and numerous Extensions, together with Suppliers and Toolkits. The Core facilitates the event of customized functions with streamlined knowledge supplier connections, whereas the Extensions provide categorized knowledge entry and enhanced functionalities.
This design ensures a versatile, light-weight platform that simply integrates into completely different environments, avoiding the complexity and dependency problems with its predecessor.
Thus, the principle options are these:
- light-weight
- modular
- helps a Python and Internet API interface
- gives knowledge standardization between suppliers
- simply extendable
- nice documentation
- free and open-sourced
- safe
What interfaces does the OpenBB Platform have?
The OpenBB Platform options two interfaces that are the Python and Internet API interface. The Python interface permits Python devs a seamless growing expertise with sturdy and extendable code, kind hinting, good documentation, and many others.
The Internet API permits any frontend to simply incorporate the obtainable endpoints of the OpenBB Platform and combine them into any programming language or framework of selection.
The one distinction you would possibly discover is that some endpoints shall be obtainable on the Python interface and never on the Internet API interface. It is because the Internet API interface requires all the pieces to be serializable.
There are solely a handful of econometrics endpoints that aren’t current on the Internet API interface and the econometrics package deal is an elective one.
The best way to get began with the OpenBB Platform?
To get began with the OpenBB Platform, you will want to put in it right into a contemporary atmosphere. Having an OpenBB Hub account is very advisable as a way to have all your API keys in a single place throughout all OpenBB merchandise.
For this text, I’ll be putting in solely the bottom suppliers and extensions in order that we will progressively decide what we want. You can even set up all the pieces that there’s by including the [all]
flag. The model of openbb
that I’ll be demoing on this article is openbb-4.1.2
.
Now, allow us to go over and create an OpenBB Hub account that we will log into from the OpenBB Platform and thus have our API keys acknowledged. For many who need to comply with alongside, suppliers comparable to CBOE and Yahoo Finance present knowledge and don’t require API keys.
To get our OpenBB Hub account prepared, navigate to the web site that’s discovered on the next URL: https://my.openbb.co/login
Then both select to register manually or log in along with your Google account or equal. Once you log in, you can be greeted by the touchdown web page of the Hub and be capable to see all the OpenBB merchandise.
Choose the OpenBB Terminal after which on the left facet of the display screen you will note the API Keys part. Please navigate there and add your API keys. For this text, I’ll solely be utilizing FMP, Polygon, FRED, Intrinio, and Benzinga as suppliers that require an API key.
Now, one last step that we will do is to create a PAT (Private Entry Token) that we will use to log into our OpenBB Hub from the Python interface. To create a PAT, click on on its title on the left facet of your display screen after which click on the “Generate” button with a most well-liked expiry date.
You’ll be offered along with your key and with the command that we need to run now to log in:
from openbb import obb
obb.account.login(pat="<YOUR_TOKEN>")
On first import, the extensions shall be constructing their Python static belongings which are used to offer Python improvement expertise. As soon as constructed, you should have all the pieces it’s good to get going.
The OpenBB Platform is comprised of a number of “menus” which are both utility ones or routers that function entry factors into completely different asset courses and their instructions. As a result of it’s modular, your obtainable instructions, routers, and put in extensions will look completely different relying on what you put in.
Here’s what the present core atmosphere appears to be like like:
OpenBB Platform v4.1.2
Utilities:
/account
/consumer
/system
/protection
Routers:
/crypto
/foreign money
/derivatives
/economic system
/fairness
/etf
/fixedincome
/index
/information
/regulators
Extensions:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
A full checklist of obtainable OpenBB Platform extensions might be discovered right here: https://my.openbb.co/app/platform/extensions
From the utilities, you possibly can entry your consumer by navigating to the namespace of the obb.consumer
. You’ll be able to management your account and log out
from the obb.account
namespace and think about your system settings from the obb.system
namespace.
Within the following headers, we shall be exploring among the issues that the OpenBB Platform has to supply and the aim shall be to get snug with utilizing it and exploring.
The best way to discover OpenBB Platform instructions?
There are a number of methods of exploring the OpenBB Platform instructions. You’ll be able to go to the documentation that’s discovered on the next URL and discover the reference part that can present you all of the menus and their instructions.
Every command can have documentation on easy methods to use it, what are the usual question parameters and what are the precise ones to every supplier that helps the command. The identical shall be proven for the command outputs.
These requirements are a product of the standardization framework, however extra about that later.
One other means of exploring the instructions is thru your Python interface. You’ll be able to merely do obb.
and your intelisense must be choosing up on what is obtainable. Then you possibly can go one layer deeper and do obb.fairness.
and see what’s there.
When you get to a specific command that you just wish to check out, you possibly can add a query mark at its finish to get its signature, the docstring of the command, and all the small print. For instance:
obb.fairness.worth.efficiency?
Value efficiency as a return, over completely different intervals.
Parameters
----------
image : str
Image to get knowledge for.
supplier : Elective[Literal['fmp']]
The supplier to make use of for the question, by default None.
If None, the supplier laid out in defaults is chosen or 'fmp' if there's
no default.
Returns
-------
OBBject
outcomes : Listing[PricePerformance]
Serializable outcomes.
supplier : Elective[Literal['fmp']]
Supplier title.
warnings : Elective[List[Warning_]]
Listing of warnings.
chart : Elective[Chart]
Chart object.
further: Dict[str, Any]
Additional data.
PricePerformance
----------------
one_day : Elective[float]
One-day return.
wtd : Elective[float]
Week up to now return.
one_week : Elective[float]
One-week return.
mtd : Elective[float]
Month up to now return.
one_month : Elective[float]
One-month return.
qtd : Elective[float]
Quarter up to now return.
three_month : Elective[float]
Three-month return.
six_month : Elective[float]
Six-month return.
ytd : Elective[float]
Yr up to now return.
one_year : Elective[float]
One-year return.
three_year : Elective[float]
Three-year return.
five_year : Elective[float]
5-year return.
ten_year : Elective[float]
Ten-year return.
max : Elective[float]
Return from the start of the time sequence.
image : Elective[str]
The ticker image. (supplier: fmp)
Instance
-------
>>> from openbb import obb
>>> obb.fairness.worth.efficiency(image="AAPL")
Right here you will note an in depth presentation of the command parameters at your disposal, the construction of the OBBject, and the outputs of the mannequin which you can anticipate. It’s also supplied with an instance that you should utilize.
What’s the OBBject?
The OBBject is the OpenBB end result object (therefore OBBject 😀 ) which is a standardized object that shall be returned on each name execution. It’s going to maintain your outcomes, warnings throughout the command execution, any further data, charts, or one thing that an OBBject extension would possibly add.
OBBject
outcomes : Listing[PricePerformance]
Serializable outcomes.
supplier : Elective[Literal['fmp']]
Supplier title.
warnings : Elective[List[Warning_]]
Listing of warnings.
chart : Elective[Chart]
Chart object.
further: Dict[str, Any]
Additional data.
The OBBject additionally comes with customized helpers that may current your knowledge in several methods comparable to to_df()
, to_dict()
, to_json()
, and many others.
How does the OpenBB Platform carry out standardization?
The OpenBB Platform performs standardization by using Pydantic v2 and commonplace knowledge fashions that outline the usual set of question parameters and ensuing output fields for a specific command.
The usual is outlined based mostly on the intersection of fields which are shared between two or extra suppliers that may gasoline the identical command. It’s also based mostly on the monetary information of the OpenBB crew.
These commonplace fashions guarantee which you can simply change out a supplier and examine apples to apples by simply altering the supplier question parameter. It’s going to additionally assure a set of fields which are anticipated to at all times be returned by any of the supported suppliers and a set of question parameters that can work for all of them.
Saying this, the OpenBB Platform will at all times can help you use any provider-specific question parameters, and all provider-specific fields that aren’t part of the usual are documented and returned too.
For example this, we will see what the usual question parameters for this command appear to be and the way they alter when SEC is the supplier:
We will additionally observe the distinction between the output of the identical command and when the supplier is Intrinio:
This can be a very highly effective characteristic and it’ll permit for seamless switching between completely different knowledge suppliers and also you received’t want to fret about completely different API conventions, naming, libraries, and many others.
The best way to get inventory knowledge with the OpenBB Platform?
To get inventory knowledge with the OpenBB Platform, you will want to entry the fairness router below which you’ll find the info for that sector. It’s going to encompass instructions and/or sub-routers which you can entry. To view what is obtainable we will do:
/fairness
/calendar
/examine
/discovery
/estimates
/basic
market_snapshots
/possession
/worth
profile
screener
search
/shorts
Now, allow us to get historic worth knowledge by navigating to the worth
sub-router and utilizing the historic
command.
obb.fairness.worth.historic("LUV")
OBBject
id: 065abf67-8e3b-71af-8000-3b73cf8eb7f7
outcomes: [{'date': datetime.datetime(2024, 1, 19, 0, 0), 'open': 30.14, 'high': 30....
provider: fmp
warnings: None
chart: None
extra: {'metadata': {'arguments': {'provider_choices': {'provider': None}, 'standar...
Here you will see the OBBject with your results and other information. To get this data as a dataframe we can write it as:
obb.equity.price.historical("LUV").to_df().head()
You can now easily change the default provider which is FMP to another one such as Intrinio:
obb.equity.price.historical("LUV", provider="intrinio").to_df().head()
You can install matplotlib, plotly, or any preferred charting library to create charts. The OpenBB Platform also features a charting extension that can do this. It is currently in the reworks so I won’t be demoing it here.
How to get fundamental data with the OpenBB Platform?
To get fundamental data with the OpenBB Platform, you can visit the equity.fundamental
router and get fundamental data such as balance sheets, cash flow statements, income statements, and more.
/equity/fundamental
balance
balance_growth
cash
cash_growth
dividends
employee_count
filings
historical_attributes
historical_eps
historical_splits
income
income_growth
latest_attributes
management
management_compensation
metrics
multiples
overview
ratios
reported_financials
revenue_per_geography
revenue_per_segment
search_attributes
trailing_dividend_yield
transcript
Now, we will get the revenue per geography and the annual cash flow statement:
obb.equity.fundamental.revenue_per_geography("LUV").to_df()
period_ending fiscal_period fiscal_year filing_date geographic_segment
0 2018-12-31 FY 2018 2019-02-05 {'Latin America': 566000000, 'North America': ...
1 2019-12-31 FY 2019 2020-02-04 {'Latin America': 615000000, 'North America': ...
2 2020-12-31 FY 2020 2021-02-08 {'Latin America': 184000000, 'North America': ...
3 2021-12-31 FY 2021 2022-02-07 {'Latin America': 475000000, 'North America': ...
4 2022-12-31 FY 2022 2023-02-07 {'Latin America': 811000000, 'North America': ...
obb.equity.fundamental.cash("LUV", provider="intrinio").to_df().transpose()
How to get ETF data with the OpenBB Platform?
To get ETF data with the OpenBB Platform, we can utilize the obb.etf
router and the commands within it. For example, the ETF data router has access to the following commands:
/etf
countries
holdings
holdings_date
holdings_performance
info
price_performance
search
sectors
Let us obtain the price performance of SPY and QQ:
obb.etf.price_performance(["SPY", "QQQ"]).to_df().transpose()
0 1
one_day 0.012466 0.019831
one_week 0.015087 0.03152
one_month 0.030261 0.044904
three_month 0.145398 0.187761
six_month 0.066898 0.1179
ytd 0.020692 0.046176
one_year 0.218627 0.489953
three_year 0.256688 0.300862
five_year 0.835312 1.60084
ten_year 1.61934 3.756409
max 9.97929 7.248727
image SPY QQQ
Now, allow us to additionally see the burden of an ETF throughout completely different sectors:
obb.etf.sectors("QQQ").to_df()
sector weight
0 Money 0.000496
1 Business Providers 0.005482
2 Communications 0.014800
3 Shopper Durables 0.030500
4 Shopper Non-Durables 0.039200
5 Shopper Providers 0.054000
6 Distribution Providers 0.003061
7 Digital Know-how 0.294000
8 Vitality Minerals 0.002089
9 Well being Know-how 0.069300
10 Industrial Providers 0.002386
11 Producer Manufacturing 0.023200
12 Retail Commerce 0.104600
13 Know-how Providers 0.334200
14 Transportation 0.011600
15 Utilities 0.011200
The best way to carry out quantitative evaluation with the OpenBB Platform?
To carry out quantitative evaluation with the OpenBB Platform, you will want to be sure that the openbb-quantitative
library is put in. By having it put in, you’ll unlock a brand new pathway which is the obb.quantitative
router and its endpoints.
Allow us to set up it by working:
pip set up openbb-quantitative
After putting in it, be sure to restart the pocket book and import once more obb in order that it builds the Python static belongings for the added extension.
/quantitative
capm
kurtosis
normality
omega_ratio
quantile
sharpe_ratio
skewness
sortino_ratio
abstract
unitroot_test
Now, allow us to run a normality take a look at on the adjusted shut knowledge:
luv_historical = obb.fairness.worth.historic("LUV").to_df()
obb.quantitative.normality(knowledge=luv_historical, goal="adj_close").to_df()
0 kurtosis statistic=-1.980922466143507 p_value=0.0475999...
1 skewness statistic=-0.7194281764567769 p_value=0.471877...
2 jarque_bera statistic=3.0962272128471486 p_value=0.2126487...
3 shapiro_wilk statistic=0.98307204246521 p_value=0.004416265...
4 kolmogorov_smirnov statistic=1.0 p_value=0.0
The best way to carry out technical evaluation with the OpenBB Platform?
To carry out technical evaluation with the OpenBB Platform, you will want to be sure that the openbb-technical
library is put in. By having it put in, you’ll unlock a brand new pathway which is the obb.technical
router and its endpoints.
Allow us to set up it by working:
pip set up openbb-technical
Everytime you add a brand new extension, you will want to restart and re-import the library so it will get picked up accordingly. Allow us to see what we’ve got unlocked:
/technical
advert
adosc
adx
aroon
atr
bbands
cci
cg
clenow
cones
demark
donchian
ema
fib
fisher
hma
ichimoku
kc
macd
obv
rsi
sma
stoch
vwap
wma
zlma
Now, I’ll calculate the size of 14 RSI on the adjusted closing costs:
obb.technical.rsi(knowledge=luv_historical, goal="adj_close").to_df().tail(10)[
"adj_close_RSI_14"
]
241 57.444245
242 57.199409
243 58.470221
244 60.907707
245 61.714351
246 50.706565
247 51.800099
248 47.213098
249 59.399720
250 59.093636
The best way to carry out econometrics evaluation with the OpenBB Platform?
To carry out econometrics evaluation with the OpenBB Platform, you will want to put in the openbb.econometrics
extension that can unlock the obb.econometrics
router for utilization.
Allow us to set up it by working:
pip set up openbb-econometrics
After restarting and re-importing obb
, we will now begin utilizing the next set of features:
/econometrics
autocorrelation
causality
cointegration
correlation_matrix
ols_regression
ols_regression_summary
panel_between
panel_first_difference
panel_fixed
panel_fmac
panel_pooled
panel_random_effects
residual_autocorrelation
unit_root
Now, we will do an autocorrelation take a look at for the adjusted shut column:
obb.econometrics.correlation_matrix(
knowledge=luv_historical,
).to_df()
We will additionally do an OLS Regression which can return a statsmodel object:
obb.econometrics.ols_regression(
knowledge=luv_historical,
y_column="adj_close",
x_columns=["high", "low", "open"],
).outcomes["results"].abstract()
[ad_2]
Source link