Skip to content

Technical Indicator

Overview

Build the technical indicator dataset for OHLCV per fetch component

Specification:

  • Calculated on the flight

  • Reduced the time that serialization dataset

  • Supported over 200 indicators

Design

Technical Component

Endpoint

There are 3 endpoints

Endpoint: /quote/technical/indicator

Method: GET

Has authenticated: Yes

Params:

Param Type Description
ticker required, string Ticker for calculated the dataset
from_date datetime Datetime in ISO8601 format
to_date datetime Datetime in ISO8601 format
function list[str] The targeted functions of technical indicators to fetch

Note: to_date >= from_date

Example:

/quote/technical/indicator?ticker=AAA&function=SMA
        &argument=value&from_date=20231007&to_date=2023111
        |
        |__> If not exist, override by the default configuration()
Endpoint: /reference/technical/indicator

Method: GET

Has authenticated: Yes

Source: https://ta-lib.org/functions/

Schema:

Column Type Description
code string The code in upper case
description string The description of related function method

Returned:

Params:

Param Type Description
code string The code to search
keyword string The keyword can search on code or description
/reference/technical/indicator?code=SMA
/reference/technical/indicator?keyword=SMA

Transfer to component

Table: quote_technical

Schema:

Column Type Description
ticker string The ticker component
ts timestamp The datetime component in float mode
open float The open price
high float The high price
low float The low price
close float The close price
volume float The volume price

Design for small fetch the dataset component

Note: Inherit from fact_ohlcv_eod

Flow for calculation the design dataset

Flow to calculated the functional component dataset

flowchart LR

  %% Component
  params[Handle parameters]
  query[Query ticker quote with OHCLV\nwith full period]

  %% Flow
  params -- transfer --> query -- calculate --> on_the_flight

For code flow:

[0] Design mapping function

mapping_function: dict[str, Callable] = {
    "SMA": talib.sma(**args),
    "AD": tablib.build_ad,
}

[1] Query OHLCV (ticker) for full-period (event exists from_date and to_date)

  • For handle params:

  • Upper all case of functional

[2] Based on function list of user query, use mapping_function to fetch the callable to calculate the dataset

Example: SMA | OBV | VMA | CCI | Momentum | RSI

Note: This package come with C && numpy a

  • Using related talib function to calculated

  • Append to output dataset

[3] Filter on default component if available. E.g. filter by datetime

[4] Return with JSONResponse model instead using pydantic model because the different on calculated functions results

ticker, date, close -> SMA
ticker, date, close -> function: AD, upper_case, lower_case, ...

Note: Not returned the OHLCV element, just returned the calculated component

[1] Build dataset on marts at quote_technical on Lakeprep

[2] Schedule transfer into quote_technical on Spectrum

Source Reference

[1] C++ implement with TaLib at Official TALib documentation