Skip to content

Latest commit

 

History

History
305 lines (217 loc) · 18.3 KB

README.md

File metadata and controls

305 lines (217 loc) · 18.3 KB

Forex-Rates plugin for Chat-GPT, developed by ForexGPT from Forex-GPT.ai

Forex Rates software suite: Developed by ForexGPT, the Forex Rates plugin for Chat-GPT, also known as ForexGPT, as well as a free custom GPT, and premium version, the Forex Rates software suite provides AI-powered advanced analysis for currency markets using Chat-GPT by OpenAI (Please read our terms and conditions for more).

Beta version available to premium subscribers (charts seen below are generated in response to prompting Forex Rates beta version 3.06, which requires authentication enable in ChatGPT):

Forex-Rates-Premium-Version-3 07-BTC-Weekly-Analysis-Through-123123

Forex Rates features include:

  • Real-time rates: Retrieve historical and current forex market prices (free version)
  • Conversion: Calculate currency conversion with the latest exchange rates (free version)
  • Market analysis: Receive AI-powered technical analysis (free version)
  • Chart creation: Create forex charts on the fly with natural language (Available in premium version)
  • Trading strategy: Receive risk-management perspectives (Available in premium version)
  • Chart analysis: Upload your own charts for Forex Rates to analyze (Available in premium version)

Forex-Rates reviews in the media:

A curated list of profiles and reviews of Forex-Rates across various platforms as of late 2023:

Example capabilities:

Forex-GPT-premium-forex-chart-creation-and-analysis Forex-Rates-Premium-version-example-EURUSD-default-prompt

Install directly from within Chat-GPT:

Forex-Rates is now available to all Chat-GPT premium subscribers, as of June 10th, 2023. Please note that the Plugin works 7-days a week but the trading week is from 5pm EST on Sunday through 5pm EST on Friday, so any requests made on the weekend cannot be in the present tense as markets are closed on the weekends.

Quickstart guide

In addition to the free plugin on the ChatGPT Plugin store, Forex-Rates is also available as a free custom GPT, alongside a premium version (the paid version is $2 per month, or a one-time flat fee of $10, to help support the development of this project).

Usage-options-free-version-payments-and-plans

Sample prompts from the last hour of minute data to the last 60 months of month candle stick data:

Try asking Forex-Rates these prompts:

  • "What is the overall sentiment for the EURUSD currency pair using bid prices on ten-minute candles for the past ten hours, excluding volume data?"
  • "What is the overall sentiment for the GBPUSD currency pair using bid prices on sixty-minute candles for the past sixty hours, excluding volume data?"
  • "What is the overall sentiment for the USDCHF currency pair using bid prices on daily candles for the past sixty days, excluding volume data?"
  • "What is the overall sentiment for the USDJPY currency pair using bid prices on weekly candles for the past sixty weeks, excluding volume data?"
  • "What is the overall sentiment for the USDCAD currency pair using bid prices on monthly candles for the past sixty months, excluding volume data?"
  • "What is the overall sentiment for the EURUSD currency pair using bid prices on daily candles for the past sixty days, excluding volume data, and tell me the starting prices on the first day and last candle price on last day for that period?"
  • "Based on ten-minute candles for the past nine hours using ask prices, what is the sentiment analysis for the EUR/USD currency pair? Please include the starting price, latest price, and describe the current trend leading up to the present."
  • "Could you provide an in-depth sentiment analysis for the GBP/USD currency pair using the bid prices of sixty-minute candles over the past sixty hours? Please share the starting price, latest price, and explain the prevailing trend up to the present."
  • "I'm interested in understanding the overall sentiment of the USD/JPY currency pair over the past sixty months using the bid prices of monthly candles. Kindly include the starting price, latest price, and elaborate on the current trend leading up to the present."
  • "What does the sentiment analysis reveal for the USD/CHF currency pair ask prices based on daily candles over the past thirty days? Please provide the starting price, latest price, and offer insights into the prevailing trend up to the present."
  • "Provide a comprehensive sentiment analysis for the AUD/USD currency pair using fifteen-minute candles for the past six hours of bid prices. Include the starting price, latest price, and discuss the current trend leading up to the present."

Forex Rates on ChatGPT Mobile app

** Here are some further examples of Forex-Rates Premium Version (custom GPT) on mobile. Prompts can be as simple as saying into your microphone or typing: “Eurusd chart last 2 weeks analysis daily bid prices” and this was the result:**

Forex Rates Premium Version example prompt mobile (3) Forex Rates Premium Version example prompt mobile (2) Forex Rates Premium Version example prompt mobile (1)

Another example of interacting with the Chat-GPT in a way that will trigger the Forex-Rates plugin to elicit a response from the broker API, by asking:"what is the bid ask spread on the latest 1 minute candle from oanda" where it will default to using the eur/usd pair (alternatively you can ask for a supported currency in your prompt). In the example below, we use a default prompt in the Forex Rates - Free Version custom-GPT.

Here is a short video demonstrating the Forex-Rates plugin responding in real-time to a query:

Forex-GPT-example-use-Chat-GPT-4-plugin.mov

