Skip to content

Instantly share code, notes, and snippets.

@GalloDaSballo
Created September 28, 2023 18:12
Show Gist options
  • Save GalloDaSballo/f02d887cfd1efd483b49be8201d4c960 to your computer and use it in GitHub Desktop.
Save GalloDaSballo/f02d887cfd1efd483b49be8201d4c960 to your computer and use it in GitHub Desktop.
SAFE ICR 200.0
WHALE ICR 126.0
RISKY ICR 100.0
total CR 125.97881201007138
UPDATED WHALE ICR 114.545454545454
def get_debt(coll, cr):
    return coll / cr * 100

def get_cr(coll, debt):
    return coll / debt * 100

SAFE_CR = 200
WHALE_CR = 126
RISKY_CR = 123

def main():
  ## Base CDP
  SAFE_COLL = 200
  SAFE_DEBT = get_debt(SAFE_COLL, SAFE_CR)
  print("SAFE ICR", get_cr(SAFE_COLL, SAFE_DEBT))

  WHALE_COLL = 1_000_000
  WHALE_DEBT = get_debt(WHALE_COLL, WHALE_CR)
  print("WHALE ICR", get_cr(WHALE_COLL, WHALE_DEBT))

  RISKY_COLL = 1_000_0
  RISK_DEBT = get_debt(RISKY_COLL, RISKY_CR)
  print("RISKY ICR", get_cr(RISKY_COLL, RISKY_COLL))

  total_coll = SAFE_COLL + WHALE_COLL + RISKY_COLL

  total_debt = SAFE_DEBT + WHALE_DEBT + RISK_DEBT
  print("total CR", get_cr(total_coll, total_debt))

  print("UPDATED WHALE ICR", get_cr(WHALE_COLL / 1.1, WHALE_DEBT))


  ## 10% less
  updated_coll = total_coll / 1.1
  print("total CR", get_cr(updated_coll, total_debt))

main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment