Skip to content

Instantly share code, notes, and snippets.

@highfestiva
highfestiva / binance-liquidation-calculator.py
Last active November 8, 2024 03:23
CLI Binance liquidation calculation formula
#!/usr/bin/env python3
'''2021-03-26: Reverse-engineer by searching for the following terms in features*.js:
- bracketMaintenanceMarginRate
- cumFastMaintenanceAmount
- bracketNotionalFloor
- bracketNotionalCap'''
# (max) position, maintenance margin, maintenance amount
maint_lookup_table = [