Coder Social home page Coder Social logo

isaiahbjork / auto-gpt-metatrader-plugin Goto Github PK

View Code? Open in Web Editor NEW
446.0 27.0 80.0 103 KB

The AutoGPT MetaTrader Plugin is a software tool that enables traders to connect their MetaTrader 4 or 5 trading account to Auto-GPT.

Home Page: https://github.com/isaiahbjork/Auto-GPT-MetaTrader-Plugin

License: MIT License

Makefile 1.07% Batchfile 2.54% Shell 2.47% Python 93.91%
autogpt crypto finance forex gpt-3 gpt-4 metatrader metatrader-4 metatrader-5 metatrader5 mt4 mt5 stocks trading

auto-gpt-metatrader-plugin's Introduction

Auto-GPT MetaTrader Plugin ๐Ÿ“ˆ

The AutoGPT MetaTrader Plugin is a software tool that enables traders to connect their MetaTrader 4 or 5 trading account to Auto-GPT.

Try MetaTrader GPT on ChatGPT

GitHub Repo stars

๐Ÿ’– Help Support Auto-GPT Plugin's Development ๐Ÿ’–

If you can spare a coffee, you can help to cover the costs of developing Auto-GPT Plugins and help to push the boundaries of fully autonomous AI! Your support is greatly appreciated. Development of this free, open-source project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here.

Crypto Donations: 0x2457e8746EFa5894b70aE06a1b391474bc928B05

๐Ÿ’ก Key Features:

  • ๐Ÿ’ฐ Place Trades
  • โ„น๏ธ Account Information
  • โ›”๏ธ Close Trade
  • โŒ Close All Trades
  • ๐Ÿ•ฏ Candlestick Data
  • ๐Ÿ“ˆ Stock of The Day
  • ๐Ÿ“‚ Red Folder News
  • ๏ผ… Community Sentiment (In-Progress)
  • ๐Ÿ“ Modify Trades (In-Progress)

๐Ÿ”ง Installation

Follow these steps to configure the Auto-GPT MetaTrader Plugin:

1. Clone the Auto-GPT-MetaTrader-Plugin repository

Clone this repository and navigate to the Auto-GPT-MetaTrader-Plugin folder in your terminal:

git clone https://github.com/isaiahbjork/Auto-GPT-MetaTrader-Plugin.git

2. Install required dependencies

Execute the following command to install the necessary dependencies:

pip install -r requirements.txt

3. Package the plugin as a Zip file

Compress the Auto-GPT-MetaTrader-Plugin folder or download the repository as a zip file.

4. Install Auto-GPT

If you haven't already, clone the Auto-GPT repository, follow its installation instructions, and navigate to the Auto-GPT folder.

You might have to run this in the Auto-GPT file if you get an error saying "No Module Found".

pip install ta myfxbook

5. Copy the Zip file into the Auto-GPT Plugin folder

Transfer the zip file from step 3 into the plugins subfolder within the Auto-GPT repo.

6. Locate the .env.template file

Find the file named .env.template in the main /Auto-GPT folder.

7. Create and rename a copy of the file

Duplicate the .env.template file and rename the copy to .env inside the /Auto-GPT folder.

8. Edit the .env file

Open the .env file in a text editor. Note: Files starting with a dot might be hidden by your operating system.

9. Add MetaTrader configuration settings

Append the following configuration settings to the end of the file:

################################################################################
### METATRADER
################################################################################
META_API_ACCOUNT_ID=
META_API_TOKEN=
META_API_REGION=
LUNAR_CRUSH_API_KEY=
MY_FX_BOOK_USERNAME=
MY_FX_BOOK_PASSWORD=
FCS_API_KEY=
  • Create a MetaAPI account and connect to your broker.
  • MT5 accounts will need to have a paid account to access candlestick data.
  • Create a MyFxBook account and connect to your trading accounts.
  • Create a FCS API account. (500 calls/mo for free)
  • Set META_API_ACCOUNT_ID to your MetaAPI account ID.
  • Set META_API_TOKEN to your MetaAPI token.
  • Set META_API_REGION to your MetaAPI region (new-york, london, singapore).
  • Set LUNAR_CRUSH_API_KEY to your LunarCrush API Key.
  • Set MY_FX_BOOK_USERNAME to your MyFxBook username/email.
  • Set MY_FX_BOOK_PASSWORD to your MyFxBook password.
  • Set FCS_API_KEY to your FCS API KEY.

