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.
docker pull ostai/futuopend:latest
Or
docker pull ostai/futuopend:8.8.4818
8.8.4818_Ubuntu16.04
- FUTU_LOGIN_ACCOUNT
string
required - FUTU_LOGIN_PWD_MD5
string
required - FUTU_LOGIN_REGION
string
defaults tosh
- FUTU_LANG
string
defaults tochs
- FUTU_LOG_LEVEL
string
defaults tono
- FUTU_PORT
integer
the port of the FutuOpenD, defaults to11111
- SERVER_PORT
integer
the port of the websocket server, defaults to8000
- FUTU_INIT_ON_START
string="yes"
whether it will initialize the Futu OpenD agent on the start, defaults to"yes"
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
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.
{
"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.
{
"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.
TAG=ostai/futuopend
VERSION=8.8.4818
FUTU_VERSION="$VERSION"_Ubuntu16.04
docker build -t $TAG:$VERSION \
--build-arg FUTU_VERSION=$FUTU_VERSION \
.
For example:
docker build -t ostai/futuopend:8.8.4818 \
--build-arg FUTU_VERSION=8.8.4818_Ubuntu16.04 \
.