diff --git a/core/src/economy/sims/tokenomics/test/test_tokenomics.f90 b/core/src/economy/sims/tokenomics/test/test_tokenomics.f90 index 19ac85c..dd6ac83 100644 --- a/core/src/economy/sims/tokenomics/test/test_tokenomics.f90 +++ b/core/src/economy/sims/tokenomics/test/test_tokenomics.f90 @@ -4,6 +4,7 @@ program test_tokenomics real(8) :: shock(3), exposure(3,3), propagated(3), w(3), apy(3), vol(3) real(8) :: collateral(4), borrowed(4), ltv(4), cascade_exposure(4,4), losses(4) real(8) :: var_a(3,3), impulse(3,4) + real(8) :: opt_apy(3), opt_vol(3), opt_w(3), marginal(3) type(token_state) :: state0, state1 real(8) :: e_before, e_half, e_quarter if (abs(lending_rate(0.80d0,0.02d0,0.04d0,0.60d0,0.80d0)-0.052d0) > 1d-9) error stop 'below kink' @@ -54,5 +55,14 @@ program test_tokenomics if (abs(impulse(3,3)-0.20d0)>1d-12) error stop 'var second hop' if (abs(impulse(1,4))+abs(impulse(2,4))+abs(impulse(3,4)) > 1d-12) & error stop 'impulse decay' + + + opt_apy = [0.06d0,0.08d0,0.07d0] + opt_vol = [0.10d0,0.12d0,0.08d0] + call yield_weights(opt_apy,opt_vol,2d0,opt_w) + if (abs(sum(opt_w)-1d0)>1d-10) error stop 'optimal weights normalize' + if (minval(opt_w) <= 0d0) error stop 'expected active set' + marginal = opt_apy - 4d0*opt_vol*opt_vol*opt_w + if (maxval(marginal)-minval(marginal) > 1d-8) error stop 'yield KKT stationarity' print *, 'TOKENOMICS TESTS PASSED' end program