Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

#
Discovery

The arguments and optionally the description of any Python function or class can be displayed with phelp. For example, we can quickly determine which inputs, outputs, and parameters does the indicator's `run()` function accept.

Print the specification of the TA-Lib's ATR

    vbt.phelp(vbt.talib("atr").run)

Note

This is not the same as calling the Python's `help` command - it only works on functions.

The attributes of any Python object can be listed with pdir. This can become handy when trying to determine whether an object contains a specific attribute without having to search the API documentation.

Print the properties and methods of the Portfolio class

    vbt.pdir(vbt.PF)

Tip

We can even apply it on third-party objects such as packages!

Most VBT objects can be expanded and pretty-formatted to quickly unveil their contents with pprint. For example, it's a simple way to visually confirm whether the object has a correct shape and grouping.

Print the configuration of a Data instance

    vbt.pprint(data)

Most VBT objects can be connected to the API reference on the website and the source code on GitHub with open_api_ref. The function takes an actual VBT object, its name, or its absolute path inside the package. It can also take third-party objects; in this case, it will search for them with
DuckDuckGo and open the first link.

Various ways to open the online API reference

    vbt.open_api_ref(vbt.nb)  # (1)!
    vbt.open_api_ref(vbt.nb.rolling_mean_nb)  # (2)!
    vbt.open_api_ref(vbt.PF)  # (3)!
    vbt.open_api_ref(vbt.Data.run)  # (4)!
    vbt.open_api_ref(vbt.Data.features)  # (5)!
    vbt.open_api_ref(vbt.ADX.adx_crossed_above)  # (6)!
    vbt.open_api_ref(vbt.settings)  # (7)!
    vbt.open_api_ref(pf.get_sharpe_ratio)  # (8)!
    vbt.open_api_ref((pf, "sharpe_ratio"))  # (9)!
    vbt.open_api_ref(pd.DataFrame)  # (10)!
    vbt.open_api_ref("vbt.PF")  # (11)!
    vbt.open_api_ref("SizeType")  # (12)!
    vbt.open_api_ref("DataFrame", module="pandas")  # (13)!
    vbt.open_api_ref("numpy.char.find", resolve=False)  # (14)!

1. Module
2. Function
3. Class
4. Method
5. Property
6. Generated method or property
7. Instance
8. Method of an instance
9. Any attribute of an instance (you cannot use `pf.sharpe_ratio` here)
10. Third-party objects work too!
11. Shortcut
12. Find an object across the package
13. Find an object across a third-party package
14. Use the reference without checking its validity

Tip

To get the link without opening it, use get_api_ref, which takes the same arguments.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings