Sign inSign up

ostai/futuopend

By ostai

•Updated 12 months ago

[真正可用] Docker image for FutuOpenD, the one that really works and could handle SMS OTPs.

Image
Integration & delivery
API management
0

3.0K

ostai/futuopend repository overview

中文版⁠

⁠Docker Image: ostai/ FutuOpenD

Build Status Coverage

Docker image for FutuOpenD on Ubuntu, the one that really works and could handle SMS verification requests.

The container will start

  • A FutuOpenD agent
  • A websocket server which could help to check the ready status of the FutuOpenD agent and make it possible for you to provide SMS verfication code.

The image is always built with DOCKER_DEFAULT_PLATFORM=linux/amd64 (why?⁠) and could be docker-run on both Ubuntu and MacOS.

⁠Install

# Recommended (to pull an image by providing specific tag name)
docker pull ostai/futuopend:9.2.5208

Or

docker pull ostai/futuopend:latest

⁠Lastest FutuOpenD Image Version

9.2.5208_Ubuntu16.04

Other versions⁠

⁠Usage

⁠Environment Variables
  • FUTU_LOGIN_ACCOUNT string required
  • FUTU_LOGIN_PWD_MD5 string required
  • FUTU_LOGIN_REGION string defaults to sh
  • FUTU_LANG string defaults to chs
  • FUTU_LOG_LEVEL string defaults to no
  • FUTU_PORT integer the port of the FutuOpenD, defaults to 11111
  • SERVER_PORT integer the port of the websocket server, defaults to 8000
  • FUTU_INIT_ON_START string="yes" whether it will initialize the Futu OpenD agent on the start, defaults to "yes"
⁠Docker Run: How to start the container
docker run \
--name FutuOpenD \
-e "SERVER_PORT=8081" \
-p 8081:8081 \
-p 11111:11111 \
-e "FUTU_LOGIN_ACCOUNT=$your_futu_id" \
-e "FUTU_LOGIN_PWD_MD5=$your_password_md5" \
ostai/futuopend:latest
⁠WebSocket Server
const {WebSocket} = require('ws')

const ws = new WebSocket('ws://localhost:8081')

ws.on('message', msg => {
  const data = JSON.parse(msg)

  if (data.type === 'REQUEST_CODE') {
    ws.send(JSON.stringify({
      type: 'VERIFY_CODE',
      code: '12345'
    }))
    return
  }

  if (data.type === 'STATUS') {
    console.log('status:', data.status)
    return
  }
})

ws.on('open', () => {
  ws.send(JSON.stringify({
    type: 'STATUS'
  }))

  // If env FUTU_INIT_ON_START=no, we need to manually init futu
  ws.send(JSON.stringify({
    type: 'INIT'
  }))
})

Both downstream and upstream messages are in JSON type.

⁠Downstream Messages: From Server to Client
{
  "type": "REQUEST_CODE"
}

which means the FutuOpenD agent requires you to provide an SMS verification code

{
  "type": "CONNECTED"
}

which means the FutuOpenD agent is connected

{
  "type": "STATUS",
  "status": -1
}

The server returns the current status to you.

⁠Upstream Messages: From Client to Server
{
  "type": "INIT"
}

Tells the server to initialize the Futu OpenD agent, which only works when FUTU_INIT_ON_START is set to 'no'

{
  "type": "STATUS"
}

Asks the server to response the current status of the server

{
  "type": "VERIFY_CODE",
  "code": "123456"
}

Submits the SMS verification code to Futu OpenD agent.

⁠For contributors

⁠How to build your own image

export VERSION=9.2.5208
export FUTU_VERSION=${VERSION}_Ubuntu16.04
TAG=ostai/futuopend


docker build -t $TAG:$VERSION \
  --build-arg FUTU_VERSION=$FUTU_VERSION \
  .

For example:

docker build -t ostai/futuopend:${VERSION} \
  --build-arg FUTU_VERSION=${FUTU_VERSION} \
  .

Tag summary

Content type

Image

Digest

sha256:2334cf1d9…

Size

122.8 MB

Last updated

12 months ago

docker pull ostai/futuopend