Skip to content

Installing Prerequisites and the Library

Ivan Popivanov edited this page Jan 24, 2016 · 11 revisions

To begin working with Tradelib, one needs to install Java, Maven and Git. Most people use and IDE as well, and my choice in this area is Eclipse.

Installing the Prerequisites

Nowadays one can use a package manager to install software on pretty much all operating systems. On Linux - use the default package manager (apt-get in Ubuntu/Mint/Debian). On Windows, a good choice is chocolatey. As part of my setup, I also setup JAVA_HOME and MAVEN_HOME environment variables, but am not sure whether this is necessary anymore. On Windows, I use Tortoise git.

Cloning Tradelib

After installing Java, Maven, Tortoise Git and Eclipse, it's time to clone the Tradelib repository. The fastest way is to clone Tradelib directory into the Eclipse workspace directory. Again, in my workflow I have a workspace which is used only for trading related tasks. So, let's follow this design.

Create a directory called jtrading. For this instructions, I will assume the full path is: C:\ttt\jtrading. First, initialize the workspace, by making it the active workspace in Eclipse. For that, open Eclipse, and from the File menu select Switch Workspace.

.

Choose Other and then C:\ttt\jtrading into the following dialog box. Now we have an initialized workspace. Close Eclipse and let's clone Tradelib.

Using the Windows Explorer, go into that empty directory. Right click, and from the context menu select Git Clone. Setup Tradelib's repository path in the Tortoise window:

.

Once the operation finishes, there is a tradelib directory in jtrading. The next step is to setup things for Eclipse.

First, using the command line, go to the tradelib directory. On windows (using PowerShell):

cd c:\ttt\jtrading\tradelib

Then setup the Eclipse project via Maven:

mvn eclipse:eclipse

This produces an output like:

Now things are setup to import Tradelib into Eclipse. Open Eclipse, and create a new Java project calling it Tradelib.

Yes, the name should match what we have already created in the workspace. Hit enter, and we are done. There is a Tradelib project in our workspace.

The idea of this layout is to share the same workspace between the framework, Tradelib, and the strategies. Each will still have its own directory, thus, a separate Git project, so one doesn't mess up the library open source code with the, likely, proprietary strategy code.