Skip to main content

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:

  1. Go to the directory that the Docker Compose chart uses and create emberhome and emberwork subdirectories.

  2. 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.

  3. 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.

  4. 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} { }
    }
  5. Finally, tell applications how to find Ember using this code:

    messageBus.settings.host = ember

Start Ember

To start Ember:

  1. 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.12.9"
ports:
- 8985:8985
depends_on: [ timebase ]
volumes:
- "./emberhome:/var/lib/emberhome:ro"
- "./emberwork:/var/lib/emberwork"
  1. 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.12.9
    ember_1           |   / __/ / __ `__ \/ __ \/ _ \/ ___/  Timebase Client:  5.5.36
    ember_1           |  / /___/ / / / / / /_/ /  __/ /      Home:             /var/lib/emberhome
    ember_1           | /_____/_/ /_/ /_/_.___/\___/_/       Work:             /var/lib/emberwork
    ember_1           |                                                 Copyright (c) 2017-2022 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.
  ember-monitor:
image: "registry.deltixhub.com/deltix.docker/anvil/deltix-ember:1.12.9"
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.
  1. Once the container completes initialization, access the Monitor User Interface (UI) on default port 8988:

    Ember Monitor screenshot

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.

note

The Execution Server integrates with more than one hundred different execution venues, including CME.

tip

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:

Further Reading

For more information on the topic, refer to the following documents: