It would be useful to have docstrings for each function explicitly telling what each operation means. This would make it easier to people use the model as a source of truth and as a educational material.
It could be something like that:
def calc_out_given_in(*args):
"""
Calculate the amount of output tokens retrieved when selling a input amount of tokens
Arguments
token_amount_in: amount of input tokens to be sold
(...)
Output
token_amount_out: resulting output tokens from trading
token_amount_in_fee: fee to be paid on input tokens
Math
$$
(latex here)
$$
References
- https://balancer.finance/whitepaper/#out-given-in
Examples
>>> calc_out_given_in(...)
BalancerMathResult(...)
It would be useful to have docstrings for each function explicitly telling what each operation means. This would make it easier to people use the model as a source of truth and as a educational material.
It could be something like that: