Created
February 7, 2018 11:22
-
-
Save salamantos/c3f6b657fc2008d5d720f5ad71c98193 to your computer and use it in GitHub Desktop.
Расчет выгоды от покупки и продажи валюты
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FEE = 0.001 | |
REBATE = 0.0001 | |
USDT = 1.0 | |
RUB = 56.0 | |
# Buy coins; sell coins; profit in USDT | |
def count_profit(byu_price, sell_price, amount, currency = USDT): | |
""" | |
Цена покупки/продажи в USDT; currency - валюта, в которой рассчитывается профит | |
Возвращает пару (выгода, комиссия) | |
""" | |
total = amount * byu_price | |
sum_fee = FEE * total | |
sum_rebate = REBATE * total | |
res_total = amount * sell_price | |
sum_fee += FEE * res_total | |
sum_rebate += REBATE * res_total | |
return currency * (res_total - total - (sum_fee + sum_rebate)), currency * (sum_fee + sum_rebate) | |
count_profit(445, 450, 0.25, USDT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment