This tutorial shows you how to ingest real-time time-series data into TimescaleDB using a websocket connection. The tutorial sets up a data pipeline to ingest real-time data from our data partner, Twelve Data. Twelve Data provides a number of different financial APIs, including stock, cryptocurrencies, foreign exchanges, and ETFs. It also supports websocket connections in case you want to update your database frequently. With websockets, you need to connect to the server, subscribe to symbols, and you can start receiving data in real-time during market hours.

When you complete this tutorial, you'll have a data pipeline set up that ingests real-time financial data into your Timescale.

This tutorial uses Python and the API wrapper library provided by Twelve Data.

Before you begin, make sure you have:

This tutorial covers:

  1. Setting up your dataset: Load data from Twelve Data into your TimescaleDB database.

  2. Querying your dataset: Create candlestick views, query the aggregated data, and visualize the data in Grafana.

    This tutorial shows you how to ingest real-time time-series data into a Timescale database using a websocket connection. To create candlestick views, query the aggregated data, and visualize the data in Grafana.

The financial sector regularly uses candlestick charts to visualize the price change of an asset. Each candlestick represents a time period, such as one minute or one hour, and shows how the asset's price changed during that time.

Candlestick charts are generated from the open, high, low, close, and volume data for each financial asset during the time period. This is often abbreviated as OHLCV:

  • Open: opening price
  • High: highest price
  • Low: lowest price
  • Close: closing price
  • Volume: volume of transactions

candlestick

TimescaleDB is well suited to storing and analyzing financial candlestick data, and many Timescale community members use it for exactly this purpose.

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.