Features

Knowledge search

Search and rerank VBT documentation and community knowledge, and use it to refactor Python code

Reranking

✅ 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.

Rerank search results using Cohere
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.

Source refactorer

✅ 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 ✏️

Complete a signal function
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

Quick search & chat

✅ 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.

Search VBT knowledge for a warning
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"

vbt.quick_search("UserWarning: Symbols have mismatching index")

SearchVBT

✅ 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.

Search VBT knowledge for a warning
env["GITHUB_TOKEN"] = "<YOUR_GITHUB_TOKEN>"
env["OPENAI_API_KEY"] = "<YOUR_API_KEY>"

vbt.search("How to run indicator expressions?")

Knowledge assets

✅ 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!

Gather all pages and messages that define signal_func_nb
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: 0

Copyright © 20212026 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.