Skip to content

Multiple Terminals

You can launch multiple instances of the Theta Terminal. This is useful if you need to isolate a streaming (FPSS) instance from a query-based (MDDS) instance. You can also have a Theta Terminal connected to our test server, so you have something to develop on while the other one is servicing an automating trading system.

Limitations & Behavior

You are unable to connect to the same MDDS or FPSS server. Doing so will kick any existing connection from the server.

Launch Multiple Instances.

A Theta Terminal instance has a unique ID. Below is an example of the regular method of launching the terminal. The default terminal id is 0. The terminal ID corresponds to a config file that is named config_%terminal_id%. The full path to the config file is printed when you launch the terminal.

Typical terminal launch that uses config_0:

java -jar ThetaTerminal.jar username password

Specify an terminal ID of 1 that uses config_1:

java -jar ThetaTerminal.jar username password 1

Utilizing multiple configs.

Rules

Each config must ensure they are not trying to connect to the same server as any other ones. The following local port fields cannot be the same between any other terminal config:

CLIENT_PORT
STREAM_PORT
HTTP_PORT
WS_PORT

Launch 2 Theta Terminals Example

Use this config_0 for production.

py
# Copyright © 2021-2024, Bailey Danseglio, AxiomX LLC, Theta Data, their subsidiaries & affiliates. All rights reserved.

# Theta Terminal v1.3.6 Configuration. Altering these values might cause instability.
# Delete your config file and restart the terminal to reset all fields to their default value.
# All time values are in milliseconds.
# A local server is hosted on your machine.

#------------------------------------------------ Connectivity ------------------------------------------------
# The MDDS region to connect to. The IP and port series is cycled through while trying to connect to a server (left to right).
MDDS_REGION=MDDS_NJ_HOSTS

# The FPSS region to connect to. The IP and port series is cycled through while trying to connect to a server (left to right).
FPSS_REGION=FPSS_NJ_HOSTS

#------------------------------------------------ Networking ------------------------------------------------
# Http (REST API) server port.
HTTP_PORT=25510

# WebSocket server port.
WS_PORT=25520

# The Python API query-based (MDDS) socket port.
CLIENT_PORT=11000

# The Python API streaming (FPSS) port.
STREAM_PORT=10000

# How frequently should this client ping MDDS.
PING=1000

# How long should the MDDS or FPSS client wait to reconnect after the connection is lost.
RECONNECT_WAIT=5000

# How long should the client live without receiving any messages from the server.
MDDS_TIMEOUT=10000
FPSS_TIMEOUT=10000

#------------------------------------------------ MDDS HOSTS ------------------------------------------------
# Production servers located in our New Jersey Campus.
MDDS_NJ_HOSTS=nj-a.thetadata.us:12000,nj-a.thetadata.us:12001,nj-b.thetadata.us:12000,nj-b.thetadata.us:12001

# TESTING AND DEVELOPMENT ONLY! Occasional reboots. Potential issues with data and certain requests. This server is not stable.
MDDS_STAGE_HOSTS=nj-a.thetadata.us:12100,test-server.thetadata.us:12100,test-server.thetadata.us:12101

# TESTING AND DEVELOPMENT ONLY! Frequent reboots. Potential issues with data and certain requests. This server is not stable.
MDDS_DEV_HOSTS=nj-a.thetadata.us:12200,test-server.thetadata.us:12200,test-server.thetadata.us:12201

#------------------------------------------------ FPSS HOSTS ------------------------------------------------
# Production servers located in our New Jersey Campus.
FPSS_NJ_HOSTS=nj-a.thetadata.us:20000,nj-a.thetadata.us:20001,nj-b.thetadata.us:20000,nj-b.thetadata.us:20001

# TESTING ONLY! Occasional reboots. Potential issues with data and certain requests. This server is not stable.
FPSS_STAGE_HOSTS = nj-a.thetadata.us:20100,test-server.thetadata.us:20100,test-server.thetadata.us:20101

#------------------------------------------------    Misc    ------------------------------------------------
# The amount of memory buffers allocated for processing http requests. Set this equal to the # of threads you're using.
HTTP_CONCURRENCY=2

# Splits web socket messages over different lines. This helps with load balancing.
WS_LINES=1

# The maximum amount of ticks that can be returned in a single http response. The "Next-Page" will contain the local url
# to the next page of data. Making this value too high will degrade performance and cause instability. V2 requests only
HTTP_TICK_LIM=500000

