Skip to content
Snippets Groups Projects
Commit eacdf6b2 authored by rhenry2's avatar rhenry2
Browse files

stocks changes

parent 669fb7a2
No related branches found
No related tags found
No related merge requests found
...@@ -34,14 +34,14 @@ public class GlobalPrice { ...@@ -34,14 +34,14 @@ public class GlobalPrice {
return exportAmount; return exportAmount;
} }
public GlobalPrice createWithUpdatedMarketPrices(double imports, double exports, boolean adjustPrice, double stockLevel) { public GlobalPrice createWithUpdatedMarketPrices(double imports, double exports, boolean adjustPrice) {
if (imports > 0 || exports > 0) { if (imports > 0 || exports > 0) {
double ratio; double ratio;
if (imports > exports) if (imports > exports)
ratio = (imports-exports)/stockLevel; ratio = (imports-exports)/imports;
else else
ratio = (imports-exports)/stockLevel; ratio = (imports-exports)/exports;
double adjustment = adjustPrice ? Math.exp(ratio * ModelConfig.MARKET_LAMBA) : 1.0; double adjustment = adjustPrice ? Math.exp(ratio * ModelConfig.MARKET_LAMBA) : 1.0;
return new GlobalPrice(exportPrice * adjustment, imports, exports); return new GlobalPrice(exportPrice * adjustment, imports, exports);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment