Features
Intelligence
Search knowledge, call functions, reason over sources, and build AI-assisted workflows
The first time you run most of these commands, it may take a while to prepare documents. However, most of the preparation steps are cached and stored, so future calls will be much faster and will not require repeating the process.
✅ After the initial document retrieval, VBT can now rerank results using a dedicated reranking model to surface the most relevant documents. Five providers are supported out of the box: Cohere, Jina, Voyage, Hugging Face cross-encoders (local), and any LLM via completions-based scoring.
env["COHERE_API_KEY"] = "<YOUR_COHERE_API_KEY>"
vbt.search(
"How to rebalance weekly?",
rerank=True,
reranker="cohere",
rerank_limit=20,
)Cookbook
Don't use OpenAI? Explore more configurations in the knowledge section of the Cookbook.
✅ VBT now supports function calling across all LLMs, allowing you to use the MCP server and define custom functions that the model can invoke, and all of this without any additional setup! This feature is particularly useful for complex queries, agentic workflows, and interactive applications where you want the model to perform specific tasks or calculations on your behalf.
env["OPENAI_API_KEY"] = "<YOUR_OPENAI_API_KEY>"
vbt.interact(
"How to backtest a weekly rebalancing strategy with vbt.PF.from_orders?",
tool_display_format="compact",
formatter="html",
)
✅ VBT now supports reasoning steps across all LLMs, allowing you to see how the model arrived at its conclusion. This is particularly useful for complex queries that require multiple steps to answer.
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_OPENAI_API_KEY>"
vbt.chat(
"How to backtest a weekly rebalancing strategy with vbt.PF.from_orders?",
reasoning=dict(effort="low", summary="auto"),
formatter="html"
)
✅ Use the source refactorer to automatically enhance any Python code, whether it is a full package, Python object, or raw string. If the source is larger than expected, it intelligently splits it into clean AST-based chunks, refactors each using an LLM, and merges them back into polished code. You can choose to return the result, update the source in place, or copy it to your clipboard. For full transparency, you can also preview the diff directly in your browser ✏️
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_OPENAI_API_KEY>"
source = """
@njit
def signal_func_nb(ctx, entries, exits):
is_entry = vbt.pf_nb.select_nb(ctx, entries)
is_exit = vbt.pf_nb.select_nb(ctx, exits)
# TODO: Enter only if no other asset is active
return is_entry, is_exit, False, False
"""
new_source = vbt.refactor_source(
source,
attach_knowledge=True,
model="gpt-5-mini",
reasoning=dict(effort="high"),
show_diff=True,
)
print(new_source)@njit
def signal_func_nb(ctx, entries, exits):
is_entry = vbt.pf_nb.select_nb(ctx, entries)
is_exit = vbt.pf_nb.select_nb(ctx, exits)
for col in range(ctx.from_col, ctx.to_col):
if col != ctx.col and ctx.last_position[col] != 0:
is_entry = False
break
return is_entry, is_exit, False, False
✅ In addition to embeddings, which require prior generation, VBT now supports BM25 for fast, fully offline lexical search. This is perfect for quickly finding something specific.
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
vbt.quick_search("UserWarning: Symbols have mismatching index")
✅ Similar to SearchVBT, ChatVBT takes search results and forwards them to an LLM for completion. This allows you to interact seamlessly with the entire VBT knowledge base, receiving detailed and context-aware responses.
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_OPENAI_API_KEY>"
vbt.chat("How to rebalance weekly?", formatter="html")
✅ Want to find specific information using natural language on the website or Discord? VBT provides a powerful smart search feature called SearchVBT. Enter your query and it will generate an HTML page with well-structured search results. Behind the scenes, SearchVBT uses a RAG pipeline to embed, rank, and retrieve only the most relevant documents from VBT, ensuring precise and efficient search results.
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_API_KEY>"
vbt.search("How to run indicator expressions?")
✅ Each VBT class offers methods to explore its features, including its API, associated documentation, Discord messages, and code examples. You can even interact with it directly via an LLM!
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_API_KEY>"
vbt.PortfolioOptimizer.find_assets().get("link")['https://members.vectorbt.pro/api/portfolio/pfopt/base/#vectorbtpro.portfolio.pfopt.base',
'https://members.vectorbt.pro/api/generic/analyzable/#vectorbtpro.generic.analyzable.Analyzable',
'https://members.vectorbt.pro/api/base/wrapping/#vectorbtpro.base.wrapping.Wrapping',
...
'https://members.vectorbt.pro/features/optimization/#riskfolio-lib',
'https://members.vectorbt.pro/features/optimization/#portfolio-optimization',
'https://members.vectorbt.pro/features/optimization/#pyportfolioopt',
...
'https://discord.com/channels/x/918629995415502888/1064943203071045753',
'https://discord.com/channels/x/918629995415502888/1067718833646874634',
'https://discord.com/channels/x/918629995415502888/1067718855734075403',
...]vbt.PortfolioOptimizer.chat("How to rebalance weekly?", formatter="html")
✅ Each release now includes valuable knowledge assets—JSON files containing private website content and the complete "vectorbt.pro" Discord history. These assets can be used with LLMs and services like Cursor. In addition, VBT offers a palette of classes for working with these assets, providing functions such as converting to Markdown and HTML files, browsing the website offline, performing targeted searches, interacting with LLMs, and much more!
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
pages_asset = vbt.PagesAsset.pull()
messages_asset = vbt.MessagesAsset.pull()
vbt_asset = pages_asset + messages_asset
code = vbt_asset.find_code("def signal_func_nb", return_type="item")
code.print_sample(seed=42) link: https://discord.com/channels/x/918630948248125512/1251081573147742298
block: https://discord.com/channels/x/918630948248125512/1251081573147742298
thread: https://discord.com/channels/x/918630948248125512/1250844139952541837
reference: https://discord.com/channels/x/918630948248125512/1250844139952541837
replies:
- https://discord.com/channels/x/918630948248125512/1251083513336299610
channel: support
timestamp: '2024-06-14 07:51:31'
author: '@polakowo'
content: Something like this
mentions:
- '@fei'
attachments:
- file_name: Screenshot_2024-06-13_at_20.29.45-B4517.png
content: |-
Here's the text extracted from the image:
```python
@njit
def signal_func_nb(ctx, entries, exits, wait):
is_entry = vbt.pf_nb.select_nb(ctx, entries)
if is_entry:
return True, False, False, False
is_exit = vbt.pf_nb.select_nb(ctx, exits)
if is_exit:
if vbt.pf_nb.in_position_nb(ctx):
last_order = vbt.pf_nb.get_last_order_nb(ctx)
if ctx.index[ctx.i] - ctx.index[last_order["idx"]] >= wait:
return False, True, False, False
return False, False, False, False
pf = vbt.PF.from_random_signals(
"BTC-USD",
n=100,
seed=42,
signal_func_nb=signal_func_nb,
signal_args=(
vbt.Rep("entries"),
vbt.Rep("exits"),
vbt.dt.to_ns(vbt.timedelta("1000 days"))
)
)
```
reactions: 0And many more...
⏩ Look forward to more killer features being added every release!
Copyright © 2021–2026 Oleg Polakow. All rights reserved.
Site content and documentation are provided for using and evaluating VectorBT PRO and for educational purposes. Any other use, including building or supporting competing products or services, requires prior written consent.






