mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
FTX: Margin lending/borrow rate history (#981)
* Adds lending rates/borrows to FTX and the command * Movements, renames, rpc test * Fleshing out rpc response * Allows rpcserver to calculate offline (but not gctcli). Expands tests * rn structs. add exchange_wrapper_issues support * Adds a nice yearly rate * Surprise yearly borrow rate! * Rn+Mv to margin package. Fixes some serious whoopsies * Adds average lend/borrow rates instead of sum * rm oopsie whoopsie * This is what the linter was having an issue with * re-gen * lintl * niteroos
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/deposit"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/margin"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
|
||||
@@ -846,6 +847,31 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config)
|
||||
Error: msg,
|
||||
Response: withdrawFiatFundsInternationalResponse,
|
||||
})
|
||||
|
||||
marginRateHistoryRequest := &margin.RateHistoryRequest{
|
||||
Exchange: e.GetName(),
|
||||
Asset: assetTypes[i],
|
||||
Currency: p.Base,
|
||||
StartDate: time.Now().Add(-time.Hour * 24),
|
||||
EndDate: time.Now(),
|
||||
GetPredictedRate: true,
|
||||
GetLendingPayments: true,
|
||||
GetBorrowRates: true,
|
||||
GetBorrowCosts: true,
|
||||
}
|
||||
marginRateHistoryResponse, err := e.GetMarginRatesHistory(context.TODO(), marginRateHistoryRequest)
|
||||
msg = ""
|
||||
if err != nil {
|
||||
msg = err.Error()
|
||||
responseContainer.ErrorCount++
|
||||
}
|
||||
responseContainer.EndpointResponses = append(responseContainer.EndpointResponses, EndpointResponse{
|
||||
SentParams: jsonifyInterface([]interface{}{marginRateHistoryRequest}),
|
||||
Function: "GetMarginRatesHistory",
|
||||
Error: msg,
|
||||
Response: marginRateHistoryResponse,
|
||||
})
|
||||
|
||||
response = append(response, responseContainer)
|
||||
}
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user