mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 23:16:49 +00:00
gRPC/Engine/Exchanges: Implement direct getwithdrawalshistory method (#600)
* GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce * return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo * removed the Binance extra method GetClosedOrder * func description corrected * removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side * GetClosedOrder implementation moved to GetOrderInfo * changed GetOrderInfo params * removed Canceled order.Type used for Kraken * update QueryOrder in gctscript * add missed params to QueryOrder validator (gctscript) * fixed testing issues * GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce * return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo * removed the Binance extra method GetClosedOrder * func description corrected * removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side * GetClosedOrder implementation moved to GetOrderInfo * changed GetOrderInfo params * removed Canceled order.Type used for Kraken * update QueryOrder in gctscript * add missed params to QueryOrder validator (gctscript) * fixed testing issues * pull previous changes * linter issues fix * updated query_order exmple in gctscript, fixed params check * removed orderPair unnecessary conversion * added wsCancelAllOrders, fixed bugs * fixed Kraken wsAddOrder method * cleanup * CancelBatchOrders implementation * changed CancelBatchOrders signature * fixed tests and wrappers * btcmarkets_test fix * cleanup * cleanup * changed CancelBatchOrders signature * fmt * Update configtest.json * Update configtest.json * rollback configtest * refactored Kraken wsHandleData to allow tests * removed unnecessary error test in TestWsAddOrderJSON * dependencies updates * fixed issue with PortfolioSleepDelay set on startup * add GetWithdrawalsHistory method to exchanges interface * param name changes * add extra params for Binance WithdrawStatus method * add Binance TestWithdrawHistory * linter errors fix Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>
This commit is contained in:
@@ -207,6 +207,11 @@ func (a *Alphapoint) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (a *Alphapoint) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (a *Alphapoint) GetRecentTrades(_ currency.Pair, _ asset.Item) ([]trade.Data, error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
|
||||
@@ -746,6 +746,48 @@ func (b *Binance) WithdrawCrypto(asset, address, addressTag, name, amount string
|
||||
return resp.ID, nil
|
||||
}
|
||||
|
||||
// WithdrawStatus gets the status of recent withdrawals
|
||||
// status `param` used as string to prevent default value 0 (for int) interpreting as EmailSent status
|
||||
func (b *Binance) WithdrawStatus(c currency.Code, status string, startTime, endTime int64) ([]WithdrawStatusResponse, error) {
|
||||
var response struct {
|
||||
Success bool `json:"success"`
|
||||
WithdrawList []WithdrawStatusResponse `json:"withdrawList"`
|
||||
}
|
||||
|
||||
path := b.API.Endpoints.URL + withdrawalHistory
|
||||
params := url.Values{}
|
||||
params.Set("asset", c.String())
|
||||
|
||||
if status != "" {
|
||||
i, err := strconv.Atoi(status)
|
||||
if err != nil {
|
||||
return response.WithdrawList, fmt.Errorf("wrong param (status): %s. Error: %v", status, err)
|
||||
}
|
||||
|
||||
switch i {
|
||||
case EmailSent, Cancelled, AwaitingApproval, Rejected, Processing, Failure, Completed:
|
||||
default:
|
||||
return response.WithdrawList, fmt.Errorf("wrong param (status): %s", status)
|
||||
}
|
||||
|
||||
params.Set("status", status)
|
||||
}
|
||||
|
||||
if startTime > 0 {
|
||||
params.Set("startTime", strconv.FormatInt(startTime, 10))
|
||||
}
|
||||
|
||||
if endTime > 0 {
|
||||
params.Set("endTime", strconv.FormatInt(endTime, 10))
|
||||
}
|
||||
|
||||
if err := b.SendAuthHTTPRequest(http.MethodGet, path, params, request.Unset, &response); err != nil {
|
||||
return response.WithdrawList, err
|
||||
}
|
||||
|
||||
return response.WithdrawList, nil
|
||||
}
|
||||
|
||||
// GetDepositAddressForCurrency retrieves the wallet address for a given currency
|
||||
func (b *Binance) GetDepositAddressForCurrency(currency string) (string, error) {
|
||||
path := b.API.Endpoints.URL + depositAddress
|
||||
|
||||
@@ -709,6 +709,21 @@ func TestWithdraw(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawHistory(t *testing.T) {
|
||||
t.Parallel()
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders && !mockTests {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
_, err := b.GetWithdrawalsHistory(currency.XBT)
|
||||
switch {
|
||||
case areTestAPIKeysSet() && err != nil:
|
||||
t.Error("GetWithdrawalsHistory() error", err)
|
||||
case !areTestAPIKeysSet() && err == nil && !mockTests:
|
||||
t.Error("GetWithdrawalsHistory() expecting an error when no keys are set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -6,6 +6,17 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
)
|
||||
|
||||
// withdrawals status codes description
|
||||
const (
|
||||
EmailSent = iota
|
||||
Cancelled
|
||||
AwaitingApproval
|
||||
Rejected
|
||||
Processing
|
||||
Failure
|
||||
Completed
|
||||
)
|
||||
|
||||
// Response holds basic binance api response data
|
||||
type Response struct {
|
||||
Code int `json:"code"`
|
||||
@@ -607,6 +618,19 @@ type WithdrawResponse struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
// WithdrawStatusResponse defines a withdrawal status response
|
||||
type WithdrawStatusResponse struct {
|
||||
Amount float64 `json:"amount"`
|
||||
TransactionFee float64 `json:"transactionFee"`
|
||||
Address string `json:"address"`
|
||||
TxID string `json:"txId"`
|
||||
ID string `json:"id"`
|
||||
Asset string `json:"asset"`
|
||||
ApplyTime int64 `json:"applyTime"`
|
||||
Status int64 `json:"status"`
|
||||
Network string `json:"network"`
|
||||
}
|
||||
|
||||
// UserAccountStream contains a key to maintain an authorised
|
||||
// websocket connection
|
||||
type UserAccountStream struct {
|
||||
|
||||
@@ -498,6 +498,29 @@ func (b *Binance) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Binance) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
w, err := b.WithdrawStatus(c, "", 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range w {
|
||||
resp = append(resp, exchange.WithdrawalHistory{
|
||||
Status: strconv.FormatInt(w[i].Status, 10),
|
||||
TransferID: w[i].ID,
|
||||
Currency: w[i].Asset,
|
||||
Amount: w[i].Amount,
|
||||
Fee: w[i].TransactionFee,
|
||||
CryptoToAddress: w[i].Address,
|
||||
CryptoTxID: w[i].TxID,
|
||||
Timestamp: time.Unix(w[i].ApplyTime/1000, 0),
|
||||
})
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Binance) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -484,6 +484,11 @@ func (b *Bitfinex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bitfinex) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Bitfinex) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return b.GetHistoricTrades(p, assetType, time.Now().Add(-time.Hour), time.Now())
|
||||
|
||||
@@ -304,6 +304,11 @@ func (b *Bitflyer) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bitflyer) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns recent historic trades
|
||||
func (b *Bitflyer) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -331,6 +331,11 @@ func (b *Bithumb) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bithumb) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Bithumb) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -423,6 +423,11 @@ func (b *Bitmex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bitmex) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Bitmex) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return b.GetHistoricTrades(p, assetType, time.Now().Add(-time.Hour), time.Now())
|
||||
|
||||
@@ -398,6 +398,11 @@ func (b *Bitstamp) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bitstamp) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Bitstamp) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -375,6 +375,11 @@ func (b *Bittrex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *Bittrex) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *Bittrex) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -426,6 +426,11 @@ func (b *BTCMarkets) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *BTCMarkets) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *BTCMarkets) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -408,6 +408,11 @@ func (b *BTSE) withinLimits(pair currency.Pair, amount float64) bool {
|
||||
amount > val.MaxOrderSize
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (b *BTSE) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (b *BTSE) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -438,6 +438,11 @@ func (c *CoinbasePro) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (c *CoinbasePro) GetWithdrawalsHistory(cur currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (c *CoinbasePro) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -507,6 +507,11 @@ func (c *Coinbene) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (c *Coinbene) GetWithdrawalsHistory(cur currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (c *Coinbene) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -500,6 +500,11 @@ func (c *COINUT) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (c *COINUT) GetWithdrawalsHistory(cur currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (c *COINUT) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -127,6 +127,21 @@ type FundHistory struct {
|
||||
BankFrom string
|
||||
}
|
||||
|
||||
// WithdrawalHistory holds exchange Withdrawal history data
|
||||
type WithdrawalHistory struct {
|
||||
Status string
|
||||
TransferID string
|
||||
Description string
|
||||
Timestamp time.Time
|
||||
Currency string
|
||||
Amount float64
|
||||
Fee float64
|
||||
TransferType string
|
||||
CryptoToAddress string
|
||||
CryptoTxID string
|
||||
BankTo string
|
||||
}
|
||||
|
||||
// Features stores the supported and enabled features
|
||||
// for the exchange
|
||||
type Features struct {
|
||||
|
||||
@@ -363,6 +363,11 @@ func (e *EXMO) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (e *EXMO) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (e *EXMO) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -438,6 +438,11 @@ func (f *FTX) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (f *FTX) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (f *FTX) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return f.GetHistoricTrades(p, assetType, time.Now().Add(-time.Hour), time.Now())
|
||||
|
||||
@@ -417,6 +417,11 @@ func (g *Gateio) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (g *Gateio) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (g *Gateio) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -331,6 +331,11 @@ func (g *Gemini) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (g *Gemini) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (g *Gemini) GetRecentTrades(currencyPair currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return g.GetHistoricTrades(currencyPair, assetType, time.Time{}, time.Time{})
|
||||
|
||||
@@ -450,6 +450,11 @@ func (h *HitBTC) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (h *HitBTC) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (h *HitBTC) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return h.GetHistoricTrades(p, assetType, time.Now().Add(-time.Hour), time.Now())
|
||||
|
||||
@@ -545,6 +545,11 @@ func (h *HUOBI) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (h *HUOBI) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (h *HUOBI) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -58,6 +58,7 @@ type IBotExchange interface {
|
||||
GetOrderInfo(orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
|
||||
GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
|
||||
GetOrderHistory(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
|
||||
GetWithdrawalsHistory(code currency.Code) ([]WithdrawalHistory, error)
|
||||
GetActiveOrders(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
|
||||
WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
|
||||
WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
|
||||
|
||||
@@ -308,6 +308,11 @@ func (i *ItBit) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (i *ItBit) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (i *ItBit) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -503,9 +503,9 @@ func (k *Kraken) GetWithdrawInfo(currency string, amount float64) (WithdrawInfor
|
||||
Result WithdrawInformation `json:"result"`
|
||||
}
|
||||
params := url.Values{}
|
||||
params.Set("asset ", currency)
|
||||
params.Set("key ", "")
|
||||
params.Set("amount ", fmt.Sprintf("%f", amount))
|
||||
params.Set("asset", currency)
|
||||
params.Set("key", "")
|
||||
params.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
|
||||
if err := k.SendAuthenticatedHTTPRequest(krakenWithdrawInfo, params, &response); err != nil {
|
||||
return response.Result, err
|
||||
@@ -1098,7 +1098,7 @@ func (k *Kraken) WithdrawStatus(c currency.Code, method string) ([]WithdrawStatu
|
||||
}
|
||||
|
||||
params := url.Values{}
|
||||
params.Set("asset ", c.String())
|
||||
params.Set("asset", c.String())
|
||||
if method != "" {
|
||||
params.Set("method", method)
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ func (k *Kraken) WithdrawCancel(c currency.Code, refID string) (bool, error) {
|
||||
}
|
||||
|
||||
params := url.Values{}
|
||||
params.Set("asset ", c.String())
|
||||
params.Set("asset", c.String())
|
||||
params.Set("refid", refID)
|
||||
|
||||
if err := k.SendAuthenticatedHTTPRequest(krakenWithdrawCancel, params, &response); err != nil {
|
||||
|
||||
@@ -516,6 +516,25 @@ func (k *Kraken) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (k *Kraken) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
withdrawals, err := k.WithdrawStatus(c, "")
|
||||
for i := range withdrawals {
|
||||
resp = append(resp, exchange.WithdrawalHistory{
|
||||
Status: withdrawals[i].Status,
|
||||
TransferID: withdrawals[i].Refid,
|
||||
Timestamp: time.Unix(int64(withdrawals[i].Time), 0),
|
||||
Amount: withdrawals[i].Amount,
|
||||
Fee: withdrawals[i].Fee,
|
||||
CryptoToAddress: withdrawals[i].Info,
|
||||
CryptoTxID: withdrawals[i].TxID,
|
||||
Currency: c.String(),
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (k *Kraken) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -351,6 +351,11 @@ func (l *LakeBTC) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (l *LakeBTC) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (l *LakeBTC) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -347,6 +347,11 @@ func (l *Lbank) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (l *Lbank) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (l *Lbank) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return l.GetHistoricTrades(p, assetType, time.Now().Add(-time.Hour), time.Now())
|
||||
|
||||
@@ -286,6 +286,11 @@ func (l *LocalBitcoins) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (l *LocalBitcoins) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (l *LocalBitcoins) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -464,6 +464,11 @@ func (o *OKCoin) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, st
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (o *OKCoin) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (o *OKCoin) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -695,6 +695,11 @@ func (o *OKEX) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, star
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (o *OKEX) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetHistoricTrades returns historic trade data within the timeframe provided
|
||||
func (o *OKEX) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -462,6 +462,11 @@ func (o *OKGroup) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (o *OKGroup) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetActiveOrders retrieves any orders that are active/open
|
||||
func (o *OKGroup) GetActiveOrders(req *order.GetOrdersRequest) (resp []order.Detail, err error) {
|
||||
err = req.Validate()
|
||||
|
||||
@@ -410,6 +410,11 @@ func (p *Poloniex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (p *Poloniex) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (p *Poloniex) GetRecentTrades(currencyPair currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
return p.GetHistoricTrades(currencyPair, assetType, time.Now().Add(-time.Minute*15), time.Now())
|
||||
|
||||
@@ -327,6 +327,11 @@ func (y *Yobit) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (y *Yobit) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (y *Yobit) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
@@ -395,6 +395,11 @@ func (z *ZB) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (z *ZB) GetWithdrawalsHistory(c currency.Code) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
func (z *ZB) GetRecentTrades(p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user