Package Functions | |
Financial (Foundation pFoundation, FinancialInitValues pInitValues) | |
The Constructor of the Financial class. | |
void | init () |
Initialize the Financial System. | |
void | updateInterestRate () |
Calculate the actual interest rate, using the Taylor-rule. | |
void | updateInflationRate () |
Calculate the actual inflation rate. | |
Private Member Functions | |
void | updatePriceIndex () |
Calculate the actual Laspeyre price index (used for calculating the inflation rate), see Collecting statistics. | |
Classes | |
class | Probe |
Definition at line 31 of file Financial.java.
Financial | ( | Foundation | pFoundation, | |
FinancialInitValues | pInitValues | |||
) | [package] |
The Constructor of the Financial class.
pFoundation | The model Foundation | |
pInitValues | The init values of the Financial System |
Definition at line 359 of file Financial.java.
void init | ( | ) | [package] |
Initialize the Financial System.
Definition at line 367 of file Financial.java.
00367 { 00368 final int lInterestRateInterval = Foundation.getInitValues().getInterestRateInterval(); 00369 memoryUnemploymentRate = new ValueMemory(lInterestRateInterval); 00370 memoryInflationRate = new ValueMemory(lInterestRateInterval); 00371 memoryInterestRate = new ValueMemory(lInterestRateInterval); 00372 00373 interestRate = initValues.getEquilibriumInterestRate(); 00374 inflationRate = 0.d; 00375 priceIndex = 100.d; 00376 liquidationMissingDebts = 0.d; 00377 savingsInvested = 0.d; 00378 savingsAggregate = 0.d; 00379 00380 probe.init(); 00381 foundation.getProbeManager().addProbe(probe); 00382 foundation.getStepManager().registerEndOfPeriodCallback(2, new Callback(){ 00383 @Override 00384 public void endOfPeriod() { 00385 memoryUnemploymentRate.add(foundation.calcUnemploymentRate()); 00386 memoryInflationRate.add(inflationRate); 00387 memoryInterestRate.add(interestRate); 00388 } 00389 @Override 00390 public Object getOwner() { 00391 return Financial.this; 00392 }} 00393 ); // end of registerEndOfPeriodCallback 00394 }
void updateInterestRate | ( | ) | [package] |
Calculate the actual interest rate, using the Taylor-rule.
Definition at line 398 of file Financial.java.
00398 { 00399 interestRate = Math.max(0,initValues.getEquilibriumInterestRate() + 00400 initValues.getTargetInflationRate() + 00401 initValues.getInflationRateAdaptionCoefficient() * 00402 (memoryInflationRate.average() - initValues.getTargetInflationRate()) + 00403 initValues.getUnemploymentRateAdaptionCoefficient() * 00404 (initValues.getNaturalUnemploymentRate() - 00405 memoryUnemploymentRate.average())); 00406 }
void updateInflationRate | ( | ) | [package] |
Calculate the actual inflation rate.
Definition at line 409 of file Financial.java.
00409 { 00410 updatePriceIndex(); 00411 inflationRate = priceIndex / 100.f - 1.f; 00412 }
void updatePriceIndex | ( | ) | [private] |
Calculate the actual Laspeyre price index (used for calculating the inflation rate), see Collecting statistics.
Definition at line 418 of file Financial.java.
00418 { 00419 // first calculate the total value of purchased goods in the last period 00420 double lTotalValueLastPeriod = 0.f; // sum{v'_l} 00421 for (final Sector lSector : foundation.getSectorList()) { 00422 lTotalValueLastPeriod += lSector.getStats().getTradeValueLastPeriod(); 00423 } 00424 00425 // then the price index itself (if nothing was traded last period, keep the old index) 00426 if (lTotalValueLastPeriod > 0.f) { 00427 // therefore we first calculate the sum in the nominator of Lasp ... 00428 priceIndex = 0.f; 00429 for (final Sector lSector : foundation.getSectorList()) { 00430 final Sector.Stats lStats = lSector.getStats(); 00431 if (lStats.getAverageTradePrice() * lStats.getTradeValueLastPeriod() > 0.f) { 00432 // averageTradePrice: p_l; tradedValueLastPeriod: v'_l 00433 priceIndex += lStats.getAverageTradePrice() * lStats.getTradeValueLastPeriod() / 00434 lStats.getAverageTradePriceLastPeriod(); 00435 } 00436 } 00437 // ... and divide it thru sum{v'_l} 00438 priceIndex /= lTotalValueLastPeriod / 100.f; 00439 } 00440 }