-
Notifications
You must be signed in to change notification settings - Fork 2
/
price_processes.py
74 lines (54 loc) · 2.13 KB
/
price_processes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""# Price Processes Module
State update functions for drawing samples from misc. projected or stochastic asset price
processes configured in System Parameters.
"""
import typing
from model.types import (
USD,
)
from model.system_parameters import Parameters
def update_fei_price(
params: Parameters, substep, state_history, previous_state, policy_input
) -> typing.Tuple[str, USD]:
"""## Update FEI price
Update the FEI price from the `fei_price_process`.
"""
# Parameters
dt = params["dt"]
fei_price_process = params["fei_price_process"]
# State Variables
run = previous_state["run"]
timestep = previous_state["timestep"]
# Get the price sample for the current run and timestep
fei_price_sample = fei_price_process(run, timestep * dt)
return "fei_price", fei_price_sample
def update_stable_asset_price(
params: Parameters, substep, state_history, previous_state, policy_input
) -> typing.Tuple[str, USD]:
"""## Update Stable Asset Price
Update the stable asset price from the `stable_asset_price_process`.
"""
# Parameters
dt = params["dt"]
stable_asset_price_process = params["stable_asset_price_process"]
# State Variables
run = previous_state["run"]
timestep = previous_state["timestep"]
# Get the price sample for the current run and timestep
stable_asset_price_sample = stable_asset_price_process(run, timestep * dt)
return "stable_asset_price", stable_asset_price_sample
def update_volatile_asset_price(
params: Parameters, substep, state_history, previous_state, policy_input
) -> typing.Tuple[str, USD]:
"""Update Volatile Asset Price
Update the volatile asset price from the `volatile_asset_price_process`.
"""
# Parameters
dt = params["dt"]
volatile_asset_price_process = params["volatile_asset_price_process"]
# State Variables
run = previous_state["run"]
timestep = previous_state["timestep"]
# Get the price sample for the current run and timestep
volatile_asset_price_sample = volatile_asset_price_process(run, timestep * dt)
return "volatile_asset_price", volatile_asset_price_sample