def calculateSaleReturnTest(_supply, _reserveBalance, _reserveRatio, _sellAmount): fixed = calculateSaleReturn(_supply, _reserveBalance, _reserveRatio, _sellAmount) real = Decimal(_reserveBalance) * ( 1 - (1 - Decimal(_sellAmount) / Decimal(_supply))** (100 / Decimal(_reserveRatio))) return fixed, real
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount): _new_amount = calculatePurchaseReturn(_supply, _reserveBalance, _reserveRatio, _amount) _old_amount = calculateSaleReturn(_supply+_new_amount, _reserveBalance+_amount, _reserveRatio, _new_amount) if _old_amount > _amount: error = [] error.append('error occurred on:') error.append('_supply = {}'.format(_supply)) error.append('_reserveBalance = {}'.format(_reserveBalance)) error.append('_reserveRatio = {}'.format(_reserveRatio)) error.append('_amount = {}'.format(_amount)) raise BaseException('\n'.join(error)) return float(Decimal(_old_amount) / Decimal(_amount))
def formulaTest(supply,reserve,ratio,amount): newAmount = calculatePurchaseReturn(supply,reserve,ratio,amount) oldAmount = calculateSaleReturn(supply+newAmount,reserve+amount,ratio,newAmount) if oldAmount > amount: error = [] error.append('error occurred on:') error.append('supply = {}'.format(supply)) error.append('reserve = {}'.format(reserve)) error.append('ratio = {}'.format(ratio)) error.append('amount = {}'.format(amount)) raise BaseException('\n'.join(error)) return Decimal(oldAmount)/amount
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount): fixed = calculateSaleReturn(_supply, _reserveBalance, _reserveRatio, _amount) real = Decimal(_reserveBalance)*(1-(1-Decimal(_amount)/Decimal(_supply))**(100/Decimal(_reserveRatio))) if fixed > real: error = [] error.append('error occurred on:') error.append('_supply = {}'.format(_supply)) error.append('_reserveBalance = {}'.format(_reserveBalance)) error.append('_reserveRatio = {}'.format(_reserveRatio)) error.append('_amount = {}'.format(_amount)) error.append('fixed result = {}'.format(fixed)) error.append('real result = {}'.format(real)) raise BaseException('\n'.join(error)) return float(fixed / real)
def formulaTest(supply, reserve, ratio, amount): fixed = Decimal(calculateSaleReturn(supply, reserve, ratio, amount)) real = Decimal(reserve) * (1 - (1 - Decimal(amount) / Decimal(supply))** (100 / Decimal(ratio))) if fixed > real: error = [] error.append('error occurred on:') error.append('supply = {}'.format(supply)) error.append('reserve = {}'.format(reserve)) error.append('ratio = {}'.format(ratio)) error.append('amount = {}'.format(amount)) error.append('fixed = {}'.format(fixed)) error.append('real = {}'.format(real)) raise BaseException('\n'.join(error)) return fixed / real
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount): fixed = calculateSaleReturn(_supply, _reserveBalance, _reserveRatio, _amount) real = Decimal(_reserveBalance) * ( 1 - (1 - Decimal(_amount) / Decimal(_supply))** (100 / Decimal(_reserveRatio))) if fixed > real: error = [] error.append('error occurred on:') error.append('_supply = {}'.format(_supply)) error.append('_reserveBalance = {}'.format(_reserveBalance)) error.append('_reserveRatio = {}'.format(_reserveRatio)) error.append('_amount = {}'.format(_amount)) error.append('fixed result = {}'.format(fixed)) error.append('real result = {}'.format(real)) raise BaseException('\n'.join(error)) return float(fixed / real)