mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 07:26:48 +00:00
Offline worst case trade fees (#274)
* Really basic getSimulated fee function everywhere * Worst case fees for all exchanges * Adds tests, fixes comment spacing. Adds wrapper logic. Makes test api key var name consistent. Removes some okcoin ETT tests * Removes redundant functions * linting issues. Fixes introduces huobi issues * More linting * Stops trying to hide ETT problems, uses iota * Skips ETT tests for now
This commit is contained in:
@@ -421,7 +421,7 @@ func (e *EXMO) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error) {
|
||||
var fee float64
|
||||
switch feeBuilder.FeeType {
|
||||
case exchange.CryptocurrencyTradeFee:
|
||||
fee = e.calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount)
|
||||
fee = calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount)
|
||||
case exchange.CryptocurrencyWithdrawalFee:
|
||||
fee = getCryptocurrencyWithdrawalFee(feeBuilder.Pair.Base)
|
||||
case exchange.InternationalBankWithdrawalFee:
|
||||
@@ -432,6 +432,8 @@ func (e *EXMO) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error) {
|
||||
fee = getInternationalBankDepositFee(feeBuilder.FiatCurrency,
|
||||
feeBuilder.Amount,
|
||||
feeBuilder.BankTransactionType)
|
||||
case exchange.OfflineTradeFee:
|
||||
fee = calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount)
|
||||
}
|
||||
|
||||
if fee < 0 {
|
||||
@@ -445,14 +447,8 @@ func getCryptocurrencyWithdrawalFee(c currency.Code) float64 {
|
||||
return WithdrawalFees[c]
|
||||
}
|
||||
|
||||
func (e *EXMO) calculateTradingFee(purchasePrice, amount float64) float64 {
|
||||
fee := 0.002
|
||||
return fee * amount * purchasePrice
|
||||
}
|
||||
|
||||
func calculateTradingFee(purchasePrice, amount float64) float64 {
|
||||
fee := 0.002
|
||||
return fee * amount * purchasePrice
|
||||
func calculateTradingFee(price, amount float64) float64 {
|
||||
return 0.002 * price * amount
|
||||
}
|
||||
|
||||
func getInternationalBankWithdrawalFee(c currency.Code, amount float64, bankTransactionType exchange.InternationalBankTransactionType) float64 {
|
||||
|
||||
Reference in New Issue
Block a user