Socket API Documentation

FCS provides unmatched, real time data Socket API.

Whats New in Socket V3

Socket version 3 improve performance and prices accurace.

    • Supports 270 Forex pairs and 200 Cryptocurrencies
    • Includes Ask and Bid prices
    • Supports 5-digit pricing
    • Provides Volume and Spread data

Socket - Real Time Updates

Before Socket Api, all developers were sending request every second on our server to get latest price. But now we introduce Socket API, Socket.io Is a JS library that helps you to connect with our server on realtime connection, Socket connection will reduce latency 5 minutes to 1 seconds.

Real time prices support around ~400 Forex currency and 200+ Crypto currency. Download supported list in excel file.

Support List

If you have no idea about Socket.io Please read here. Socket Docs

Live Demo

To use socket.io you need a little knowledge about JS, We allow socket connection from Server to Server AND Client Browser to our Server.

Example: How Frequently prices update with socket connection

Client Browser To Server Connection

If you want to get all real time pricing on your browser to show to your visitors. No special installation you need.
All guide are mention in socket_browser.js file.

Simple Socket Code and run index.html file in browser. View Live

Download JS

Skills Required

    • HTML (Good if you know)
    • JavaScript (Required)

Quick Code Guide

<script src="socket.io.js"<>/script>
<script>
  // API Key and Currency IDs Configuration
  const API_KEY = "API_KEY"; // Replace with your actual API KEY
  const CURRENCY_IDS = "1,2,3"; // Replace with your desired currency IDs
  
  // Socket connection function
  function socketConnection() {
    try {
      // Initialize socket connection
      const socket = io.connect("wss://fcsapi.com", {
        transports: ['websocket'],
        reconnection: true, // Enable automatic reconnection
        reconnectionAttempts: 5, // Limit reconnection attempts
        reconnectionDelay: 2000 // Wait 2 seconds between attempts
      });

      // Verify API Key
      socket.emit('heartbeat', API_KEY);

      // Join currency streams
      socket.emit('real_time_join', CURRENCY_IDS);

      // Listen for incoming data
      socket.on('data_received', (data) => {
        console.log("Data received:", data);
      });

      // Handle socket connection errors
      socket.on('connect_error', (error) => {
        console.error("Socket connection error:", error.message);
      });

      // Handle disconnections
      socket.on('disconnect', (reason) => {
        console.warn("Socket disconnected:", reason);

        if (reason === "io server disconnect") {
          socket.connect();
        }
      });
    } catch (error) {
      console.error("An error occurred in the socket connection:", error);
    }
  }

  // Start the socket connection
  socketConnection();
</script>

Server To Server Connection

If you want to get all real-time pricing directly on your server you need little knowledge about "JS", "Nodejs" and "cmd in windows OR terminal in Linux".
You need to install Nodejs on your windows/Linux Server, Create empty project folder, and run our server.js file in CMD/terminal. Download Server JS file.

If you have no idea about socket.io then we recommend you to learn "how to build simple Chat app with socket.io" After that, you will learn all skills that you need to run our code. Socket Docs.

Download Server JS

Skills Required

    • JavaScript (Required)
    • Socket.io (Good if you know)
    • NodeJS (Not required, just needs to be installed on your machine)

Installation Steps

    • Create your working directory.
    • Run the following command to install the required version of Socket.io:
      npm install socket.io@2.4.1
    • Start the socket connection by running:
      node server.js

If you are working on Java or C#, socket.io library easily available on internet, just find Socket.io library for your native language.
Check FCS socket+php code Github Here

Socket - Price Plan

Normal pricing plan on the pricing page does not include socket access, you need to contact us for socket connection access. Below are two plans for socket connection.

    • Advanced: Client Server To FCS Server connection, $100/month.
      Direct connection from browser to FCS server or any Application to FCS server is NOT allow. Only 1 connection allow from your machine,terminal or CMD to FCS.
      If you have 1000 visitors and you want to connect your all visitors with Socket connection then you need to provide them service from your own socket connection.
      You need to create your own nodejs/socket connection and then connect your Visitors with your server.

    • Premium: Client Browser To FCS server connection, $350/month.
      Direct connection from browser/Apps to FCS server is allow. With plan 1 you don't need your own nodejs or socket port connection, We allow you to connect your visitors directly with FCS server, Or you can directly access currency updates from browsers.

No difference between Starter, Advanced and Premium in Real-time updates except number of connection or restrictions limit.

Socket Data Example

Click below link to go to Example page, and press Start button to connect with socket.

Live Price Check
Socket + PHP Github
Download Browser JS
Download Server JS

Disclaimer

Prices, Market trends and signals are not designed for trading purpose, These signals are only for education or non-commercial purpose use. Data contained in this application/website is not necessarily real-time nor accurate and so prices may not be accurate and may differ from the actual market price, meaning prices are indicative and not appropriate for trading purposes. Therefore we doesn`t bear any responsibility for any trading losses you might incur as a result of using this data.
Latest price minimum refresh rate is 5 Seconds