Skip to content

A forex bot using GPT3 trading strategies ! built with Golang

License

Notifications You must be signed in to change notification settings

MenesesGHZ/go-minitrader

Repository files navigation

GPT3 Forex Trader Bot

Version Go

This bot is a forex trading solution that uses strategies generated by GPT3 to trade the markets. It currently utilizes Capital.com as its main broker. The bot is built with Golang, utilizing a concurrent implementation to maximize efficiency.

Example Usage

package main

import (
	"log"
	"os"

	gominitrader "github.com/menesesghz/go-minitrader"
)

func main() {
	capitalClient, err := gominitrader.NewCapitalClient("your@email.com", "<API_TOKEN>", "<API_TOKEN_PASSWORD>", true)
	if err != nil {
		log.Fatal(err)
	}

	// Trade the USD/JPY currency pair with a 2% stop loss and a 0.35% upperbound profit target using 15-minute intervals and the GPTStrategy.
	minitraderUSDJPY := gominitrader.NewMinitrader(
		"USDJPY", 25, 2, 0.35, gominitrader.MINUTE_15, gominitrader.GPTStrategy,
	)

	// Trade the USD/CAD currency pair with a 2% stop loss and a 0.35% upperbound profit target using 15-minute intervals and the GPTStrategy.
	minitraderUSDCAD := gominitrader.NewMinitrader(
		"USDCAD", 25, 2, 0.35, gominitrader.MINUTE_15, gominitrader.GPTShortTermStrategy,
	)

	// Trade the USD/MXN currency pair with a 2% stop loss and a 0.35% upperbound profit target using 15-minute intervals and the GPTShortTermStrategy.
	minitraderUSDMXN := gominitrader.NewMinitrader(
		"USDMXN", 50, 2, 0.35, gominitrader.MINUTE_15, gominitrader.GPTShortTermStrategy,
	)

	minitraderPool, _ := gominitrader.NewMinitraderPool(capitalClient, minitraderUSDJPY, minitraderUSDCAD, minitraderUSDMXN)
	minitraderPool.Start()
}

The previous code is a main Go program that trades forex using the go-minitrader package. It establishes a new client connection to Capital.com, which serves as the designated broker for the bot's trades.

Then, it sets up three different instances of the minitrader for the currency pairs USD/JPY, USD/CAD, and USD/MXN with the same stop loss (2%) and upperbound profit target (0.35%), but with different trade sizes (25 for USD/JPY, 50 for USD/MXN, and default of 25 for USD/CAD) and different strategies (GPTStrategy for USD/JPY, GPTShortTermStrategy for USD/CAD and USD/MXN).

Finally, the program creates a new pool of minitraders, adds the three instances to it and starts the trading process by calling the Start() method.

Features To Be Implemented

  1. Backtesting Engine: The aim of this feature is to develop a backtesting engine that would allow testing the performance of the trading strategies before applying them on real trades.

  2. Telegram Bot Integration: This feature aims to integrate the trading bot with the Telegram Bot API to allow for easy monitoring and control of trades.

  3. Pull Historical Data from Trading View: To improve the performance of the trading strategies, it is necessary to access a larger data set. This feature aims to pull historical data from Trading View, which has a higher data limit compared to Capital.com API's limit of 10 requests per second.

Note

It is important to underline that this is a alpha version, all the strategies haven't been backtested. Only trade with funds that you can afford to lose. This bot is provided as-is and no guarantees or warranties are made regarding its performance. Use at your own risk.