Advanced options for developers interested in supporting this project

This is a quick start guide for setting up a development server locally and running the Forex-Rates OpenAI plugin, which integrates text analysis capabilities with the OANDA API for analyzing currency market data. If you do not already have plugin developer access, please join the waitlist.

local server setup for Mac users (only if you plan on contributing code to this project)

You will need the following API keys which can be obtained from their respective providers:

  1. Open AI API key for developers:
  2. OANDA API for for fxTrade demo account:

revise the values contained in the .env file and set the following variables by replacing the #comments:

PORT=#port info (i.e. 5003)
OANDA_API_KEY=#oanda api key for practice accounts
OPENAI_API_KEY=#openai api key
OANDA_TOKEN= #repeat same OANDA Api key for yaml file
YOUR_OANDA_USERNAME= #registered email 
ACCOUNT1=#oanada demo account number 1
ACCOUNT2=#oanada demo account number 2 (if any)
ACTIVE_ACCOUNT= #oanada demo account v20 compatible from 1 or 2 
  1. Navigate to https://chat.openai.com.
  2. In the Model drop down, select "Plugins" (note, if you don't see it there, you don't have access yet).
  3. Select "Plugin store"
  4. Select "Install unverified plugin"
  5. Enter in https://live.forex-gpt.ai since this is the URL the server is running on.

The plugin should now be installed and enabled! You can start with a question like "What is the eur/usd sentiment now, based on the past month daily candles using bid prices (don't comment on each candle just overall)" or revise your prompt accordingly.

Understanding the maximum message size and token-limit imposed by Chat GPT:

The following prompts should work, as they scratch the upper threshold of the token limit per message, which is currently 32k tokens for custom GPTs (and 128k for the plugin), based on the latest engine upgrade to Forex-Rates, so that you can query larger historical time-frames.

Forex-Rates Plugin Flowchart

Forex-GPT-plugin-flow-chart drawio

