mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 07:26:47 +00:00
Makefile: add new recipes and linter features (#244)
* Makefile: add new recipes and linter features * expand linter coverage and fix issues * Update makefile * address PR nitterinos
This commit is contained in:
@@ -363,17 +363,14 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
|
||||
request := make(map[string]interface{})
|
||||
url := i.APIUrl + path
|
||||
|
||||
if params != nil {
|
||||
for key, value := range params {
|
||||
request[key] = value
|
||||
}
|
||||
for key, value := range params {
|
||||
request[key] = value
|
||||
}
|
||||
|
||||
PayloadJSON := []byte("")
|
||||
var err error
|
||||
|
||||
if params != nil {
|
||||
|
||||
PayloadJSON, err = common.JSONEncode(request)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -410,7 +407,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
|
||||
RequestID string `json:"requestId"`
|
||||
}{}
|
||||
|
||||
err = i.SendPayload(method, url, headers, bytes.NewBuffer([]byte(PayloadJSON)), &intermediary, true, i.Verbose)
|
||||
err = i.SendPayload(method, url, headers, bytes.NewBuffer(PayloadJSON), &intermediary, true, i.Verbose)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -434,7 +431,7 @@ func (i *ItBit) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
case exchange.CryptocurrencyTradeFee:
|
||||
fee = calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount, feeBuilder.IsMaker)
|
||||
case exchange.InternationalBankWithdrawalFee:
|
||||
fee = getInternationalBankWithdrawalFee(feeBuilder.CurrencyItem, feeBuilder.Amount, feeBuilder.BankTransactionType)
|
||||
fee = getInternationalBankWithdrawalFee(feeBuilder.CurrencyItem, feeBuilder.BankTransactionType)
|
||||
}
|
||||
|
||||
if fee < 0 {
|
||||
@@ -454,7 +451,7 @@ func calculateTradingFee(purchasePrice, amount float64, isMaker bool) float64 {
|
||||
return feePercent * purchasePrice * amount
|
||||
}
|
||||
|
||||
func getInternationalBankWithdrawalFee(currency string, amount float64, bankTransactionType exchange.InternationalBankTransactionType) float64 {
|
||||
func getInternationalBankWithdrawalFee(currency string, bankTransactionType exchange.InternationalBankTransactionType) float64 {
|
||||
var fee float64
|
||||
if (bankTransactionType == exchange.Swift || bankTransactionType == exchange.WireTransfer) && currency == symbol.USD {
|
||||
fee = 40
|
||||
|
||||
@@ -371,7 +371,7 @@ func TestWithdraw(t *testing.T) {
|
||||
|
||||
_, err := i.WithdrawCryptocurrencyFunds(withdrawCryptoRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected 'Not supported', recieved %v", err)
|
||||
t.Errorf("Expected 'Not supported', received %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ func TestWithdrawFiat(t *testing.T) {
|
||||
|
||||
_, err := i.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
|
||||
|
||||
_, err := i.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user