AI Quant Trading for Beginners: Building Your First Algorithm with Google’s Tools and Jesse

AI Quant Trading for Beginners: Building Your First Algorithm with Google’s Tools and Jesse

Welcome to the world of algorithmic trading. If you have ever looked at a price chart and thought, "I could automate this," but stopped because the coding barrier felt too high, this guide is for you. We are currently in a golden era of development where advanced AI tools have democratized access to quantitative finance. You no longer need to be a senior Python engineer to build, test, and deploy profitable strategies.

Welcome to the world of algorithmic trading. If you have ever looked at a price chart and thought, “I could automate this,” but stopped because the coding barrier felt too high, this guide is for you. We are currently in a golden era of development where advanced AI tools have democratized access to quantitative finance. You no longer need to be a senior Python engineer to build, test, and deploy profitable strategies.

This post will walk you, step by step, through setting up a professional-grade trading environment. We will combine the robustness of the Jesse Trading Framework with the cutting-edge intelligence of modern AI agents like Google’s Antigravity and Jan.ai. By the end of this guide, you will have a working system capable of researching, writing, and testing its own trading logic.

Step 1: Setting Up the Jesse Trading Framework

Before we touch the AI, we need an engine. The AI is the architect, but it needs a construction crew to actually build and run the strategy. For this, we use the Jesse Framework (often referred to as the JC framework). Jesse is an advanced crypto trading framework written in Python that handles all the heavy lifting—data importing, backtesting, and live trading—so you don’t have to build these complex systems from scratch.

Installation To get started, you will need Python installed on your machine. We recommend using a virtual environment manager like Conda to keep your installation clean.

  1. Install Python: Ensure you have a compatible version of Python installed (usually 3.9+).
  2. Install Jesse: Open your terminal and run the pip command found in the Jesse documentation. Typically, this is pip install jesse.
  3. Initialize a Project: Once installed, navigate to the folder where you want your bots to live and run jesse make-project my-bot. This creates the file structure you will need.

Launching the Dashboard One of Jesse’s strongest features is its graphical dashboard. You do not need to stare at a command line to see your results. Inside your project folder, type: jesse run This command starts the local server. Open your web browser and navigate to the local URL provided (usually http://localhost:9000). If prompted for a password, the default is test. This dashboard is your Mission Control. It is where you will eventually see your equity curves, win rates, and drawdowns.

Step 2: Choosing Your AI Co-Pilot

Now that the engine is ready, you need a brain to drive it. You have two primary paths depending on your budget and privacy preferences: the cutting-edge “Agentic” path or the private, open-source path.

Option A: The Agentic Powerhouse (Google Antigravity) For those who want the most advanced experience, Google’s new Antigravity IDE (Integrated Development Environment) is the top choice. Unlike a standard chatbot that just outputs text, Antigravity is an “agentic” tool. This means it can take actions on your behalf, such as editing files directly, running terminal commands, and even controlling a web browser to look up documentation.

  • Access: You can access the tool via the Google Developer platform (often associated with Project IDX or the new Gemini 3 integrations).
  • Setup: Once inside, select the Gemini 3 Pro model. This model has high reasoning capabilities essential for coding.
  • Tip: You can toggle the intelligence settings. Use “low intelligence” (faster) for simple code tweaks and “high intelligence” (slower, more thoughtful) for complex strategy logic.

Option B: The Open-Source Privacy Route (Jan.ai) If you prefer to keep your data local or want to use specific models like Claude or GPT-4o without a subscription to their specific apps, Jan.ai is a fantastic free alternative.

  • Download: Get the application from Jan.ai.
  • Configuration: Jan allows you to run local models (via Ollama) which run entirely on your computer’s hardware. However, for coding, cloud models are often superior. You can connect Jan to OpenRouter, a service that lets you pay-per-use for top-tier models like Claude 3.5 Sonnet or GPT-4o. This often ends up being cheaper than a monthly subscription if you are not coding 24/7.

Step 3: The Secret Sauce (Custom Instructions)

This is the most critical step that beginners often miss. If you simply ask an AI to “write a trading bot,” it will likely hallucinate code that looks correct but fails to run in Jesse. You must “ground” the AI in the specific syntax of the Jesse framework.

To do this, we use a context file, often named instructions.mmd. This file contains a condensed version of the Jesse documentation, teaching the AI exactly how to define entry rules, exit rules, and indicators.

  1. Get the Instructions: You can find these instructions in the community repositories, specifically the Jesse-AI GPT Instructions repo.
  2. Injecting Context in Antigravity: Create a new file in your project named agents.md. Paste the entire content of the instructions file here. Antigravity will automatically reference this file when you ask it questions about your code.
  3. Injecting Context in Jan.ai: Start a new chat thread. Copy the text from the instructions file and paste it into the “System Instructions” or the very first message of the chat. This “primes” the model for the rest of the conversation.

Step 4: Generating Your First Algorithm

With your environment set up and your AI educated, you are ready to code. You don’t need to write a single line of Python yourself; you just need to prompt effectively.

The Prompt Go to your AI (Antigravity or Jan) and issue a clear command:

“Write a trend-following strategy using a Golden Cross. Buy when the 50 EMA crosses above the 200 EMA. Sell when it crosses back below.”

The Result If you are using Antigravity, make sure you have the strategy file open so the agent knows where to write. The AI will generate a Python class that includes:

  • Properties: Defining the self.ema50 and self.ema200 indicators.
  • should_long(): The logic checking if the cross has happened.
  • should_cancel(): Logic to cancel pending orders.
  • go_long(): The instruction to enter the market, usually with a stop-loss and take-profit defined.

The AI handles the syntax (like ta.ema for indicators) because of the instructions you provided in Step 3.

Step 5: Backtesting the Baseline

Code is useless until it is tested. Now we return to the Jesse Dashboard to see if our Golden Cross idea actually makes money.

  1. Navigate: Go to http://localhost:9000.
  2. Configure: Click on “Backtest”.
    • Strategy: Select the strategy class the AI just wrote.
    • Symbol: Choose a volatile asset like BTC-USDT.
    • Timeframe: Select 15m or 1h (Golden crosses work better on higher timeframes).
    • Period: Select a start and end date (e.g., the last 6 months).
  3. Run: Click “Start”.

Analyzing Results The dashboard will produce a detailed report. Do not just look at “Net Profit.” Pay attention to:

  • Max Drawdown: How much money did the strategy lose at its worst point?
  • Sharpe Ratio: Is the return worth the risk? (You generally want this above 1.5).
  • Win Rate: A trend-following strategy might only win 40% of the time but have huge wins. This is normal.

Step 6: Iteration and Refine

Your first backtest will likely show mediocre results. This is normal. The strategy probably took too many trades during “choppy” sideways markets where moving averages fail. This is where the AI shines.

The Refinement Prompt Instead of guessing how to fix it, explain the problem to the AI:

“The strategy is losing money in ranging markets. Please add an ADX filter so that we only take trades when the trend strength is above 25.”

The AI will modify the code to import the ADX indicator and add a condition and self.adx > 25 to your buy rules. This simple change can often flip a losing strategy into a winning one by filtering out the “noise.”

Step 7: Advanced Automated Research

If you are using Google Antigravity, you can unlock a futuristic workflow: Automated Research. Because Antigravity can control the browser, you can give it a high-level mission.

The Autonomous Command You can tell the agent:

“I want you to test three different values for the ADX filter: 20, 25, and 30. For each one, modify the code, go to the browser dashboard, run the backtest, and record the Net Profit. Keep the best one.”

The Process

  1. Code Injection: The agent modifies your Python file.
  2. Browser Control: You will see the agent physically switch to your browser tab. It will click the “Backtest” button.
  3. Visual Confirmation: A visual indicator (often a glow around the browser window) shows the AI is in control.
  4. Evaluation: It reads the results from the screen. If ADX=30 produces the highest profit, it reverts the code to that version and reports back to you.

This loop allows you to “brute force” verify ideas without sitting at your desk. You can queue up experiments before bed and wake up to an optimized algorithm.

Conclusion

The barrier to entry for algorithmic trading has crumbled. By combining the Jesse Framework for execution with Antigravity or Jan.ai for code generation, you have a complete research lab at your fingertips. The key is not memorizing syntax, but learning how to prompt your AI agent with clear, logical trading ideas. Start simple, backtest everything, and let the AI handle the code.

Mark Cannon
Mark Cannon
Articles: 301