Overview of how Forex-Rates plugin works:

  1. Imports necessary libraries and modules.

  2. Configures Flask app and CORS settings.

  3. Defines the following routes:

    • "/generate" (POST)

      • Takes a 'prompt' and 'temperature' from the request's JSON.
      • Generates text using OpenAI's Completion API with the specified 'prompt' and 'temperature'.
      • Returns the generated text as a JSON response.
    • "/complete" (POST)

      • Takes 'text' from the request's JSON.
      • Uses OpenAI's Completion API to complete the provided 'text'.
      • Returns the completed text as a JSON response.
    • "/search" (POST)

      • Takes a 'query' from the request's JSON.
      • Uses OpenAI's Completion API to generate a response to the query.
      • Returns the generated text as a JSON response.
    • "/playground" (POST)

      • Takes 'code' from the request's JSON.
      • Uses OpenAI's Completion API to generate a response to the code.
      • Returns the generated text as a JSON response.
    • "/logo.png" (GET)

      • Serves a logo image from the current directory.
    • "/openapi.yaml" (GET)

      • Serves an OpenAPI specification file from the current directory.
    • "/.well-known/ai-plugin.json" (GET)

      • Serves an AI plugin manifest file from the .well-known directory.
    • "/prices" (GET/POST)

      • Depending on the method, takes parameters from the request's JSON or arguments.
      • Checks if all required parameters are provided.
      • If not, returns a prompt message as a JSON response.
      • If yes, retrieves the price data from Oanda using the parameters.
      • Returns the price data as a JSON response.
    • "/api/analyze" (POST)

      • Takes parameters from the request's JSON.
      • If 'from_time' is not provided, calculates it as 2 days before the current time.
      • Analyzes the market using the parameters.
      • Returns the market sentiment as a JSON response.
  4. Defines the OpenAIPlugin class:

    • Initializes the Oanda and OpenAI clients.
    • Defines methods to analyze the market and get Oanda candles.
  5. Prints Oanda and OpenAI API keys.

  6. Lists all available OpenAI engines and prints their IDs.

  7. Runs the Flask app on host '0.0.0.0' and port '5003'.

  8. Requires the user to point the Chat-GPT developer plugin interface to the localhost URL (i.e., http://localhost:5003).

  9. The plugin is loaded into Chat-GPT and can be enabled.

  10. User asks Chat-GPT for analysis or sentiment on a supported currency pair (i.e., EUR/USD) for a specific duration (i.e., 1 week) and time-series (daily interval), and the plugin triggers and formats the request to the broker API to retrieve prices and perform calculations as per the Main.py file (see flow chart below).

Main-dot-py-Application-flow-chart

Getting help

Server status

Open AI API resources:

If you run into issues or have questions building a plugin, please join our Developer community forum.

OANDA API developer resources:

Major Currency Pairs

These are the most traded currency pairs in the world, representing the world's largest economies. They include:

  • EUR/USD (Euro / United States Dollar)
  • USD/JPY (United States Dollar / Japanese Yen)
  • GBP/USD (British Pound Sterling / United States Dollar)
  • USD/CHF (United States Dollar / Swiss Franc)
  • AUD/USD (Australian Dollar / United States Dollar)
  • USD/CAD (United States Dollar / Canadian Dollar)
  • NZD/USD (New Zealand Dollar / United States Dollar)
  • USD/MXN (United States Dollar / Mexican Peso)
  • USD/HUF (United States Dollar / Hungarian Forint)
  • USD/TRY (United States Dollar / Turkish Lira)
  • USD/CNH (United States Dollar / Chinese Yuan)
  • USD/PLN (United States Dollar / Polish Zloty)
  • USD/DKK (United States Dollar / Danish Krone)
  • USD/NOK (United States Dollar / Norwegian Krone)
  • USD/SEK (United States Dollar / Swedish Krona)
  • USD/HKD (United States Dollar / Hong Kong Dollar)
  • USD/SGD (United States Dollar / Singapore Dollar)
  • USD/CZK (United States Dollar / Czech Koruna)
  • USD/ZAR (United States Dollar / South African Rand)
  • USD/THB (United States Dollar / Thai Baht)

Cross Currency Pairs

These pairs do not include the US dollar but include the major currencies like the Euro, the UK Pound, and Yen. Examples include:

  • EUR/GBP (Euro / British Pound Sterling)
  • EUR/AUD (Euro / Australian Dollar)
  • GBP/JPY (British Pound Sterling / Japanese Yen)
  • EUR/JPY (Euro / Japanese Yen)
  • GBP/CHF (British Pound Sterling / Swiss Franc)
  • GBP/CAD (British Pound Sterling / Canadian Dollar)
  • EUR/CHF (Euro / Swiss Franc)
  • AUD/JPY (Australian Dollar / Japanese Yen)
  • CHF/JPY (Swiss Franc / Japanese Yen)
  • EUR/CAD (Euro / Canadian Dollar)
  • EUR/ZAR (Euro / South African Rand)
  • EUR/NOK (Euro / Norwegian Krone)
  • NZD/JPY (New Zealand Dollar / Japanese Yen)
  • NZD/CAD (New Zealand Dollar / Canadian Dollar)
  • NZD/CHF (New Zealand Dollar / Swiss Franc)
  • AUD/CAD (Australian Dollar / Canadian Dollar)
  • GBP/AUD (British Pound Sterling / Australian Dollar)
  • GBP/NZD (British Pound Sterling / New Zealand Dollar)
  • AUD/SGD (Australian Dollar / Singapore Dollar)
  • AUD/CHF (Australian Dollar / Swiss Franc)
  • AUD/HKD (Australian Dollar / Hong Kong Dollar)
  • NZD/SGD (New Zealand Dollar / Singapore Dollar)
  • NZD/HKD (New Zealand Dollar / Hong Kong Dollar)
  • SGD/JPY (Singapore Dollar / Japanese Yen)
  • HKD/JPY (Hong Kong Dollar / Japanese Yen)
  • CHF/HKD (Swiss Franc / Hong Kong Dollar)
  • TRY/JPY (Turkish Lira / Japanese Yen)
  • CHF/ZAR (Swiss Franc / South African Rand)
  • GBP/ZAR (British Pound Sterling / South African Rand)
  • EUR/HKD (Euro / Hong Kong Dollar)
  • GBP/HKD (British Pound Sterling / Hong Kong Dollar)
  • EUR/CZK (Euro / Czech Koruna)
  • CAD/JPY (Canadian Dollar / Japanese Yen)

Cryptocurrency Pairs

OANDA also supports some cryptocurrency pairs like:

  • BTC/USD (Bitcoin / United States Dollar)
  • ETH/USD (Ethereum / United States Dollar)

Please note that the availability of currency pairs may depend on the region and the specific regulations applicable to forex trading in that region. It's always a good idea to check the OANDA API documentation or contact OANDA support for the most accurate and up-to-date information.

Currency Conversion

The Forex-Rates plugin for Chat-GPT 4 can also make currency conversion calculations, such as by asking it to convert an arbitrary amount of one currency into another using the latest rates. For instance, asking "What is $163,765 in euros?" will return a result like seen in the screenshot below:

Screen Shot 2023-11-05 at 5 31 51 PM

Disclaimer

Risk Warning: Trading in currency markets involves substantial risk of loss and is not suitable for everyone. The Forex Rates plugin provided in this repository is intended for informational purposes only and should not be considered as financial or investment advice. Before making any trading decisions, it is important to conduct thorough research, seek professional guidance, and fully understand the risks involved.

No Warranty: The Forex Rates plugin is provided "as is" without any warranties or guarantees. The authors and contributors of this repository do not make any representations or warranties, express or implied, regarding the accuracy, reliability, or completeness of the plugin or its suitability for any particular purpose.

MIT License: The Forex GPT plugin is released under the MIT License. Please refer to the LICENSE file for more details.

By using the Forex-Rates plugin, you acknowledge and agree to the above disclaimer and understand the associated risks of currency market trading, and the limitations of large language models (LLMs) such as Chat-GPT which may produce inaccurate information about people, places, or facts. The authors and contributors of this repository shall not be held responsible for any losses or damages incurred as a result of using the plugin.