Skip to content

fxcm/ForexConnectAPI

Repository files navigation

ForexConnectAPI

This SDK is designed to get trading data, trade, load price histories and subscribe for the most recent prices. It is intended to be used by FXCM clients on auto-trading robots and systems, chart and market analysis application, custom trading application on FXCM accounts.

Forex Connect supports C++, C#, Java, VB, VBA, Windows, Linux and smart phones. And it is free.

You can use ForexConnect on Trading station account, no extra setup required.

If using O2G2 namespace, keep in mind that it is currently deprecated as it has not been updated since the beginning of 2015. It may give the users errors or not be compatible in certain cases.

How to start:

  1. A FXCM TSII account. You can apply for a demo account here.
  2. Download ForexConnect SDK
  3. Examples codes and documents are at ForexConnectAPI packages after installed.
  4. Online documents: Getting Started
  5. ForexConnect with Matlab, at here.
  6. ForexConnect sample code for Android/iOS/macOS/Python/Linux/Windows, at here.
  7. ForexConnect on Python at here

Connect parameters:

  1. URL="www.fxcorporate.com/Hosts.jsp"
  2. Username="you username"
  3. Password="your password"
  4. Connection="demo"
  5. You can ignore SessionID and PIN

Suggested Popular Development Platform IDE:

Windows 32bit and 64bit – Visual Studio 2005 and up

Linux 32bit and 64bit – Eclipse

iOS – Xcode

Android - Android Studio

Table manager vs Non-table manager:

Table manager preload all tables to your local memoery, it is an in-memory representation of API tables. The table manager allows you to subscribe to table change events such as updates, adding rows, or removing rows. It is important to note that the SummaryTable is only accessible through the table manager.
Table manager presents a performance decrease because it is constantly recalculating fields. Non-table manager allow you to capture table updates adhoc via the use of a class that implements theIO2GResponseListener interface. It give performance advantage but you need to calculate some fields such as PipCost or P/L.

How to get current balance?

You need to request the table from server. please refer to NonTableManagerSamples/PrintTable example program.

  private static O2GAccountRow GetAccount(O2GSession session)
  {
      O2GResponseReaderFactory readerFactory = session.getResponseReaderFactory();
      if (readerFactory == null)
      {
          throw new Exception("Cannot create response reader factory");
      }
      O2GLoginRules loginRules = session.getLoginRules();
      O2GResponse response = loginRules.getTableRefreshResponse(O2GTableType.Accounts);
      O2GAccountsTableResponseReader accountsResponseReader = readerFactory.createAccountsTableReader(response);
      for (int i = 0; i < accountsResponseReader.Count; i++)
      {
          O2GAccountRow accountRow = accountsResponseReader.getRow(i);
          Console.WriteLine("AccountID: {0}, Balance: {1}", accountRow.AccountID, accountRow.Balance);
      }
      return accountsResponseReader.getRow(0);
  }

How to get price history:

For pricehistory, you need to use non-table manage. You can see examples under NonTableManagerSamples/GetHistPrices

Real Case Study:

  1. Learn how to build and backtest Rsi signals using ForexConnect API at here.
  2. Learn how to build and backtest CCI Oscillator strategy using ForexConnect API at here.
  3. Learn how to build and backtest Breakout strategy using ForexConnect API at here.
  4. Learn how to build and backtest Range Stochastic Strategy using ForexConnect API at here.
  5. Learn how to build and backtest Mean Reversion Strategy using ForexConnect API at here.
  6. Some examples like attached stop limit to position, create if-then ELS order, get rollover at here.
  7. ForexConnect with Matlab, is coming....
  8. Using ForexConnect downloading historical data at here.

Note:

o This is for personal use and abides by our EULA

o For more information, you may contact us: api@fxcm.com

Release Note:

Our price streams are moving from http to https using TLSv1.2 since 6/16/2019, to increase security on our price servers. Please make sure client side software is compatible with TLSv1.2. Clients use ForexConnect API, Java API will be affected. The error you will get: ‘Can't connect to price server.’ if you have any questions, please reach out to api@fxcm.com.

Due to security enhancement on our server side, http request by ForexConnect API users need switch to https.

End user need to upgrade their FC API package on their side. First round release will target to demo environments this coming weekend. 5/1/2021 This release to demo target at 7/9/2021

the above release to live will target in mid-end August/2021.

Please make sure you are ready. Please send mail to api@fxcm.com if you have any questions.

please upgrade the latest version at

https://pypi.org/project/forexconnect/

https://fxcodebase.com/wiki/index.php/Download

Performance improvment release

We did some performance improvement and released to Demo. It should transparent to API users.

However, you are welcome to test your current setting on Demo and contact api@fxcm.com if you experience any issues.

If everything goes well, we plan to release to Production by the end of next week. Dec 17 2022.

Disclaimer:

High Risk Investment Notice:

The FXCM Group is a holding company of Forex Capital Markets Limited (FXCM LTD), FXCM EU LTD (FXCM EU), FXCM Australia Pty. Limited (FXCM AU), FXCM South Africa (PTY) Ltd (FXCM ZA), FXCM Markets Limited (FXCM Markets), and all affiliates of aforementioned firms, or other firms under the FXCM Group of companies [collectively “FXCM”]. The FXCM Group is headquartered at 20 Gresham Street, 4th Floor, London EC2V 7JE, United Kingdom. Read and understand the Terms and Conditions on the FXCM Group’s websites prior to taking further action.

FXCM LTD: CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 69% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money. FXCM LTD is authorised and regulated in the UK by the Financial Conduct Authority. Registration number 217689. Registered in England and Wales with Companies House company number 04072877.

FXCM EU: CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 77% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money. FXCM EU is a Cyprus Investment Firm (“CIF”) registered with the Cyprus Department of Registrar of Companies (HE 405643) and authorised and regulated by the Cyprus Securities and Exchange Commission (“CySEC”) under license number 392/20.

FXCM AU: By trading, you could sustain a total loss of your deposited funds. The products may not be suitable for all investors. Please ensure that you fully understand the risks involved. If you decide to trade products offered by FXCM AU, you must read and understand the Financial Services Guide, Product Disclosure Statement, and Terms of Business. FXCM AU is regulated by the Australian Securities and Investments Commission, AFSL 309763. FXCM AU ACN: 121934432. The information provided by FXCM AU is intended for residents of Australia and is not directed at any person in any country or jurisdiction where such distribution or use would be contrary to local law or regulation. Please read the full Terms and Conditions.

FXCM Markets: Losses can exceed deposited funds. FXCM Markets is incorporated in Bermuda as an operating subsidiary within the FXCM group and is not required to hold any financial services license or authorisation in Bermuda to offer its products and services.

Past Performance: Past Performance is not an indicator of future results.

About

Designed to trade, retrieve live/history price. Intended to be used to build auto-trading robots, custom trading on FXCM accounts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages