---
# System prepended metadata

title: Questions regarding the RBS simulation

---

# Questions regarding the RBS simulation

###### tags: `olympus`

- AMM k: is it a constant (if so, what value) or is it updating every step?
    - Seems like it's changing with this updating function --
    ```self.k = prev_day.price and ((prev_day.liq_usd - self.reserves_in)**2 / prev_day.price) * (1 + self.reward_rate)**2 or 0```
    Does it mean that if price is not zero, the k will be set to as `((prev_day.liq_usd - self.reserves_in)**2 / prev_day.price) * (1 + self.reward_rate)**2`? Why is there a reward_rate term?

- When calculating the bid/ask capacity (cushion), what does this term `(self.k * self.lower_target_cushion) ** (1/2)` mean?
    For example:
    ```
    self.bid_capacity_cushion = prev_day.bid_capacity_cushion + self.net_flow - self.reserves_in + prev_day.liq_usd - (self.k * self.lower_target_cushion) ** (1/2)
    ```
- When calculating the bid/ask capacity (cushion), are those offers of bonds / swapping opportunities all being actualized? Or the amount being actualized is randomized by `net_flow`?
    - Is there any difference between bonds (happens when price in the cushion zone) and swap (happens when the price is beyond the walls), besides the different depth of capacity provided? (reading the [doc](https://docs.olympusdao.finance/main/overview/range-bound/) it feels like there's two channels, swap and bond)


- Calculation regarding treasury reserves seems have a bug?
Treasury owned liquidity, in usd:
```
self.liq_usd = max(prev_day.liq_usd + self.net_flow - self.reserves_in + self.bid_change_usd - self.ask_change_usd, 0)
```
Then, treasury reserve:
```
self.reserves_out = self.liq_usd - prev_day.liq_usd - self.net_flow - self.reserves_in
self.reserves = max(prev_day.reserves - self.reserves_out, 0)
```
Combined with liquidity, we can see that:

reserve = previous_day.reserve - (-2*reserves_in + bid_change_usd - ask_change_usd) = previous_day.reserve - bid_change_usd + ask_change_usd + 2*reserves_in

Wondering the term of "reserve_in" is wrong (should not be 2 times)??
    
