Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local.properties
.settings/**
.loadpath
/src/main/resources/rebel.xml
/src/main/resources/config/application-dev.yml

# External tool builders
.externalToolBuilders/**
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"modernizr": "2.8.3",
"ng-file-upload": "7.0.17",
"ngInfiniteScroll": "1.2.0",
"swagger-ui": "2.1.2"
"swagger-ui": "2.1.2",
"amcharts":"3.4.6"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are adding a dependency to package.json, do not include files assosiated with this dependecy. It should be downloaded by npm and should not be in the repository

},
"devDependencies": {
"angular-mocks": "1.4.5",
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,14 @@
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- optimaization -->
<dependency>
<groupId>org.ojalgo</groupId>
<artifactId>ojalgo</artifactId>
<version>36.0</version>
</dependency>

</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<resources>
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/com/pri/cabzza/web/rest/CalculateResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.pri.cabzza.web.rest;

import com.codahale.metrics.annotation.Timed;

import java.math.BigDecimal;

import org.ojalgo.finance.portfolio.MarkowitzModel;
import org.ojalgo.matrix.BasicMatrix;
import org.ojalgo.matrix.PrimitiveMatrix;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls group imports here

/**
* REST controller for managing Calculation.
*/
@RestController
@RequestMapping("/api")
public class CalculateResource {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of this class should follow Controller naming convention. f.e. CalculationController


/**
* PUT /calculate/:id - calculating NewStockWallet mathematical values and related PortfolioStores
*/
@RequestMapping(value = "/calculate",
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public void calculate() throws Exception {

//just testing MarkovitzModel, will be change in the future
double[][] CArray = {{1.,0.,0.},{0.,0.5,0.},{0.,0.,1.}};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these variables could be final

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these variables could be final

double[][] RArray = {{1,0,-1}};
BasicMatrix <Double> covariance = PrimitiveMatrix.FACTORY.rows(CArray);
BasicMatrix <Double> returns = PrimitiveMatrix.FACTORY.rows(RArray);
MarkowitzModel currentModel = new MarkowitzModel(covariance,returns);
currentModel.setShortingAllowed(false);
currentModel.setTargetReturn(BigDecimal.ZERO);
System.out.print(currentModel.getWeights());

}
}
2 changes: 1 addition & 1 deletion src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spring:
url: jdbc:postgresql://localhost:5432/Cabzza
name:
username: postgres
password:
password:
jpa:
database-platform: com.pri.cabzza.domain.util.FixedPostgreSQL82Dialect
database: POSTGRESQL
Expand Down
Loading