Skip to content
프로젝트

llSourcell/ChatGPT_Trading_Bot

GitHub에서 보기

llSourcell/ChatGPT_Trading_Bot has 968 GitHub stars and 488 forks. GitHot measured +1 stars in 24 hours and -2 in 7 days. Last checked 2026-11-25 00:54 UTC. Last push 2023-01-29.

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+1
in 7 days
-2
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

Siraj Raval이 YouTube에 게시한 "ChatGPT Trading Bot" 동영상의 코드입니다.

창작 및 미디어

README.md

Original

ChatGPT_Trading_Bot

This is the code for the "ChatGPT Trading Bot" Video by Siraj Raval on Youtube

Overview

This is the code for this video on Youtube by Siraj Raval on building a ChatGPT trading bot. First, a disclaimer - Do NOT invest any money in any type of trading bot or algorithmic engine that you are not willing to lose. I gave this trading bot $2000 because I was willing to lose $2000 to make a great video for my AI Wizards out there. The entire codebase is contained in a single iPython notebook file, first published by the FinRL team as an example. Inside the notebook, 5 steps are performed.

  1. Pull 30 days of trading data for (Insert your stock or crypto) with Yahoo Finance Downloader API
  2. Create a simulated trading environment using real trading data with FinRL
  3. Train an neural network to predict that Stock Price using reinforcement learning inside this simulation with FinRL
  4. Once trained, backtest the predictions on the past 30 days data to compute potential returns with FinRL
  5. If the expectd returns are above a certain threshold, buy, else hold. If they're below a certain threshold, sell. (using Alpaca API)

In order to have this Colab run automatically once a day, we can deploy it to a hosting platform like Vercel with a seperate file that repeatedly executes it.

alt text

Dependencies

Setup Instructions

  1. Download the iPython notebook in this repository and upload it to Colab to try it out.
  2. Setup a simple flask app.
  3. To set up a cron job for a Flask app deployed on Vercel that executes a Google Colab notebook at a given link every hour, you can use the built-in Vercel cron feature. Here are the steps to follow:
  4. In your Flask app, import the necessary modules to run the Colab notebook, such as gdown or pyngrok
  5. Create a new endpoint in your Flask app that triggers the execution of the Colab notebook, using the link to the notebook file.
  6. Go to the Vercel project settings for your app and navigate to the "Cron" tab.
  7. Create a new cron job that runs every hour by adding the endpoint you created in step 2 to the "Cron Job" field and select the frequency you want to run the job.

Here is a sample code snippet for step 2:


from flask import Flask, jsonify
import gdown
app = Flask(__name__)

@app.route('/run-colab')
def run_colab():
    gdown.download('https://drive.google.com/file/d/<colab_notebook_id>', 'colab.ipynb', quiet=False)
    return jsonify(message='colab notebook ran successfully')

Credits & More Resources

Credits for the notebook go to the AI4FinanceFoundation, and for the API go to Alpaca.

관련 프로젝트 살펴보기

불러오는 중…