Skip to content

Commit

Permalink
added withdraw to ok* family fix ccxt#872
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Dec 17, 2017
1 parent 4ba30ea commit 6c0343f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions js/okcoinusd.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,43 @@ module.exports = class okcoinusd extends Exchange {
}, params));
}

async withdraw (currency, amount, address, params = {}) {
await this.loadMarkets ();
let lowercase = currency.toLowerCase () + '_usd';
// if (amount < 0.01)
// throw new ExchangeError (this.id + ' withdraw() requires amount > 0.01');
let request = {
'symbol': lowercase,
'withdraw_address': address,
'withdraw_amount': amount,
'target': 'address', // or okcn, okcom, okex
};
let query = params;
if ('chargefee' in query) {
request['chargefee'] = query['chargefee'];
query = this.omit (query, 'chargefee');
} else {
throw new ExchangeError (this.id + ' withdraw() requires a `chargefee` parameter');
}
let password = undefined;
if (this.password) {
password = this.password;
} else if ('password' in query) {
request['trade_pwd'] = query['password'];
query = this.omit (query, 'password');
} else if ('trade_pwd' in query) {
request['trade_pwd'] = query['trade_pwd'];
query = this.omit (query, 'trade_pwd');
}
if (!password)
throw new ExchangeError (this.id + ' withdraw() requires this.password set on the exchange instance or a password / trade_pwd parameter');
let response = await this.privatePostWithdraw (this.extend (request, query));
return {
'info': response,
'id': this.safeString (response, 'withdraw_id'),
};
}

sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
let url = '/';
if (api != 'web')
Expand Down

0 comments on commit 6c0343f

Please sign in to comment.