TokenEngineeringCommunity / BalancerPools_Model

cadCAD model to simulate Balancer AMMs
MIT License
54 stars 29 forks source link

Add docstrings for the balancer_math.py #79

Open danlessa opened 3 years ago

danlessa commented 3 years ago

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(...)