# OpenD Related
# Q1: OpenD automatically exited due to failure to complete "Questionnaire Evaluation and Agreement Confirmation"
A: You need to carryout relevant questionnaire evaluation and agreement confirmation before you can use OpenD. Please go to complete.
# Q2: OpenD exited due to "the program's own data does not exist"
A: Generally, the copy of the own data fails due to permission problems. You can try to copy the file extracted from Appdata.dat in the program directory to the program data directory.
- Windows program data directory:
%appdata%/com.moomoo.OpenD/F3CNN
- Non-windows program data directory:
~/.com.moomoo.OpenD/F3CNN
# Q3: OpenD service failed to start
A: Please check:
- Whether there are other programs occupying the configured port;
- Is there a OpenD configured with the same port already running?
# Q4: How to verify the mobile phone verification code?
A: On the OpenD interface or remotely to the Telnet port, enter the command ʻinput_phone_verify_code -code=123456`.
Tips
- 123456 is the mobile phone verification code received
- there is a space before '-code=123456'
# Q5: Are other programming languages supported?
A: OpenD provides a socket-based protocol. Currently we provide and maintain Python, C++, Java, C# and JavaScript interfaces, download entry.
If the above languages still cannot meet your needs, you can connect to the Protobuf protocol by yourself.
# Q6: Verify the device lock multiple times on the same device
A: The device ID is randomly generated and stored in the \com.moomoo.OpenD\F3CNN\Device.dat file.
Tips
- If the file is deleted or damaged, OpenD will regenerate a new device ID and then verify the device lock.
- In addition, users of mirror copy deployment need to be aware that if the Device.dat content of multiple machines is the same, it will also cause these machines to verify the device lock multiple times. Delete the Device.dat file to solve it.
# Q7: Does OpenD provide a Docker image?
A: Not currently available.
# Q8: Can one account log in to multiple OpenD?
A: One account can log in to OpenD or other client terminals on multiple machines, and up to 10 OpenD terminals are allowed to log in at the same time. At the same time, there is a restriction of "market kicking", and only one OpenD can obtain the highest authority market. For example, if two terminals log into the same account, there can only be one HK stock LV2 quotation and the other HK stock BMP quotation.
# Q9: How to control the market permissions of OpenD and other clients (desktop and mobile)?
A: In accordance with the regulations of the exchange, there will be a restriction on “market kicking” when multiple terminals are online at the same time, and only one terminal can obtain the highest authority market. The auto_hold_quote_right parameter is built-in in the startup parameters of the command line version of OpenD, which is used to flexibly configure market permissions. When this parameter option is enabled, OpenD will automatically retrieve it after the market permission is robbed. If it is robbed again within 10 seconds, other terminals will obtain the highest market quotation authority (OpenD will not rob again).
# Q10: How to give priority to the OpenD market authority?
A:
- Configure the OpenD startup parameter auto_hold_quote_right to 1;
- Make sure not to grab the highest authority twice in a row within 10 seconds on the mobile or desktop moomoo (login counts once, and click "Restart Quotes" to count the second time).
# Q11: How to give priority to the market authority of the mobile terminal (or desktop terminal)?
A: Set OpenD startup parameter auto_hold_quote_right to 0, and login with mobile or PC moomoo after OpenD.
# Q12: Use the Visualization OpenD to remember the password to log in. After a long time hang up, it prompts that the connection is disconnected. Do I need to log in again?
A: Using the Visualization OpenD, if you choose to remember the password to log in, you will use the token recorded locally. Due to the time limit of the token, when the token expires, if there is network fluctuation or moomoo background release, it may cause the situation that it cannot be automatically connected after disconnecting from the background. Therefore, if you want visiulization OpenD for a long time to hang up, it is recommended to manually enter the password to log in, and OpenD will automatically handle this situation.
# Q13: How to ask R&D staff to assist in troubleshooting when problems that cannot be solved are encountered?
A:
Contact OpenAPI developers via QQ/WeChat to facilitate instant communication and file transferation.
Detailed description: the time when the error occurred, OpenD version number, moomoo API version number, script language name, interface name or protocol number, short code or screenshot with detailed input and return.
If necessary, OpenD log must be provided to facilitate location and confirmation of problems. Transaction issues require info log level, and market issues require debug log level. The log level log_level can be configured in OpenD.xml Configure. After configuration, OpenD needs to be restarted to take effect. After the problem recurs, package the log and send it to moomoo R&D personnel.
Tips
The log path is as follows:
windows: %appdata%/com.moomoo.OpenD/Log
Non-windows: ~/.com.moomoo.OpenD/Log
# Q14: Script cannot connect to OpenD
A: Please try to check first:
- Whether the port connected by the script is consistent with the port configured by OpenD.
- Since the upper limit of OpenD connection is 128, is there any useless connection that is not closed?
- Check whether the listening address is correct. If the script and OpenD are not on the same machine, the OpenD listening address needs to be set to 0.0.0.0.
# Q15: Disconnected after being connected for a while
A: If it is a self-docking protocol, check whether there is a regular heartbeat to maintain the connection.
# Q16: I can't connect to OpenD when I run Python scripts in multiprocessing mode through the multiprocessing module under Linux?
A: After the process is created by default in the Linux/Mac environment, the thread created inside py-moomoo-api in the parent process will disappear in the child process, resulting in an internal program error. You can use spawn to start the process:
import multiprocessing as mp
mp.set_start_method('spawn')
p = mp.Process(target=func)
2
3
# Q17: How to log in to two OpenD at the same time on one computer?
A: Visualization OpenD does not support, but Command Line OpenD supports.
- Unzip the file downloaded from the official website, and copy the entire Command Line OpenD folder (e.g. moomoo_OpenD_5.2.1408_Windows). Take Windows as an example, other systems can do the same operation.
- Configure two OpenD.xml files that are placed in two Command Line OpenD folders. Configure items as follow:
Configuration file 1: api_port = 11111, login_account = Login Account 1, login_pwd = Login Password 1
Configuration file 2: api_port = 11112, login_account = Login Account 2, login_pwd = Login Password 2
- Run the two OpenD.exe.
- When calling the interface, note that the parameter
port
(OpenD listening address) should corresponds to the parameterapi_port
in the OpenD.xml file.
For example:
from moomoo import *
# Send requests to OpenD logged in account 1
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111, is_encrypt=False)
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
# Send requests to OpenD logged in account 2
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11112, is_encrypt=False)
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
2
3
4
5
6
7
8
9
# Q18: How do I execute the operation and maintenance commands for grabbing permissions through scripts when the market permission is kicked off by other clients?
A:
- Configure Telnet address and Telnet port.
- Start OpenD (it will also start Telnet).
- After finding that the market quotation authority has been robbed, you can refer to the following code example and send the
request_highest_quote_right
command to OpenD via Telnet.
from telnetlib import Telnet
with Telnet('127.0.0.1', 22222) as tn: # Telnet address is: 127.0.0.1, Telnet port is: 22222
tn.write(b'request_highest_quote_right\r\n')
reply = b''
while True:
msg = tn.read_until(b'\r\n', timeout=0.5)
reply += msg
if msg == b'':
break
print(reply.decode('gb2312'))
2
3
4
5
6
7
8
9
10
# Q19: OpenD automatic upgrade failed
A:
The automatic update of OpenD failed to be executed by the update
command. Possible reasons:
- The file is occupied by other processes: you can try to close other OpenD processes, or restart the system and execute
update
again If the above still cannot be solved, you can download the update by yourself through Official Website.
# Q20: Fail to launch the visualization OpenD on ubuntu22?
A:
When running the visualization OpenD on certain Linux distributions (such as Ubuntu 22.04), you may encounter the error: dlopen(): error loading libfuse.so.2
. This occurs because libfuse is not installed by default on these systems. Typically you can resolve this issue by installing libfuse manually. For example, you can install it via the commane line on Ubuntu22.04 with:
sudo apt update
sudo apt install -y libfuse2
2
Once successfully installed, you will be able to run the visualization OpenD normally. Please refer to https://docs.appimage.org/user-guide/troubleshooting/fuse.html for more details.