def sample_next_state_reward(state=state) -> Tuple[PriceState, float]: up_prob = get_logistic_func(self.alpha1)(self.level_param - state.price) up_move: int = binomial(1, up_prob, 1)[0] next_state: PriceState = PriceState(price=state.price + up_move * 2 - 1) reward: float = self.reward_function(next_state) return next_state, reward
def up_prob(self, state: StateMP1) -> float: """ return the probability that the stock price goes up """ return get_logistic_func(self.alpha1)(self.level_param - state.price)
def up_prob(self, state: StateMP1) -> float: return get_logistic_func(self.alpha1)(self.level_param - state.price)