Quickstart Ember using Docker Compose
Run Ember
Prerequisites
To run Ember under Docker Compose, you need to connect to a TimeBase server.
To connect to a TimeBase server, do either of the following:
- Use the TimeBase Initializr to run TimeBase locally.
- Connect Ember to an existing TimeBase server running nearby.
Configure Ember
Ember uses two designated directories:
- The Home directory contains Ember's configuration files, such as exchange connectors, data warehouses, logging configuration, and so on. You can mount this directory as read-only for Ember containers. Inside containers, the
EMBER_HOME
environment variable identifies this directory. - Ember uses the Work directory for all output files, such as the Ember Journal that records all trading activity, application log files, performance metric counters, and so on. Place this writable directory on a fast disk, for example, NVMe or high IOPS volume. Inside containers, the
EMBER_WORK
environment variable identifies this directory.
To configure Ember:
Go to the directory that the Docker Compose chart uses and create
emberhome
andemberwork
subdirectories.Inside the
emberhome
directory, create a configuration file called ember.conf, and add the following code:timebase.settings {
url = "dxtick://timebase:8011"
}Ember configuration files use the HOCON format.
To tell Ember which TimeBase streams have market data, add this code:
pricing.settings {
liveSubscription {
streams = ["COINBASE", "BINANCE"]
}
}Make sure the stream names match the exchanges in the TimeBase Initializer.
To configure a simple exchange simulator to send test trades, add the following configuration fragment to enable the trading simulator as a
SIM
destination:connectors {
SIM : ${sim} { }
}Finally, tell applications how to find Ember using this code:
messageBus.settings.host = ember
Start Ember
To start Ember:
- To map the Ember home and work directories, add the Ember container to docker-compose.yml by adding the following code:
ember:
image: "registry.deltixhub.com/deltix.docker/anvil/deltix-ember:1.14.165-dev"
ports:
- 8985:8985
depends_on: [ timebase ]
volumes:
- "./emberhome:/var/lib/emberhome:ro"
- "./emberwork:/var/lib/emberwork"
Restart your Docker Compose cluster and monitor the Ember log.
The output looks as follows:> docker-compose up -d
> docker-compose logs ember
ember_1 | ______ __ PID: 1 (0x1)
ember_1 | / ____/___ ___ / /_ ___ _____ Version: 1.14.165
ember_1 | / __/ / __ `__ \/ __ \/ _ \/ ___/ Timebase Client: 5.6.101
ember_1 | / /___/ / / / / / /_/ / __/ / Home: /var/lib/emberhome
ember_1 | /_____/_/ /_/ /_/_.___/\___/_/ Work: /var/lib/emberwork
ember_1 | Copyright (c) 2017-2024 EPAM
ember_1 |
ember_1 | 2023-02-03 01:31:47.602051900 INFO [main] Journal not found (will be auto created) in /var/lib/emberwork/journal
ember_1 | 2023-02-03 01:31:53.076832200 INFO [trade-engine] EMBER is loading partitions. Partitions: 0-0.
ember_1 | 2023-02-03 01:31:53.091215600 INFO [trade-engine] EMBER has loaded partitions. Partitions: 0-0. Duration: 0 seconds. Rate: 0 B/s.
ember_1 | 2023-02-03 01:31:53.093133000 INFO [main] Standalone mode: simulating node status LEADER event
ember_1 | 2023-02-03 01:31:53.101235900 INFO [trade-engine] Startup complete. Ember is ready to process new requests.
ember_1 | 2023-02-03 01:31:53.119658700 INFO [message-bus] Message Bus is listening on localhost:8989.
Congratulations, Ember is running!
### Configure Ember Monitor
Ember has an app called Ember Monitor that can monitor events inside the Ember Order Management System (OMS), including:
* State of orders
* Trading connectors
* Risk limits
* Internal metrics like queue fill rate
To configure Ember Monitor:
1. Add the following container to *docker-compose.yml* and restart the Docker Compose setup.
```yml
ember-monitor:
image: "registry.deltixhub.com/deltix.docker/anvil/deltix-ember:1.14.165-dev"
ports:
- 8988:8988
depends_on: [ ember ]
entrypoint: [ "/opt/deltix/ember/bin/ember-monitor" ]
volumes:
- "./emberhome:/var/lib/emberhome:ro"
- "./emberwork:/var/lib/emberwork"
Ember Monitor needs the same home and work volume mounts you setup earlier for Ember.
Once the container completes initialization, access the Monitor User Interface (UI) on default port 8988:
Further Steps
Once Ember is up and running, you can perform further actions like deploying an algorithm, configuring a trade connector, and sending a test order.
Deploy an Algorithm
Trading algorithms are the building blocks of an Execution Server (ES).
For example, the deltix.ember.service.algorithm.samples.iceberg
package implements an ICEBERG algorithm that takes a large order and slices it into smaller chunks that are visible on execution venue.
To deploy the ICEBERG algorithm:
Add the following code to ember.conf:
algorithms {
ICEBERG : ${template.algorithm.default} {
factory = deltix.ember.service.algorithm.samples.iceberg.IcebergSampleAlgorithmFactory
queueCapacity = 4M
settings {
destinationId = SIM
}
}
}
To read more about the design of algorithms and deployment parameters, refer to the Algorithm Developer Guide.
Configure a Trade Connector
Trade connectors route orders to execution venues and bring back trading events.
For example, if you 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 configuration fragment registers the connector under the case-sensitive name CME
. It uses the predefined connector type "cmemsgw" that converts Ember orders to CME MSGW iLink format and talks to CME iLink.
The Execution Server integrates with more than one hundred different execution venues, including CME.
Trading connectors ship in an emberpack
container.
To read more about the design of trading connectors and deployment parameters, refer to the Trading Connector Developer's Guide and the Configuration Reference Manual.
Send a Test Order
To send test orders, use one of the following options:
- Open the Ember Monitor GUI Orders panel and submit a new order.
- Use the Java API as shown in SubmitOrderSample.
- Configure a FIX API Gateway, then submit an order using:
- The Ember FIX API from the Deltix Strategy Server or Trading Console.
- A Python API client.
- Configure a REST/WebSocket API Gateway, then submit an order using:
- The Ember REST API from the Deltix Strategy Server or Trading Console.
- A Python REST client.
- Implement an order execution algorithm or matching engine using the Ember Algorithm API.
Further Reading
For more information on the topic, refer to the following documents: