Giter VIP home page Giter VIP logo

asynctrader's Introduction

AsyncTrader

Chinese

Running quantitative trading systems automatically with ChatGPT sounds pretty cool, doesn't it?

Project Introduction

Building a complete quantitative trading system using AGI (Artificial General Intelligence) is still quite challenging. However, fortunately, there seems to be a feasible approach in teaching llm to use existing mature quantitative trading systems, and we are working on it.

With the control flow of langchain, we use ChatGPT to automatically write and backtest quantitative trading strategies, as well as provide documentation question-and-answer functionality. At present, a fairly comprehensive workflow has been implemented in the Freqtrade quantitative system. Additionally, it supports partial functionality of China's AkShare and Vnpy.

Supplementary Information

Model limitations

  1. The database used by ChatGPT is up to date as of September 12, 2021, which means that the Freqtrade strategies generated by ChatGPT are usually old versions (v2).
  2. GPT-4 is smarter, capable of completing tasks well with very simple prompts, but it is too expensive. GPT-3.5 is cheaper, but it requires more time and effort in writing prompts. Pricing information: https://openai.com/pricing
  3. On June 13, 2023, OpenAI improved the GPT model by adding a function calling feature. All models in this project must use the ...-0613 model.
  4. The gpt-3.5-turbo-0613 and gpt-4-0613 models support a maximum of 4096 tokens, which means that if we use these models, the total length of our prompts and the strategy code generated by the model cannot exceed about 3000 words. If there is too much content, you can try using the gpt-3.5-turbo-16k-0613 and gpt-4-32k-0613 models. Reference: https://platform.openai.com/docs/models/gpt-3-5
  5. ChatGPT is obviously more proficient in English language-related knowledge. Currently, the strategies we generate based on the Freqtrade system using gpt3.5 can run directly, while the strategies based on the vnpy system always have various minor errors (only the more expensive gpt4 model and more professional prompts can solve this problem).

Function execution and documentation Q&A

  1. Function execution and documentation Q&A are different contents and require the execution of different programs. eg: start_ft_app.py, start_ft_docs.py
  2. Document Q&A relies on the MD documents written by project developers, so the project must be cloned to the local machine.
  3. When using AkShare for document Q&A, you must use the gpt-3.5-turbo-16k-0613 or gpt-4-32k-0613 model.

Introduction to Different Systems

  • Freqtrade: A free open source cryptocurrency trading robot project that contains all the contents of a complete quantitative trading system.
  • Vnpy: A free open source quantitative trading project in China, dedicated to providing a quantitative solution from trading API docking to automatic strategy trading.
  • AkShare: Almost all financial trading data in mainland China needs to be purchased. AkShare is a simple alternative. AkShare uses an open source financial data interface library to collect data, without involving any personal privacy data and non-public data.

Basic Environment Installation

  1. Install miniconda/anaconda: https://docs.conda.io/en/latest/miniconda.html
  2. It is recommended to create a Python virtual environment (optional)
conda create -n env_trader python=3.10
  1. Download the AsyncTrader project code locally
cd AsyncTrader/
pip install -r requirements.txt
  1. Modify the trading_system/base.py file, add OPENAI_API_KEY, and select gpt3.5/4

Select Project for Installation

  1. Clone the project locally: git clone https://github.com/freqtrade/freqtrade.git
  2. Enter the project directory: cd \path\freqtrade
  3. Specify the content for installation
pip install --find-links build_helpers\ TA-Lib -U
pip install -r requirements.txt
pip install -e .
pip install -r requirements-hyperopt.txt

Installation reference: https://www.freqtrade.io/en/stable/windows_installation/

  1. Clone the project locally: git clone https://github.com/akfamily/akshare.git
  2. Specify the content for installation
pip install akshare

Installation reference: https://akshare.akfamily.xyz/installation.html

  1. Clone the project locally: git clone https://github.com/vnpy/vnpy.git
  2. Specify the content for installation
pip install vnpy
pip install akshare
pip install vnpy_datamanager
pip install vnpy_rqdata
pip install vnpy_ctastrategy
pip install vnpy_sqlite

asynctrader's People

Contributors

dumengru1997 avatar junchaomei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.