Skip to content

Commit

Permalink
CLI for days per quarter passed through to price_dividend_ratio for m…
Browse files Browse the repository at this point in the history
…arket, matches hard coded 60
  • Loading branch information
sbenthall committed Feb 6, 2024
1 parent e7ee9d4 commit 9a3220b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sharkfin/tests/test_markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_stopped_market(self):
dividend_growth_rate = 1.000628
dividend_std = 0.011988

pdr = price_dividend_ratio_random_walk(0.95, 5, dividend_growth_rate, dividend_std)
pdr = price_dividend_ratio_random_walk(0.95, 5, dividend_growth_rate, dividend_std, 90)

market = MockMarket(
dividend_growth_rate = 1.000628,
Expand Down
31 changes: 17 additions & 14 deletions simulate/run_any_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def default(self, obj):
# General simulation arguments
parser.add_argument("-d", "--seed", help="random seed", default=0)
parser.add_argument("--quarters", help="number of quarters", default=2)
parser.add_argument("--runs", help="runs per simulation", default=60)
parser.add_argument("--days", help="days per quarter", default=60)

# Population parameters
parser.add_argument(
Expand Down Expand Up @@ -93,17 +93,17 @@ def default(self, obj):
parser.add_argument(
"--pop_CRRA",
help="Mean population CRRA. Used for MockMarket and LUCAS0 population.",
default="3",
default="5",
)
parser.add_argument(
"--pop_DiscFac",
help="Mean population CRRA. Used for MockMarket and LUCAS0 population.",
default="0.99",
default="0.90",
)
parser.add_argument(
"--pop_aNrmInitMean",
help="Log of initial mean asset levels for LUCAS0 population.",
default="6",
default="0.5",
)

parser.add_argument(
Expand Down Expand Up @@ -169,7 +169,7 @@ def run_attention_simulation(
agent_parameters,
a=None,
q=None,
r=1,
r=1, ############ALERT##########################
market=None,
fm=None,
dphm=1500,
Expand All @@ -193,7 +193,7 @@ def run_attention_simulation(
fm,
a=a,
q=q,
r=r,
r=r, ############ALERT##########################
market=market,
rng=rng,
seed=seed,
Expand All @@ -210,7 +210,7 @@ def run_chum_simulation(
agent_parameters,
a=None,
q=None,
r=1,
r=1, ############ALERT##########################
fm=None,
market=None,
dphm=1500,
Expand All @@ -224,7 +224,7 @@ def run_chum_simulation(
SequentialPortfolioConsumerType, agent_parameters, dphm=dphm, rng=rng
)

sim = CalibrationSimulation(a=a, q=q, r=r, market=market)
sim = CalibrationSimulation(a=a, q=q, r=r, market=market) ############ALERT##########################

sim.simulate(burn_in=pad, buy_sell_shock=(buy, sell))

Expand All @@ -250,11 +250,12 @@ def env_param(name, default):
seed = int(args.seed)
popn = int(args.popn)
quarters = int(args.quarters)
runs = int(args.runs)
days_per_quarter = int(args.days)
runs = days_per_quarter # variable runs per quarter is an artifact of an earlier version
# and should be deprecated

# General market arguments
market_class_name = str(args.market)
days_per_quater = runs
population_name = str(args.population)
pop_CRRA = float(args.pop_CRRA)
pop_DiscFac = float(args.pop_DiscFac)
Expand Down Expand Up @@ -301,7 +302,7 @@ def env_param(name, default):
seed,
popn,
quarters,
runs,
days_per_quarter,
market_class_name,
expectations_class_name,
population_name,
Expand Down Expand Up @@ -334,7 +335,7 @@ def env_param(name, default):
"dividend_std": dividend_std,
"rng": rng,
"price_to_dividend_ratio": price_dividend_ratio_random_walk(
pop_DiscFac, pop_CRRA, dividend_growth_rate, dividend_std, days_per_quater
pop_DiscFac, pop_CRRA, dividend_growth_rate, dividend_std, days_per_quarter
),
}

Expand Down Expand Up @@ -384,7 +385,8 @@ def env_param(name, default):
parameter_dict,
a=attention,
q=quarters,
r=runs,
# days_per_quarter is current hard-coded at 60.
r=runs, #############ALERT###########################
market=market,
fm=expectations_class,
dphm=dphm,
Expand All @@ -403,7 +405,8 @@ def env_param(name, default):
parameter_dict,
a=attention,
q=quarters,
r=runs,
# days_per_quarter is current hard-coded at 60.
r=runs, #############ALERT###########################
market=market,
dphm=dphm,
buy=buysize,
Expand Down

0 comments on commit 9a3220b

Please sign in to comment.