Skip to content

QuantInsti/AI-in-Trading-Workflow

AI in Your Trading Workflow: From Agents and Prompts to Execution

Python 3.12+ License: Apache 2.0 Contributions Welcome

Our repository for demonstrating how to build and deploy sophisticated algorithmic trading solutions using modern AI, from multi-agent systems to production-ready execution frameworks.

Contributors


Objective

The primary objective of this repository is to provide a concrete, end-to-end example of using modern AI agents for trading. It connects the theoretical application of LLMs to a practical, executable trading bot.

The project demonstrates the following workflow:

  1. Learn: Discover the landscape of modern AI tools for trading.
  2. Build: Follow tutorials to construct AI agent systems for market analysis.
  3. Integrate: Plug AI-driven logic into a professional-grade trading framework.
  4. Deploy: Run a fully automated, AI-powered trading bot.

This project will be updated with new implementations and tutorials to reflect advancements in the field.


Repository Structure & Key Components

This repository is organized into modules based on the AI tools and platforms they demonstrate. We will continue to expand this structure as we incorporate new technologies.

1. Gemini CLI

  • Location: gemini_cli/
  • Description: This section contains the core end-to-end implementation and related guides.
    • Production Trading Framework (ib_stock_setup): A professional Python framework for automated stock trading via the Interactive Brokers (IB) API.
    • AI-Powered Strategy (AI_strategy.py): A pluggable multi-agent strategy using Gemini that trades based on news sentiment and volatility analysis.
    • Developer Guides: Practical examples for using the Gemini CLI for development tasks.

2. Gemini FullStack LangChain

  • Location: gemini_full_stack_langgraph/
  • Description: A detailed, step-by-step tutorial on coding the multi-agent news analysis system from scratch, which provides the foundation for the AI_strategy.py file in our setups to trade live with LLMs!

3. LLMs

  • Location: LLMs/
  • Description: Detailed examples on how to create an agentic-based portfolio manager and an MCP server using the Interactive Brokers API with LLMs!

4. Dify

  • Location: Dify/
  • Description: This section contains an example using the Dify platform to build an AI-driven strategy backtesting script builder. The tutorial demonstrates how to construct an Agent workflow through a visual interface to create backtesting scripts.

5. More Curated List of AI Trading Tools coming soon!

  • We're currently engaged in creating more use cases of AI tools and platforms. Stay tuned!

Featured Implementation: AI News-Sentiment Trader

The main example in this repository demonstrates the integration of the AI strategy with the trading framework. By combining the ib_stock_setup and the AI_strategy.py, you can deploy a bot that:

  1. Connects to Interactive Brokers.
  2. Fetches the latest financial news for a target stock.
  3. Uses a multi-agent system to analyze sentiment and volatility.
  4. Makes autonomous BUY/SELL decisions based on the AI's analysis.
  5. Executes and manages the trade according to pre-set risk parameters.

This demonstrates a complete workflow, from AI-driven analysis to automated trade execution.


Future Implementations

This repository is actively maintained and will be expanded with more implementations, including but not limited to:

  • Advanced quantitative strategies using AI.
  • Integrations with other brokerages and data sources.
  • Tutorials on new and emerging agentic frameworks.
  • Alternative asset classes like crypto and forex.

Stay tuned for updates!


How to Contribute

Contributions are welcome! Whether it's reporting a bug, suggesting a new feature, improving documentation, or submitting a new implementation, your help is appreciated. Please refer to the CONTRIBUTING.md guide within this main directory for initial guidelines.

License

This project is licensed under the Apache License 2.0. See the LICENSE.txt file in this directory for details.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages