Skip to content

Commit

Permalink
Add WithdrawInfo endpoint (#47)
Browse files Browse the repository at this point in the history
* Add withdrawal of funds

* Add withdrawal status fetch

* WithdrawInfo endpoint
  • Loading branch information
byroncoetsee authored Aug 20, 2023
1 parent 360f6f5 commit 53eb69a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rest/private_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ func (api *Kraken) GetDepositStatus(method string, assets ...string) ([]DepositS
return response, nil
}

// WithdrawInfo - Retrieve fee information about potential withdrawals for a particular asset, key and amount.
func (api *Kraken) WithdrawInfo(asset string, key string, amount float64) (response WithdrawInfo, err error) {
data := url.Values{
"asset": {asset},
"key": {key},
"amount": {strconv.FormatFloat(amount, 'f', 8, 64)},
}

if err = api.request("WithdrawInfo", true, data, &response); err != nil {
return response, err
}
return response, nil
}

// WithdrawFunds - returns withdrawal response
func (api *Kraken) WithdrawFunds(asset string, key string, amount float64) (response WithdrawFunds, err error) {
data := url.Values{
Expand Down
8 changes: 8 additions & 0 deletions rest/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ type DepositStatuses struct {
Status string `json:"status"`
}

// WithdrawInfo - response on WithdrawInfo request
type WithdrawInfo struct {
Method string `json:"method,omitempty"`
Limit string `json:"limit,omitempty"`
Amount string `json:"amount,omitempty"`
Fee string `json:"fee,omitempty"`
}

// WithdrawFunds - response on WithdrawFunds request
type WithdrawFunds struct {
RefID string `json:"refid"`
Expand Down

0 comments on commit 53eb69a

Please sign in to comment.