Deployment of RWManager
Using PowerShell all variable values ​​must be specified in single 'quotes'.
For run of RWManager you need to set ENV variables:
LOG_FILE_NAME
C:\rw-manager\rw-manager-mt5.log
full path name for log file
LOG_METATRADER
true
if the flag is true, all logs messages will be placed to a file created by MetaTrader5SDK dll files after successefull connection to MT5 server
LOG_LEVEL
debug
Sets the Logger's log level using a symbolic value. Valid values are:
none (turns off logging)
fatal
critical
error
warning
notice
information
debug
trace
GRACEFUL_SHUTDOWN_TIMEOUT
15
time in seconds that RW-Manager will wait for connected clients to close all connections before shutdown and exit after receiving a graceful shutdown notification from the operation system
MT5SDKLIBS
C:\rw-manager\MetaTrader5SDK\Libs
Path to your rw-manager folder + MetaTrader5SDK\Libs (required)
MT5SERVER
0.0.0.0:443
Address for authorization and communication with MT5 (required)
MT5PASS
pass1111,pass2222,pass3333
String of passwords for authorization in MT5 (required) separarted by comma. It must correspond with MT5LOGIN: the first password corresponds to the first login, the second password corresponds to the second login and etc.
MT5LOGIN
1111,2222,3333
String of logins for authorization in MT5 (required) separarted by comma. It must correspond with MT5PASS: the first login corresponds to the first password, the second login corresponds to the second password and etc.
LISTEN_ADDRESS
127.0.0.1
Address to listen incoming requests
LISTEN_PORT
8080
Port to listen incoming requests
HEALTH_ENDPOINT
healthz
Endpoint path to check available service in k8s
METRICS_PORT
7777
Port for getting metrics for prometheus
INTERNAL_GATEWAY
5432
Port for communicate with Trading Gateway
APP_ID
1
APP id for communicate with Trading Gateway
MAX_INPUT_QUEUE_SIZE
128
Max number of record in queue for streaming processing
MAX_SAVE_TRADE_REQUEST
3
Max number of trades stored in a cash for streaming function GetLastTradeRequests
MT5_NUM_CONNECTIONS
3
Max number of connections handled by service to MT5 data sync
NATS_SERVICES_SUBJECT
RW-MANAGER
Name that will be used to form name of JetStream in NATS
NATS_HOSTS
127.0.0.1:4222
Address of nats-jet stream server with a port; if not defined or equal to the empty string, then the service will not initialize the connection with NATS JetStream
NATS_USER
nats_user
Name of user that used for nats-jet-stream connections; if not defined or equal to the empty string then connection to NATS will be made without authorization
NATS_PASSWORD
nats_password
User nats password used for nats-jet-stream connections
CLIENT_CERT_FILE
C:\certificate\client_cert.pem
Client certificate for NATS TLS connection
CLIENT_KEY_FILE
C:\certificate\client_key.pem
Client key for NATS TLS connection
ROOT_CA_CERT_FILE
C:\certificate\ca_cert.pem
Root certificate for NATS TLS connection
SERVER_CODE
mt5_trial1
server code that used in forming nats-jet-stream subject, shoud be alligned with account_config.json; if not defined then equal to "UNKNOWN"
LOG_FILE_NAME
C:\rw-manager\logs
all logs generated by RW-MANAGER will be written to this file; if LOG_FILE_NAME is not specified or contains an empty line, then logging is performed in the system console
FILTER_PERIOD
1000
time in ms, that define time filtering period for filtered ticks subscription (TicksFilteredSubscribe), by default the value is equal to 1000 ms
MAX_SOCKET_CONNECTION
1000
numbers that define maximum number of concurrent socket connections, in case of number of connection is excited this number rw-manager is generating http error code 429 Too Many Requests
IS_STREAM_TICKS
TRUE (by default)
enables receiving ticks stream from MT5
IS_STREAM_ORDERS
TRUE(by default)
enables receiving orders stream from MT5
IS_STREAM_DEALS
TRUE (by default)
enables receiving deals stream from MT5
IS_STREAM_POSITIONS
TRUE (by default)
enables receiving positions stream from MT5
IS_STREAM_SYMBOLS
TRUE (by default)
enables receiving symbols update stream from MT5
IS_STREAM_USER_ACCOUNTS
TRUE (by default)
enables receiving user accounts update stream from MT5
IS_STREAM_USERS
TRUE (by default)
enables receiving users update stream from MT5
IS_STREAM_GROUPS
FALSE(by default)
enables receiving groups update stream from MT5
IS_STREAM_MAILS
FALSE(by default)
enables receiving emails stream from MT5
IS_STREAM_NEWS
FALSE(by default)
enables receiving news stream from MT5
IS_DEBUG_TRADES
FALSE(by default)
a boolean flag to inform system to log all events from MetaTrader regarding changes in Positions/Deals/Orders
IS_DEBUG_ORDERS
FALSE(by default)
a boolean flag to inform the system to log trading requests from client
INSTANCE_ID
i-instance-id
an ID of the instance
TICK_DELAY_ACCEPTED
0
A delay in milliseconds (ms) is specified for price tick processing. The system converts the timestamp of a new tick to GMT time and adds the TICK_DELAY_ACCEPTED value to it. If the resulting timestamp is greater than the current system GMT time, the tick is processed; otherwise, it is ignored.
When TICK_DELAY_ACCEPTED is set to 0, the filtering mechanism is disabled.
During the server restart all files placed to folder bases should be removed in order to ensure that all cached would not impact of processing request to RW Manager.
It is very mportant to write the variable METRICS_PORT and to use it in Prometheus for getting metrics from RWManager.
RWManager is working on Windows 64 container.
To deploy RWManager you should use the folowing scripts:
where app1, app2, app3 are the names of the system modules.
Checking availibility of RW-Manager
In order to check that RW-Manager is up and runnig the following operation can be executed:
to check availability of services curl --location 'base_url/server-time' - correct response should have status 200 and body contains of json object with server time.
Restart of RW-Manager
RW Manager uses MetaQuotes Library to perform connections to the MetaTrader 5 server. This library implements some caching techniques for groups and symbol representation on the local drive where RW Manager started (in the folder ‘bases’). As a result, it is highly recommended to restart RW Manager when:
configuration for a Symbol was changed, for example (Margin Call, Stop Out, Commission Settings and others)
configuration for a Group was changed, for example (Execution Type, Margin Currency, Margin Settings, Trading Sessions, and others)
configuration for a Group Symbol was changed, for example (Spread Markup, Commission Settings).
Also, it is a good practice to restart RW Manager during the rollover period to request the latest MetaTrader 5 configurations.
During the server restart all files placed to folder bases should be removed in order to ensure that all cached would not impact of processing request to RW Manager
It is better to restart RW-Manager in any changes of symbol parameter to avoid the problem of data caching by the MT5APIManager64.dll library. (Also you can read about it here)
Last updated