Skip to content

Add docstrings for the balancer_math.py #79

@danlessa

Description

@danlessa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions