Setup

Revision for “Setup” created on September 22, 2017 @ 12:03:21

TitleContentExcerptRevision Note
Setup
<a href="http://numericalmethod.com/up/algoquant" target="_blank" rel="noopener noreferrer">AlgoQuant</a> uses ​<a href="http://maven.apache.org/" target="_blank" rel="noopener noreferrer">Maven</a> for project management. To download and install the required libraries, you need to do an initialization step.
<h2>NetBeans</h2>
In NetBeans, open the parent project <strong>algoquant</strong> and click <strong>Build</strong>:

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-open-algoquant.png"><img class="alignnone size-full wp-image-3317" src="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-open-algoquant.png" alt="netbeans-open-algoquant" width="779" height="403" /></a>

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-build.png"><img class="alignnone size-full wp-image-3318" src="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-build.png" alt="netbeans-build" width="437" height="234" /></a>

NetBeans will download all the required jar files to your local maven repository and run all the tests.

Reference: <a href="http://wiki.netbeans.org/MavenBestPractices" target="_blank" rel="noopener noreferrer">​http://wiki.netbeans.org/MavenBestPractices</a>
<h2>Eclipse</h2>
In Eclipse, import the parent project (choose <strong>File &gt; Import &gt; Maven &gt; Existing Maven Project</strong>, then select the root directory of algoquant). Then, Eclipse may install the required maven plugins and restart.

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-import.png"><img class="alignnone size-full wp-image-3321" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-import.png" alt="eclipse-import" width="635" height="647" /></a>

After Eclipse restarts, you need to run <strong>Maven install</strong> for the parent project <strong>algoquant</strong>.

&nbsp;

<img class="size-full wp-image-5407 alignnone" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-build1.png" alt="eclipse-build" width="729" height="696" /><a href="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-clean-install.png"><img class="size-full wp-image-5408 alignnone" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-clean-install.png" alt="eclipse-clean-install" width="640" height="782" /></a>

&nbsp;

Eclipse will download all the required jar files to your local maven repository.

If there are errors shown in source files in algoquant-core, they may be due to the ignorance of Eclipse about the generated source code. Add the generated source folder:

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-core-properties.png"><img class="alignnone size-full wp-image-5409" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-core-properties.png" alt="eclipse-core-properties" width="479" height="724" /></a><a href="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-add-source-folder.png"><img class="alignnone size-full wp-image-5406" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-add-source-folder.png" alt="eclipse-add-source-folder" width="732" height="555" /></a><a href="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-select-generated-sources.png"><img class="alignnone size-full wp-image-5410" src="http://numericalmethod.com/wp-content/uploads/2015/04/eclipse-select-generated-sources.png" alt="eclipse-select-generated-sources" width="421" height="629" /></a>

References:
<ul>
<li>​<a href="http://www.sonatype.com/books/m2eclipse-book/reference/index.html" target="_blank" rel="noopener noreferrer">http://www.sonatype.com/books/m2eclipse-book/reference/index.html</a></li>
<li><a href="https://www.eclipse.org/m2e/documentation/m2e-faq.html">https://www.eclipse.org/m2e/documentation/m2e-faq.html</a></li>
</ul>
<h2>Command Line</h2>
If you have already installed Maven in your workstation, you can directly use command line interface to do the setup by typing the command:

&gt; mvn install

at the outermost project folder. Having done the proper setup, you can now start coding with the <a href="http://numericalmethod.com/up/algoquant" target="_blank" rel="noopener noreferrer">AlgoQuant</a> API.
<h2>Using AlgoQuant API via Maven dependency</h2>
Alternatively, you may use <a href="http://numericalmethod.com/up/algoquant" target="_blank" rel="noopener noreferrer">AlgoQuant</a> API in your own project without downloading the whole zipped package. In your project POM, fill in our repository information in the <code>&lt;repositories&gt;</code> section, then put a dependency in the <code>&lt;dependencies&gt;</code> section. Here is an example:
<pre class="toolbar-overlay:false show-lang:2 lang:xml decode:true"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.mycompany&lt;/groupId&gt;
&lt;artifactId&gt;myproject&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;properties&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
&lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
&lt;/properties&gt;

&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;nm-repo&lt;/id&gt;
&lt;name&gt;Numerical Method’s Maven Repository&lt;/name&gt;
&lt;url&gt;http://repo.numericalmethod.com/maven/&lt;/url&gt;
&lt;layout&gt;default&lt;/layout&gt;
&lt;/repository&gt;
&lt;/repositories&gt;

&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.numericalmethod&lt;/groupId&gt;
&lt;artifactId&gt;algoquant-core&lt;/artifactId&gt;
&lt;version&gt;2.0.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/project&gt;</code></pre>
Your own code can now call the API from algoquant-core.
<h2>Link to a local AlgoQuant Project</h2>
After downloading, unzipping, and installing <a title="AlgoQuant" href="http://numericalmethod.com/up/algoquant/">AlgoQuant</a>, you can ​<a href="http://wiki.netbeans.org/MavenBestPractices#Create_new_project" target="_blank" rel="noopener noreferrer">create your own Maven project</a>, and link to the <strong>local</strong> algoquant-core to use the <a href="http://numericalmethod.com/up/algoquant" target="_blank" rel="noopener noreferrer">AlgoQuant</a> API. In this case, you can also customize <a href="http://numericalmethod.com/up/algoquant" target="_blank" rel="noopener noreferrer">AlgoQuant</a> by changing the code in your local copy.

