Child pages
  • Set Up Development Environment
Skip to end of metadata
Go to start of metadata

This article will cover setting up a development environment to create custom strategies and modules for the Marketcetera platform. The instructions will use Eclipse as an example, but you can use a different IDE if you wish.

To start, install the Strategy Engine. After installation, here's what you have:

$ tree -d strategyengine
strategyengine
├── bin
├── conf
│   └── sa
├── lib
├── logs
├── modules
│   ├── conf
│   └── jars
├── samples
│   ├── commands
│   ├── java
│   │   ├── inputs
│   │   └── scripts
│   └── ruby
│       ├── inputs
│       └── scripts
└── src

17 directories

For our build environment, in addition to the IDE of your choice, you'll also need Maven and a Java JDK installed. For 3.x, Marketcetera requires a minimum of Java 7.

The first step is to modify the directory structure above to prepare it for Maven. Here's a sample pom.xml file you can use to build your Maven project.

Project Pom
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.marketcetera</groupId>
    <artifactId>public-parent</artifactId>
    <version>3.0.12</version>
  </parent>
  <groupId>com.mycompany</groupId>
  <artifactId>strategy</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>My Company Strategies</name>
  <properties>
    <metc.public.package>org.marketcetera</metc.public.package>
    <metc.public.version>3.0.12</metc.public.version>
  </properties>
  <dependencies>
    <!-- marketcetera compile scope artifacts -->
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>core</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>strategyagent</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>strategy</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-core</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-exsim</artifactId>
      <version>${metc.public.version}</version>
    </dependency> 
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-bogus</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-recorder</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-yahoo</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>marketdata-csv</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
   <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>client</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>saclient</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>util</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>misc</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>cep-system</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>cep-esper</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>tensorflow</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>remote-receiver</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>remote-emitter</artifactId>
      <version>${metc.public.version}</version>
    </dependency>
    <!-- marketcetera test scope artifacts -->
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>util-test</artifactId>
      <version>${metc.public.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
      <version>${metc.public.version}</version>
    </dependency>
    <dependency>
      <groupId>${metc.public.package}</groupId>
      <artifactId>util</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
      <version>${metc.public.version}</version>
    </dependency>
  </dependencies>
</project>

Install this pom file in the strategyengine directory.

Next, modify the src directory to match the structure that Maven will expect.

$ cd strategyengine
$ mkdir -p src/main/java src/main/resources
$ tree -d
.
├── bin
├── conf
│   └── sa
├── lib
├── logs
├── modules
│   ├── conf
│   └── jars
├── samples
│   ├── commands
│   ├── java
│   │   ├── inputs
│   │   └── scripts
│   └── ruby
│       ├── inputs
│       └── scripts
└── src
    └── main
        ├── java
        └── resources

20 directories

Create a project for Eclipse to find.

$ mvn install eclipse:eclipse
[INFO] Scanning for projects...


...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.138 s
[INFO] Finished at: 2017-10-17T08:34:31-07:00
[INFO] Final Memory: 34M/512M
[INFO] ------------------------------------------------------------------------
$ tree -d
.
├── bin
├── conf
│   └── sa
├── lib
├── logs
├── modules
│   ├── conf
│   └── jars
├── samples
│   ├── commands
│   ├── java
│   │   ├── inputs
│   │   └── scripts
│   └── ruby
│       ├── inputs
│       └── scripts
├── src
│   └── main
│       ├── java
│       └── resources
├── target
│   ├── classes
│   └── maven-archiver
└── target-eclipse
    └── classes

25 directories

Open Eclipse and select /opt/Marketcetera-3.0.12 (or your installation directory) as the workspace.

Import existing projects to pick up the strategyengine project you created above with Maven.

Choose the strategyengine directory.

The development environment is now ready. You can create your classes in the src/main/java directory and build them. In order for the Strategy Engine to use the classes you create, copy the resulting JAR file to modules/jars. It is possible to configure the Maven pom.xml to deploy the JAR to modules/jars automatically, but it is preferable to keep this as a manual step to make sure you deploy artifacts that you are certain are ready to go.

$ ls target
classes  maven-archiver  strategy-1.0.0-SNAPSHOT.jar  strategy-1.0.0-SNAPSHOT-tests.jar
$ cp target/strategy-1.0.0-SNAPSHOT.jar modules/jars/

The JAR file is now available to the Strategy Engine for use. See Creating a New Strategy for instructions on how to build strategies.

  • No labels

1 Comment

  1. Maven project wasn't building in Eclipse for Windows due “Plugin execution not covered by lifecycle configuration”  

    Here a quick fix:

    Window > Preferences > Maven > Errors/Warnings > Plugin execution not covered by lifecycle configuration. Select Ignore or Warning

    it doesn't modify your pom.xml.

    Then you will need to do a Maven > Update project