10. Allowlist Plugin

In your .env search for ALLOWLISTED_PLUGINS and add this Plugin:

################################################################################
### ALLOWLISTED PLUGINS
################################################################################
#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3)
ALLOWLISTED_PLUGINS=AutoGPTMetaTraderPlugin

11. Review Available Commands

You can review the available commands and indicators here.

๐Ÿงช Test the Auto-GPT MetaTrader Plugin

Experience the plugin's capabilities by testing it for placing trades, managing your account, closing trades, and fetching candlestick data.

Test Fetching Candlestick Data

  1. Configure Auto-GPT: Set up Auto-GPT with the following parameters:

    • Name: TradeGPT
    • Role: fetch candlestick data
    • Goals:
      1. Goal 1: fetch candlestick data for the 1 hour chart on EURUSD
      2. Goal 2: Terminate
  2. Run Auto-GPT: Launch Auto-GPT, which should use the MetaTrader plugin and it should load the candlestick data.

  3. Sample response:

auto-gpt-email-plugin

๐Ÿ“‰ Indicators (In-Progress):

  • Relative Strength Index (RSI)
  • Volume
  • Moving Averages (SMA, EMA, WMA, MAE, OsMA, MACD)
  • Fibonacci Retracement
  • Bollinger Bands
  • Money Fund Index (MFI)

auto-gpt-metatrader-plugin's People

Contributors

bigguyjones avatar isaiahbjork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

auto-gpt-metatrader-plugin's Issues

Bring candles from the broker

Why not bring the candles from a Forex broker to do the analysis? Opening an account at a broker is free and can you open "demo" accounts and use the "Metatrader 5" library for python for this?

Failed to get candlesticks.

Good day to you! I've been wondering about trying out this plugin. I've created all of the requried accounts and entered all of the ids and api keys, but when i try to run it, it always Failed to get candlesticks. I let it run for a few commands and it also throws Error: DataFrame constructor not properly called!. I'm kinda new to github issues, so appologies for poor formatting. Thank you in advance for any help.
image

Fetch Candlestick Data Test Failed

Please offer advice on my next move to resolve this?
Here is the most telling line...
SYSTEM: Command fetch_candlesticks returned: Failed to get candlesticks.
THOUGHTS: The 'fetch_candlesticks' command failed again. I will check if there are any issues with the API or my internet connection.

I'm running aGPT-0.3.1 Stable in Docker w/ Windows 10, Py3.10.11 Stable

Here is my log:
I want Auto-GPT to: --manual
Manual Mode Selected
Create an AI-Assistant: Enter the name of your AI and its role below. Entering nothing will load defaults.
Name your AI: For example, 'Entrepreneur-GPT'
Asking user via keyboard...
AI Name: TradeGPT
TradeGPT here! I am at your service.
Describe your AI's role: For example, 'an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.'
Asking user via keyboard...
TradeGPT is: fetch candlestick data
Enter up to 5 goals for your AI: For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Enter nothing to load defaults, enter nothing when finished.
Asking user via keyboard...
Goal 1: fetch candlestick data for the 1 hour chart on EURUSD
Asking user via keyboard...
Goal 2: Terminate
Asking user via keyboard...
Goal 3:
Enter your budget for API calls: For example: $1.50
Enter nothing to let the AI run without monetary limit
Asking user via keyboard...
Budget: $
TradeGPT has been created with the following details:
Name: TradeGPT
Role: fetch candlestick data
Goals:

  • fetch candlestick data for the 1 hour chart on EURUSD
  • Terminate
    Using memory of type: RedisMemory
    Using Browser: chrome
    THOUGHTS: I will fetch candlestick data for the 1 hour chart on EURUSD.
    REASONING: I need to fetch the candlestick data to analyze the price movements of EURUSD over the past hour.
    PLAN:
  • Use the 'fetch_candlesticks' command to get the candlestick data for EURUSD on the 1 hour chart.
    CRITICISM: I need to ensure that I am using the correct symbol and timeframe for the 'fetch_candlesticks' command.
    NEXT ACTION: COMMAND = fetch_candlesticks ARGUMENTS = {'symbol': 'EURUSD', 'timeframe': '1h'}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for ...
    Asking user via keyboard...
    Input:y
    -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
    SYSTEM: Command fetch_candlesticks returned: Failed to get candlesticks.
    THOUGHTS: The 'fetch_candlesticks' command failed. I will try again with the correct symbol and timeframe.
    REASONING: I need to ensure that I am using the correct symbol and timeframe for the 'fetch_candlesticks' command.
    PLAN:
  • Use the 'fetch_candlesticks' command to get the candlestick data for EURUSD on the 1 hour
    chart.
    CRITICISM: I need to ensure that I am using the correct symbol and timeframe for the 'fetch_candlesticks' command.
    NEXT ACTION: COMMAND = fetch_candlesticks ARGUMENTS = {'symbol': 'EUR/USD', 'timeframe': '1h'}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for ...
    Asking user via keyboard...
    Input:y
    -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
    SYSTEM: Command fetch_candlesticks returned: Failed to get candlesticks.
    THOUGHTS: The 'fetch_candlesticks' command failed again. I will check if there are any issues with the API or my internet connection.
    REASONING: If the 'fetch_candlesticks' command is not working, there may be an issue with the API or my internet connection.
    PLAN:
  • Check if there are any issues with the API or my internet connection.
    CRITICISM: I need to ensure that I am able to connect to the API and that my internet connection is stable.
    NEXT ACTION: COMMAND = make_api_call ARGUMENTS = {'host': 'https://api.example.com', 'endpoint': '/status', 'method': 'GET', 'query_params': {}, 'body': {}, 'headers': {}}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, 'n' to exit program, or enter feedback for ...
    Asking user via keyboard...
    Input:n
    Exiting...

steps not working

Welcome to Auto-GPT! run with '--help' for more information.
Create an AI-Assistant: Enter the name of your AI and its role below. Entering nothing will load defaults.
Name your AI: For example, 'Entrepreneur-GPT'
AI Name: TradeGPT
TradeGPT here! I am at your service.
Describe your AI's role: For example, 'an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.'
TradeGPT is: fetch candlestick data
Enter up to 5 goals for your AI: For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Enter nothing to load defaults, enter nothing when finished.
Goal 1: fetch candlestick data for the 1 hour chart on EURUSD
Goal 2: Terminate
Goal 3:
Using memory of type: LocalCache
Using Browser: chrome
THOUGHTS: I will fetch candlestick data for the 1 hour chart on EURUSD. I can use the Alpha Vantage API to get this data.
REASONING: I have used the Alpha Vantage API before to fetch financial data, and it is a reliable source for this type of data.
PLAN:

  • Use the Alpha Vantage API to fetch candlestick data for the 1 hour chart on EURUSD.
    CRITICISM: I need to ensure that I am using the correct API key and that the data is being fetched correctly.
    NEXT ACTION: COMMAND = do_nothing ARGUMENTS = {}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
    Input:y
    -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
    SYSTEM: Command do_nothing returned: No action performed.
    THOUGHTS: I will use the Alpha Vantage API to fetch candlestick data for the 1 hour chart on EURUSD. I need to ensure that I have the correct API key and that the data is being fetched correctly.
    REASONING: I have used the Alpha Vantage API before to fetch financial data, and it is a reliable source for this type of data. I need to ensure that I have the correct API key and that the data is being fetched correctly to avoid any errors.
    PLAN:
  • Check that I have the correct API key for Alpha Vantage.
  • Use the Alpha Vantage API to fetch candlestick data for the 1 hour chart on EURUSD.
    CRITICISM: I need to ensure that I am using the correct API key and that the data is being fetched correctly.
    NEXT ACTION: COMMAND = do_nothing ARGUMENTS = {}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
    Input:

Error fetching candlestick data for GBPUSD pair in TraderGPT

Description:
I encountered an error while trying to fetch candlestick data for the GBPUSD pair using the TraderGPT, an AI-powered trader that performs technical analysis. The error seems to be related to the connection to the API.

Details:

  • TraderGPT Role: AI-powered trader that enters trades after doing technical analysis
  • Goal: Fetch candlestick data for GBPUSD pair
  • Memory Type: PineconeMemory
  • Browser: Chrome

Error Message:
Error: HTTPSConnectionPool(host='mt-market-data-client-api-v1.new-york.agiliumtrade.ai', port=443): Max retries exceeded with url: /users/current/accounts/45826ed7-e48f-4d9f-941f-41e7a3d71310/historical-market-data/symbols/GBPUSD/timeframes/1h/candles?limit=15 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x1277f4b50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

Steps to reproduce:

  1. Use the 'fetch_candlesticks' command to retrieve the data for the GBPUSD pair with the following arguments: {'symbol': 'GBPUSD', 'timeframe': '1h'}.
  2. Authorize the command.
  3. Observe the error message.

Expected behavior:
The 'fetch_candlesticks' command should successfully retrieve the candlestick data for the GBPUSD pair without any errors.

Additional context:
Please let me know if any additional information is required to diagnose or resolve this issue. Thank you!

ModuleNotFoundError: No module named 'ta'

I've installed everything according to the README file:

  1. I pasted the .zip in the Plugin Folder of the Auto-GPT folder
  2. I ran pip install ta myfxbook as well but I keep getting:
  3. ModuleNotFoundError: No module named 'ta'
  4. I tried: pip install ta
    Still stuck with Module not found...
    Any advice?
    I'm running Auto-GPT in Docker on Windows 10.
    I tried this in CMD window and VSCode Terminal with same result.
    Not a seasoned CMD or PS user so, is it possible I'm running the 'PIP strings in the wrong root folder. I've been running these strings from the auto-GPT folder.

HELP

error

src/auto_gpt_metatrader/fcs.py:14:27: W3101: Missing timeout argument for method 'requests.get' can cause your program to hang indefinitely (missing-timeout)

Not working with latest AutoGPT stable

Hey there,

tried all the setup options with latest AutoGPT stable. Following the docker method https://docs.agpt.co/autogpt/setups/docker-setup/#set-up-with-docker.

  1. My folder structure looks like this:

Screenshot 2023-11-21 at 09 34 26

  1. My docker-compose.yaml:

version: "3.9" services: auto-gpt: image: significantgravitas/auto-gpt env_file: - .env profiles: ["exclude-from-up"] volumes: - ./auto_gpt_workspace:/app/auto_gpt_workspace - ./data:/app/data - ./logs:/app/logs - ./plugins:/app/plugins - type: bind source: ./ai_settings.yaml target: /app/ai_settings.yaml - type: bind source: ./plugins_config.yaml target: /app/plugins_config.yaml

  1. I run as suggested with docker compose run --rm auto-gpt.

Problem

I get always in the loop triggering a web_search (see screenshot):

Screenshot 2023-11-21 at 09 37 19

It's curious that when I disable the plugin in plugins_config.yaml, it gives a warn about that. Therefore I assume that it's activated correctly otherwise.

Note: when I use postman to query the metaAPI I get the proper response.

Any help would be appreciated.

Wrong or missing arguments when calculating SMA

Hi,

I did some tests on a demo broker account and the sma command seems to either be wrong or is missing an argument because it always returns "Error: min_periods must be an integer". After that, AutoGPT tried the sma command with the min_periods argument, which resulted in another error "Error: AutoGPTMetaTraderPlugin.sma() got an unexpected keyword argument 'min_periods'.

After that, all the other indicators were calculated correctly but the system crashed due to the message finally being to long for openai to handle and I got the "message is too long" error.
SMAError

Some thing happened after the update

Firstly thank you for developing this code, it has lot of potential for traders. I am getting the error below can you help me resolvve it please. It was working fine yesterdat Thank you and sorry for troubling you if i am getting this error due to an amterut mistake.

WARNING: Plugin AutoGPTMetaTraderPlugin found. But not in the allowlist... Load? (y/n): y
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Auto-GPT\autogpt_main.py", line 5, in
autogpt.cli.main()
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1635, in invoke
rv = super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
return _callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Auto-GPT\autogpt\cli.py", line 96, in main
run_auto_gpt(
File "C:\Auto-GPT\autogpt\main.py", line 142, in run_auto_gpt
cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Auto-GPT\autogpt\plugins.py", line 238, in scan_plugins
loaded_plugins.append(a_module())
^^^^^^^^^^
File "C:\Users\alpha\AppData\Local\Programs\Python\Python311\Lib\site-packages\abstract_singleton_init.py", line 14, in call
cls._instances[cls] = super().call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class AutoGPTMetaTraderPlugin with abstract methods can_handle_report, can_handle_text_embedding, can_handle_user_input, handle_text_embedding, report, user_input

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.