# Command Line OpenD
# Step 1: Download
- You can download through moomoo official website.
# Step 2: Decompression
- Extract the file downloaded in the previous step and find the OpenD configuration file OpenD.xml and the program packaged data file Appdata.dat in the folder.
- OpenD.xml is used to configure the startup parameters of the OpenD program. If it does not exist, the program cannot start correctly.
- Appdata.dat is a large amount of data information the program needs to use, packaging data to reduce the time of downloading data while starting OpenD. If it does not exist, the program can not start correctly.
- Command line OpenD supports user-defined file paths, refer to Command line startup parameters。
# Step 3: Parameter Configuration
- Open and edit the configuration file OpenD.xml as the picture below. For general use, you only need to change your account and login password, and other options can be modified according to the instructions in the following table.
Configuration item list:
Configuration Item | Description |
---|---|
ip | listening address. |
api_port | API protocol receiving port. |
login_account | Login account. |
login_pwd | Login password in plaintext. |
login_pwd_md5 | Login password ciphertext (32-bit MD5 encrypted hexadecimal). |
Lang | Language. |
log_level | Log level of OpenD. |
push_proto_type | API protocol type. |
qot_push_frequency | API subscription data push frequency |
telnet_ip | Remote operation command listening address. |
telnet_port | Remote operation command listening port. |
rsa_private_key | API protocol RSA encrypted private key (PKCS#1) file absolute path. |
price_reminder_push | Whether to receive the price reminder. |
auto_hold_quote_right | Whether to automatically grab quote right after being kicked. |
future_trade_api_time_zone | Specify the futures trading API time zone. |
websocket_ip | WebSocket listening address. |
websocket_port | WebSocket service listening port. |
websocket_key_md5 | Key ciphertext (32-bit MD5 encrypted hexadecimal). |
websocket_private_key | WebSocket certificate private key file path. |
websocket_cert | WebSocket certificate file path. |
pdt_protection | Whether to turn on the Pattern Day Trade Protection. |
dtcall_confirmation | Whether to turn on the Day-Trading Call Warning. |
Tips
To ensure safety of your trading accounts, if the listening address is not local, you must configure a private key to use the trading interface. The quote interface is not subject to this restriction.
When the WebSocket listening address is not local, you need to configure SSL to start it, and a password should not be set during the certificate private key generation.
Ciphertext is represented in hexadecimal after plaintext is encrypted by 32-bit MD5, which can be calculated by searching online MD5 encryption (note that there may be a risk of records colliding with libraries calculated through third-party websites) or by downloading MD5 computing tools. The 32-bit MD5 ciphertext is shown in the red box area (e10adc3949ba59abbe56e057f20f883e):
OpenD reads OpenD.xml in the same directory by default. On MacOS, due to the system protection mechanism, OpenD.app will be assigned a random path at run time, so that the original path can not be found. At this point, there are the following methods:
- Execute fixrun.sh under tar package
- Specify the configuration file path with the command line parameter
-cfg_file
, as described below
The log level defaults to the info level. During the system development phase, it is not recommended to close the log or modify the log to the warning, error, fatal level to prevent failure to locate problems.
# Step 4: Command Line Startup
- On the command line, change the directory to the folder which OpenD is located, and run the following command to start Command Line OpenD with configuration from OpenD.xml.
- Windows:
OpenD
- Linux:
./OpenD
- MacOS:
./OpenD.app/Contents/MacOS/OpenD
- Windows:
Command Line Startup Parameters
You can also start with parameters on the command line, some of which are the same as the OpenD.xml configuration file. Parameter format:
-key=value
For example:- Windows:
OpenD.exe -login_account=100000 -login_pwd=123456 -lang=en
- Linux:
OpenD -login_account=100000 -login_pwd=123456 -lang=en
- MacOS:
./OpenD.app/Contents/MacOS/OpenD -login_account=100000 -login_pwd=123456 -lang=en
- Windows:
If the same parameters exist on both the command line and the configuration file, the command line parameters take precedence. For details of the parameters, please see the following table:
parameter list:
Configuration Item | Description |
---|---|
login_account | Login account. |
login_pwd | Plaintext of login password. |
login_pwd_md5 | Login password ciphertext (32-bit MD5 encrypted hexadecimal). |
cfg_file | The absolute path of OpenD configuration file. |
console | Whether to display the console. |
lang | OpenD language |
api_ip | API service listening address. |
api_port | API listening port. |
help | Output startup command line parameters and exit the program. |
log_level | Log level of OpenD. |
no_monitor | Whether to start the daemon. |
websocket_ip | WebSocket listening address. |
websocket_port | WebSocket service listening port. |
websocket_private_key | WebSocket certificate private key file path. |
websocket_cert | WebSocket certificate file path. |
websocket_key_md5 | Key ciphertext (32-bit MD5 encrypted hexadecimal). |
price_reminder_push | Whether to receive the price reminder. |
auto_hold_quote_right | Whether to automatically grab quote right after being kicked. |
future_trade_api_time_zone | Specify the futures Trade API time zone. |
:::