This is a simple example POM to link your project to your local algoquant:
<pre class="toolbar-overlay:false show-lang:2 lang:xml decode:true"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.yourcompany&lt;/groupId&gt;
&lt;artifactId&gt;your-project-id&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;properties&gt;
&lt;installed.algoquant.version&gt;2.0.0&lt;/installed.algoquant.version&gt;
&lt;/properties&gt;

&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.numericalmethod&lt;/groupId&gt;
&lt;artifactId&gt;algoquant-core&lt;/artifactId&gt;
&lt;version&gt;${installed.algoquant.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/project&gt;</code></pre>
<strong>Note</strong>: You have to install (or <strong>Clean and Build</strong> in NetBeans terminology) your local AlgoQuant again after changing the source code.
<h2>Configuration File</h2>
The default configuration file is <strong>algoquant/core/config/config.default.xml</strong>. If you would like to modify the settings (e.g., location of data files), you can edit the file <strong>data.properties</strong> in the same directory.

Alternatively, you can create your custom-made configuration folder and files as in folder, e.g. <a href="http://redmine.numericalmethod.com/projects/public/repository/svn-algoquant/show/core/config/haksunli" target="_blank" rel="noopener noreferrer">haksunli</a>, and define the system property <strong>config</strong> in your Java environment, e.g., <strong>-Dconfig=haksunli/config.haksunli.xml</strong> in NetBeans IDE. You can put the configuration files in folder <strong>core/src/main/resources/config</strong> or any location in the classpath.

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/config.png"><img class="alignnone size-full wp-image-3328" src="http://numericalmethod.com/wp-content/uploads/2015/04/config.png" alt="config" width="935" height="562" /></a>

<a href="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-test-config.png"><img class="alignnone size-large wp-image-3329" src="http://numericalmethod.com/wp-content/uploads/2015/04/netbeans-test-config-1024×763.png" alt="netbeans-test-config" width="1024" height="763" /></a>

If you would like to run unit testing with a different config file, you need to set the property of the <strong>test</strong> goal (see figure).
<h2>Project License</h2>
All our software requires a license. For NetBeans users, when creating a new file in the project <a title="AlgoQuant" href="http://numericalmethod.com/up/algoquant/">AlgoQuant</a>, you may see this error in the first line of the new file.

Error reading included file Templates/Classes/../Licenses/license-NumericalMethod.txt

There are two options. You may choose to ignore them and delete this line each time you open a new file. Alternatively, you can comment out the following line in the project POM file (algoquant/pom.xml):
<pre class="toolbar-overlay:false show-lang:2 lang:xml decode:true"><code>&lt;netbeans.hint.license&gt;NumericalMethod&lt;/netbeans.hint.license&gt;</code></pre>



Old New Date Created Author Actions
September 22, 2017 @ 12:03:21 Ken Yiu
September 22, 2017 @ 12:03:05 [Autosave] Ken Yiu
May 31, 2017 @ 08:07:52 Haksun Li
May 31, 2017 @ 08:07:51 [Autosave] Haksun Li
May 31, 2017 @ 08:06:38 Haksun Li
January 13, 2016 @ 17:41:06 webmaster
January 13, 2016 @ 17:40:50 [Autosave] webmaster
December 2, 2015 @ 08:51:52 webmaster
September 11, 2015 @ 07:26:15 Ken Yiu
September 8, 2015 @ 11:23:25 Ken Yiu
September 8, 2015 @ 11:07:59 Ken Yiu
September 8, 2015 @ 11:06:54 Ken Yiu
September 8, 2015 @ 11:05:28 Ken Yiu
May 7, 2015 @ 06:44:16 [Autosave] henrymorco
April 15, 2015 @ 19:03:43 webmaster
April 15, 2015 @ 18:07:45 webmaster
April 15, 2015 @ 15:43:35 webmaster
April 15, 2015 @ 15:10:21 webmaster
April 15, 2015 @ 14:29:10 Haksun Li
April 15, 2015 @ 14:25:50 Haksun Li
April 15, 2015 @ 13:59:18 webmaster
April 15, 2015 @ 13:57:11 Haksun Li
April 15, 2015 @ 13:39:50 Haksun Li
April 15, 2015 @ 13:37:20 Haksun Li
April 14, 2015 @ 07:29:38 sanjay
April 14, 2015 @ 07:29:33 [Autosave] sanjay
April 13, 2015 @ 11:53:18 sanjay
April 13, 2015 @ 11:49:15 sanjay
April 13, 2015 @ 11:29:37 sanjay
April 13, 2015 @ 07:59:21 sanjay