def _do_buy():
    available_amount = (self.state[0] // self.state[(index + 1)])
    buy_num_shares = min(available_amount, action)
    buy_amount = ((self.state[(index + 1)] * buy_num_shares) * (1 + self.buy_cost_pct))
    self.state[0] -= buy_amount
    self.state[((index + self.stock_dim) + 1)] += min(available_amount, action)
    self.cost += ((self.state[(index + 1)] * min(available_amount, action)) * self.buy_cost_pct)
    self.trades += 1
    return buy_num_shares
def _do_buy():
    available_amount = (self.state[0] // self.state[(index + 1)])
    buy_num_shares = min(available_amount, action)
    buy_amount = ((self.state[(index + 1)] * buy_num_shares) * (1 + self.buy_cost_pct))
    self.state[0] -= buy_amount
    self.state[((index + self.stock_dim) + 1)] += min(available_amount, action)
    self.cost += ((self.state[(index + 1)] * min(available_amount, action)) * self.buy_cost_pct)
    self.trades += 1
    return buy_num_shares