Running Ember using Java
Prerequisites
Access TimeBase using one of the following options:
- To access market prices, Ember requires the Enterprise version of TimeBase.
- To run TimeBase locally, use the TimeBase Initializr. You can also connect Ember to an existing TimeBase server running nearby.
Make sure you have Java JDK 11 or 17 installed.
The TimeBase client inside Ember requires the JDK package (rather than the JRE package) of Java.
Install
To install Ember:
Extract the Ember distribution package deltix-ember-version.zip into a designated installation directory. For example:
/home/deltix/ember
. Various launch scripts described on this page can be found under thebin
subdirectory of your installation.Set an environment variable called
EMBER_HOME
that defines the Ember home directory where configuration files will live:
Linux:
export EMBER_HOME=/home/deltix/emberhome
Windows:
set EMBER_HOME=D:\Deltix\QuantServer\emberhome
Configure
To configure Ember:
Create a configuration file called
ember.conf
underEMBER_HOME
and add the following block:timebase.settings {
url = "dxtick://localhost:8011"
}You may need to correct the host, port, and logon credentials to match your TimeBase server.
Ember configuration files use the HOCON format described here.
Tell Ember which TimeBase streams have market data:
pricing.settings {
liveSubscription {
streams = ["COINBASE", "BINANCE"]
}
}Make sure the stream names match the exchanges you configured in the TimeBase Initializer.
Configure a simple exchange simulator so you can send test trades. Add the following configuration fragment to enable this trading simulator as a
SIM
destination:connectors {
SIM : ${sim} {
}
}
Start
Finally, start Ember using the script bin/ember
:
______ __
/ ____/___ ___ / /_ ___ _____ Version: 0.2-SNAPSHOT
/ __/ / __ `__ \/ __ \/ _ \/ ___/ Timebase: 5.2.6x.44760
/ /___/ / / / / / /_/ / __/ / Home: D:\Deltix\QuantServer\ember
/_____/_/ /_/ /_/_.___/\___/_/ Copyright (c) 2017 Deltix, Inc.
29 Sep 12:49:30.358422 INFO [trade-engine] Log is replayed, messages read 0
29 Sep 12:49:30.361264 INFO [trade-engine] Startup complete. This server is ready to process new requests.
Monitor Trade Flow
Ember has an app, Ember Monitor, that can monitor events inside Ember OMS. This includes the state of orders, trading connectors, risk limits, and internal metrics like queue fill rate.
Ember Monitor can be started using the bin/ember-monitor
script and accessed on port 8988:
Ember Monitor needs the same EMBER_HOME
environment variable we set up earlier to find Ember Journal and access system configuration.
Congratulations, Ember is running!
Further Steps
Separate Output Directory
In addition to the environment variable EMBER_HOME
, you can use EMBER_WORK
to define an Ember work directory. The work directory is used for all output files (i.e., transaction journal, log files, counters, etc.).
Linux:
export EMBER_WORK=/mnt/nvme/ember
Windows:
set EMBER_WORK=M:/ember
We recommend keeping the work directory separate from the home directory. For a higher performance work directory, it can be placed on faster storage (NVMe, high IOPS volume, etc.).
Ember Monitor and other satellite Ember processes share the EMBER_WORK
and EMBER_HOME
environment variables.
Deploy an Algorithm
Trading Algorithms are the building blocks of an Execution Server. Let's deploy the "ICEBERG" algorithm that takes a large order and slices it into smaller chunks visible on execution venue.
Add the following block into ember.conf
to deploy the ICEBERG algorithm implemented by the deltix.ember.service.algorithm.samples.iceberg
package:
algorithms {
ICEBERG : ${template.algorithm.default} {
factory = deltix.ember.service.algorithm.samples.iceberg.IcebergSampleAlgorithmFactory
queueCapacity = 4M
settings {
destinationId = SIM
}
}
}
You can read more about the design of algorithms and deployment parameters in the Algorithm Developer's Guide.
Configure a Trade Connector
Trade connectors route orders to execution venues and bring back trading events.
For example, let's assume we have a connection to a CME iLink MSGW gateway. The following configuration fragment enables the CME connector and defines connection parameters:
connectors {
CME : ${CMEMSGW} {
settings {
senderCompId = ROGUE1N
targetCompId = CME
host=69.50.112.141
port=61529
}
}
}
The above connector is registered under the name CME
(case-sensitive). This definition uses the predefined connector type "cmemsgw" that converts Ember orders to CME MSGW iLink format and talks to CME iLink.
The Execution Server is integrated with 100+ different execution venues like CME.
You can read more about the design of trading connectors and deployment parameters in the Trading Connector Developer's Guide and the Configuration Reference Manual.
EmberPack
If you attempt to restart Ember to apply the changes we just made, you will notice a Class Not Found error because Ember won't be able to find the CME connector code. The connector lives in the EmberPack container. This container extends Ember with an additional layer containing compiled versions of all supported trading connectors.
Send a Test Order
There are several ways to send test orders:
- Open Ember Monitor GUI and submit a new order on the Orders panel.
- Use the Java API as shown in SubmitOrderSample.
- Configure a FIX API Gateway and submit an order via Ember FIX API (for example, from the Deltix Strategy Server or Trading Console). We also have a Python example on how to do this.
- Configure a REST/WebSocket API Gateway and submit an order via Ember REST API (for example, from the Deltix Strategy Server or Trading Console). There is also a Python example on how to do this.
- Implement an order execution algorithm or matching engine using the Ember Algorithm API.