implement withdrawal request on binance

This commit is contained in:
c9s 2021-05-12 02:15:22 +08:00
parent b27a840607
commit fd6fe56f32
2 changed files with 17 additions and 1 deletions

View File

@ -204,6 +204,21 @@ func (e *Exchange) getLaunchDate() (time.Time, error) {
return time.Date(2017, time.July, 14, 0, 0, 0, 0, loc), nil
}
func (e *Exchange) Withdrawal(ctx context.Context, currency string, amount fixedpoint.Value, address string) error {
response, err := e.Client.NewCreateWithdrawService().
Asset(currency).
Address(address).
Amount(fmt.Sprintf("%f", amount.Float64())).
Do(ctx)
if err != nil {
return err
}
log.Infof("withdrawal request sent, response: %+v", response)
return nil
}
func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (allWithdraws []types.Withdraw, err error) {
startTime := since
@ -589,7 +604,7 @@ func newSpotClientOrderID(originalID string) (clientOrderID string) {
if originalID != "" {
// try to keep the whole original client order ID if user specifies it.
if prefixLen + len(originalID) > 32 {
if prefixLen+len(originalID) > 32 {
return originalID
}

View File

@ -541,6 +541,7 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
return a, nil
}
func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (allWithdraws []types.Withdraw, err error) {
startTime := since
limit := 1000