How To Check Your Streaming API Key Using Browser Extension
05 January 2023
Many users prefer obtaining forex data via WebSockets, as they need lightning-fast, real-time price feeds. Your WebSocket Key or Streaming API Key is the primary requirement to access real-time data feed. We will learn how to get a Streaming API Key and how to check if it works by using a browser extension.
Simple Steps to Check if Streaming API Key Works
Let us begin by understanding how you can obtain your Streaming API Key by starting your 14-day free WebSocket trial:
Sign-Up To Get Started
You can sign-up by clicking on https://tradermade.com/signup.
After logging in using your credentials, you will be taken to our dashboard. It serves as a single-point reference for your REST API Key, Streaming API Key, your WebSocket data or other subscription plans, Trials, and purchases from our portal.
Image 1: User Dashboard
Get Your Streaming API Key
As you log in using your credentials, you can see your dashboard, which is similar to the image above. To get your Streaming API Key, click the START WEBSOCKET TRIAL button (marked in red in the above screenshot). You will see a Thank You message page, which looks like this:
Image 2: Thank You Message
You will receive an automated welcome email (as shown in the image below).
Image 3: Welcome Email
As you click on the DASHBOARD button within that email, you will be redirected to the WebSocket Subscription page like this:
Image 4: Streaming API Key on Dashboard
You can see a notification on the top left of your dashboard confirming the initialization of your Streaming Trial (As shown in the green box in the above image). On the bottom right, under the 'Live Streaming Plan' segment, you can see your Streaming API Key.
Please keep this Streaming API Key in a safe place. In the next steps, you will need it to fetch live streaming data.
Download the Required Chrome Extension
To check if your WebSocket API Key is working, install the Simple WebSocket Client Chrome extension available on the Chrome Web Store. You can click on the link to open the Simple WebSocket Client extension. As you open this webpage in your web browser, please click the Add to Chrome button to download the Chrome extension.
Image 5: Simple WebSocket Client Extension
To move further, please keep the Simple WebSocket Client Chrome extension and our WebSocket Documentation page open in your web browser.
Steps to Check Your WebSocket Key
Now, let us understand some simple steps to check your Streaming API Key in your web browser. As mentioned above, as you open the Simple WebSocket Client, it looks like this:
Image 6: Simple WebSocket Client Extension Page on Browser
Establish a Connection
As you open our WebSocket documentation page, you can find the WebSocket Address (URL), as shown below:
Image 7: WebSocket URL on Documentation Page
Enter the URL using the protocol shown below. Use the URL box as shown in image 6 above. Then, click the Open button to connect with the TraderMade web server.
wss://marketdata.tradermade.com/feedadv
You will see a Connected message in the Message Log, denoted by the red rectangle in Image 8 below. As you receive the Connected message, it indicates that your WebSocket ws connection has been successfully established after a successful WebSocket handshaking.
Image 8: Connected Message on Simple WebSocket Client
Please note that an HTTP/1.1 host provides a special mechanism for protocol upgrades. This mechanism can upgrade an already established connection to a different protocol. However, we will leverage the wss URL provided in the WebSockets Data Documentation page here to support WebSocket for bilateral, real-time data flow.
Send Your Request
You can find the command line you need to send as a request on our WebSocket Documentation page, marked in red in the below image:
Image 9: Command for Request on WebSocket Documentation Page
You need to enter the WebSocket API Key you obtained earlier, replacing Use Your Streaming API Key. Similarly, you can choose the desired currency pair symbols to check if you get real-time rates. I am using EURUSD and GBPUSD for this example.
Importantly, you need to type the following command line (with your Streaming API Key and desired currency pairs) in the Request box in Image 8 above. Then, click the Send button.
{"userKey":"streaming_api_key", "symbol":"EURUSD,GBPUSD"}
Get Real-Time Forex Prices
As you click the Send button, you should receive a response showing a lightning-fast real-time Bid, Ask, and mid-price feed of the currency pairs you entered in the request (marked in green in the image below). Please note that the response appears in the Message Log denoted by the blue rectangle in the below image.
Here, the WebSocket Object helps you create and manage a WebSockets connection to the web server. That way, as the connection is established, you start sending and receiving data on that connection.
Image 10: Real-Time Forex Rates
If you get the real-time rates, it implies that your WebSocket Key is working. You receive timestamps, along with the bid, ask, and mid-real-time rates for both EURUSD and GBPUSD currency pairs. Thus, through the WebSocket protocol, a real-time connection between client and server is set to convey live streaming rates of the desired currency pairs.
Please note that you should click the Close button before sending another request.
Whenever you connect and send a request, a full-duplex, bilateral connection is activated through the WebSocket protocol through an underlying TCP connection, enabling real-time to and fro communication between a web client and a web server.
We hope you can check your Streaming API Key following the simple steps covered in this tutorial.
For any technical queries and suggestions, please feel free to contact us through email or live chat. Our market data experts are keen to hear from you and are happy to resolve your queries.