Skip to main content

API types

This page will help you understand the two main protocols available for accessing financial data through TradeWatch: HTTP (Rest API) and WebSocket (Real-time data). We will explain the differences between these APIs and guide you in choosing the appropriate one for your specific needs.

Protocols Overview

HTTP (Rest API)WebSocket (Real-time data)
PurposeIdeal for on-demand queries, especially when specific data is required.Designed for long-lived connections that demand real-time updates.
UsageSuitable for fetching the latest financial instrument price or making a parameterized call, like acquiring historical data or converting from one instrument to another.By connecting to the WebSocket protocol and providing a list of symbols to monitor, the server establishes an active connection. When there is a price change for the specified instruments, the server pushes a message to notify the client immediately.

Choosing the Right Protocol

HTTP (Rest API)WebSocket (Real-time data)
When to UseIf your application necessitates on-demand data queries.If your application requires continuous real-time updates for specific instruments.
UsageQuick responses, ideal for occasional or one-off requests.Always-on connection, instant notifications on price changes, optimized for monitoring multiple instruments simultaneously.

Examples and Use Cases

HTTP (Rest API)WebSocket (Real-time data)
  • Fetch the current price of Bitcoin
  • Get historical price data of Apple stocks for the past year
  • Convert US Dollars to Euros using the latest conversion rate
  • Convert US Dollars to Euros using the latest conversion rate
  • Monitor price fluctuations of NASDAQ, Dow Jones, and S&P500 in real-time.
  • Track currency pairs like EUR/USD, GBP/USD for forex trading platforms.
  • Monitor multiple cryptocurrencies like Bitcoin, Ethereum, and Litecoin for instant trade decisions.

Conclusion

TradeWatch offers both HTTP and WebSocket protocols, each catering to distinct data retrieval requirements. By understanding the unique features of each protocol and aligning them with your specific needs, you can optimize your data access strategy, ensuring efficient and timely decisions based on the most accurate financial data.