Futu (futu v1.1.1)

Futu Elixir API Client

Link to this section Summary

Functions

1004 KeepAlive Cast for the heartbeat, no reply This function will execute in Futu.GenServer automatically

3103 Qot_RequestHistoryKL

1001 InitConnect This function will execute in Futu.GenServer automatically

This is the main function of intereacting Futu TCP client. Three steps here

Refer to historical/1, I don't like the function name

Link to this section Functions

Specs

heartbeat() :: binary()

1004 KeepAlive Cast for the heartbeat, no reply This function will execute in Futu.GenServer automatically

Link to this function

historical(list)

Specs

historical(list()) :: {:ok, any()} | {:error, bitstring()}

3103 Qot_RequestHistoryKL

Paramters

required:

  • period, checkout Futu.Quote.Historical.period/1
  • market, checkout Futu.Quote.Historical.market/1
  • code, e.g. 1

optional:

  • rehab, checkout Futu.Quote.Historical.rehab/1
  • from, default ~N[1999-01-01 00:00:00]
  • to, default now
  • max_rows, integer
  • next_page_key, if it's included from the last response
  • extended_time, boolean, to get the pre-market and after-hours data of US stocks, only supports timeframe of 1-minute

Specs

init_connect() :: {:ok, any()} | {:error, bitstring()}

1001 InitConnect This function will execute in Futu.GenServer automatically

Link to this function

request(module, opts)

Specs

request(module(), list()) :: {:ok, any()} | {:error, bitstring()}

This is the main function of intereacting Futu TCP client. Three steps here:

  1. build request: opts -> module.encode/1 -> Request.build/3
  2. send tcp message by GenServer
  3. parse response: tcp_reply -> Response.parse/2 success -> module.decode/1
             success
             request failure
    header failure
Link to this function

request_history_kl(list)

Specs

request_history_kl(list()) :: {:ok, any()} | {:error, bitstring()}

Refer to historical/1, I don't like the function name