# The maximum amount of time allotted to request the next page. If this limit is reached, the page is eligible to be
# discarded and no longer accessible.
HTTP_PAGE_EXPIRE=10000

# If using a web browser to make http requests, you must change this to the domain name of the website making requests.
# Specify '*' to allow everything. It is a security risk if the Theta Terminal http port is exposed to the internet.
HTTP_ACCESS_ORIGIN = https://http-docs.thetadata.us

Use this config_1 for testing. It connects to the test MDDS and FPSS. Remember that your ports will be different.

py
# Copyright © 2021-2024, Bailey Danseglio, AxiomX LLC, Theta Data, their subsidiaries & affiliates. All rights reserved.

# Theta Terminal v1.3.6 Configuration. Altering these values might cause instability.
# Delete your config file and restart the terminal to reset all fields to their default value.
# All time values are in milliseconds.
# A local server is hosted on your machine.

#------------------------------------------------ Connectivity ------------------------------------------------
# The MDDS region to connect to. The IP and port series is cycled through while trying to connect to a server (left to right).
MDDS_REGION=MDDS_STAGE_HOSTS

# The FPSS region to connect to. The IP and port series is cycled through while trying to connect to a server (left to right).
FPSS_REGION=FPSS_STAGE_HOSTS

#------------------------------------------------ Networking ------------------------------------------------
# Http (REST API) server port.
HTTP_PORT=25511

# WebSocket server port.
WS_PORT=25521

# The Python API query-based (MDDS) socket port.
CLIENT_PORT=11001

# The Python API streaming (FPSS) port.
STREAM_PORT=10001

# How frequently should this client ping MDDS.
PING=1000

# How long should the MDDS or FPSS client wait to reconnect after the connection is lost.
RECONNECT_WAIT=5000

# How long should the client live without receiving any messages from the server.
MDDS_TIMEOUT=10000
FPSS_TIMEOUT=10000

#------------------------------------------------ MDDS HOSTS ------------------------------------------------
# Production servers located in our New Jersey Campus.
MDDS_NJ_HOSTS=nj-a.thetadata.us:12000,nj-a.thetadata.us:12001,nj-b.thetadata.us:12000,nj-b.thetadata.us:12001

# TESTING AND DEVELOPMENT ONLY! Occasional reboots. Potential issues with data and certain requests. This server is not stable.
MDDS_STAGE_HOSTS=nj-a.thetadata.us:12100,test-server.thetadata.us:12100,test-server.thetadata.us:12101

# TESTING AND DEVELOPMENT ONLY! Frequent reboots. Potential issues with data and certain requests. This server is not stable.
MDDS_DEV_HOSTS=nj-a.thetadata.us:12200,test-server.thetadata.us:12200,test-server.thetadata.us:12201

#------------------------------------------------ FPSS HOSTS ------------------------------------------------
# Production servers located in our New Jersey Campus.
FPSS_NJ_HOSTS=nj-a.thetadata.us:20000,nj-a.thetadata.us:20001,nj-b.thetadata.us:20000,nj-b.thetadata.us:20001

# TESTING ONLY! Occasional reboots. Potential issues with data and certain requests. This server is not stable.
FPSS_STAGE_HOSTS = nj-a.thetadata.us:20100,test-server.thetadata.us:20100,test-server.thetadata.us:20101

#------------------------------------------------    Misc    ------------------------------------------------
# The amount of memory buffers allocated for processing http requests. Set this equal to the # of threads you're using.
HTTP_CONCURRENCY=2

# Splits web socket messages over different lines. This helps with load balancing.
WS_LINES=1

# The maximum amount of ticks that can be returned in a single http response. The "Next-Page" will contain the local url
# to the next page of data. Making this value too high will degrade performance and cause instability. V2 requests only
HTTP_TICK_LIM=500000

# The maximum amount of time allotted to request the next page. If this limit is reached, the page is eligible to be
# discarded and no longer accessible.
HTTP_PAGE_EXPIRE=10000

# If using a web browser to make http requests, you must change this to the domain name of the website making requests.
# Specify '*' to allow everything. It is a security risk if the Theta Terminal http port is exposed to the internet.
HTTP_ACCESS_ORIGIN = https://http-docs.thetadata.us