Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(exchange-api): add withdraws api #7

Merged
merged 7 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,21 @@ wrapper for upbit API
- [postOrders](/docs/exchange-api/orders/post-orders.md)
- Request An Order
- Withdrawal
- [ ] `GET /v1/withdraws`
- [ ] `GET /v1/withdraw`
- [ ] `GET /v1/withdraws/chance`
- [ ] `POST /v1/withdraws/coin`
- [ ] `POST /v1/withdraws/krw`
- [x] `GET /v1/withdraws`
- [getWithdraws](/docs/exchange-api/withdraw/get-withdraws.md)
- Withdraws List
- [x] `GET /v1/withdraw`
- [getWithdraw](/docs/exchange-api/withdraw/get-withdraw.md)
- Withdraw Detail
- [x] `GET /v1/withdraws/chance`
- [getWithdrawsChance](/docs/exchange-api/withdraw/get-withdraws-chance.md)
- Check the possible withdrawal information of the Currency.
- [x] `POST /v1/withdraws/coin`
- [postWithdrawsCoin](/docs/exchange-api/withdraw/post-withdraws-coin.md)
- Request an Withdraw Coin
- [x] `POST /v1/withdraws/krw`
- [postWithdrawsKrw](/docs/exchange-api/withdraw/post-withdraws-krw.md)
- Request an Withdraw Krw
- Deposit
- [ ] `GET /v1/deposits`
- [ ] `GET /v1/deposit`
Expand Down Expand Up @@ -92,7 +102,7 @@ wrapper for upbit API
### Commit-message
- The commit message accurately specifies the work scope.
- The commit message refers to [semantic-release](https://github.com/semantic-release/semantic-release#how-does-it-work)
- [Reference](https://www.conventionalcommits.org/ko/v1.0.0/)
- [Reference](https://www.conventionalcommits.org/)

#### Link
- [Semantic-Release](https://github.com/semantic-release/semantic-release)
Expand Down
51 changes: 51 additions & 0 deletions docs/exchange-api/withdraw/get-withdraw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
### Example
```typescript

/** Either (uuid, txid) value must be included. */
const param = {
/** required */
/** Crypto Currency Code */
currenecy: 'XRP',
/** optional */
/** Withdraw Unique ID */
uuids: '35a4f1dc-1db5-4d6b-89b5-7ec137875956',
/** optional */
/** Withdraw TX ID */
txids: '98c15999f0bdc4ae0e8a-ed35868bb0c204fe6ec29e4058a3451e-88636d1040f4baddf943274ce37cf9cc',
};

// ES6
import ApiUpbit from 'node-upbit-api';

const res = await new ApiUpbit('accessKey', 'secretKey').getWithdraw(param);
console.log(res);

// ES5
var ApiUpbit = required('node-upbit-api');

new ApiUpbit('accessKey', 'secretKey').getWithdraw(param).then(res => console.log(res));

// console.log(res)
{
/** Deposit And Withdrawal Type */
type: 'withdraw',
/** Withdraw Unique ID */
uuid: '35a4f1dc-1db5-4d6b-89b5-7ec137875956',
/** Crypto Currenecy Code */
currency: 'XRP';
/** Withdraw TX ID */
txid: '98c15999f0bdc4ae0e8a-ed35868bb0c204fe6ec29e4058a3451e-88636d1040f4baddf943274ce37cf9cc';
/** Withdrawal Status */
state: 'submitting' | 'submitted' | 'almost_accepted' | 'rejected' | 'accepted' | 'processing' | 'done' | 'canceled',
/** Create Datetime */
created_at: '2019-02-28T15:17:51+09:00';
/** Done Datetime */
done_at: '2019-02-28T15:22:12+09:00';
/** Withdraw Price/Count */
amount: '1.0';
/** Withdraw Fee */
fee: '0.0';
/** Withdraw Type */
transaction_type: 'default' | 'internal';
}
```
94 changes: 94 additions & 0 deletions docs/exchange-api/withdraw/get-withdraws-chance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
### Example
```typescript

const param = {
/** required */
/** Crypto Currency Code */
currency: 'BTC'
};

// ES6
import ApiUpbit from 'node-upbit-api';

const res = await new ApiUpbit('accessKey', 'secretKey').getWithdrawsChance(param);
console.log(res);

// ES5
var ApiUpbit = required('node-upbit-api');

new ApiUpbit('accessKey', 'secretKey').getWithdrawsChance(param).then(res => console.log(res));

// console.log(res)
{
/** User Security Level */
member_level: {
/** Security Level */
security_level: 3,
/** Fee Level */
fee_level: 0,
/** Email Verified */
email_verified: true,
/** Real Name Verified */
identity_auth_verified: true,
/** Bank Account Verified */
bank_account_verified: true,
/** Kakao Pay Verified */
kakao_pay_auth_verified: false,
/** Lock This Account */
locked: false,
/** Wallet Withdraw Locked */
wallet_locked: false
},
/** Currency Information */
currency: {
/** Currency Code */
code: 'BTC',
/** Withdraw Fee */
withdraw_fee: '0.0005',
/** Is Coin */
is_coin: true,
/** Currency Wallet State */
wallet_state: 'working',
/** Wallet Support */
wallet_support: [
'deposit',
'withdraw',
]
},
/** User Account Information */
account: {
/** Currency Code */
currency: 'BTC',
/** Available Order Price/Count */
balance: '10.0',
/** Locked In Order Price/Count */
locked: '0.0',
/** Average Buy Price */
avg_buy_price: '8042000',
/** whether average buy price modify */
avg_buy_price_modified: false,
/** Base currency */
unit_currency: 'KRW',
},
/** Information on withdrawal restrictions */
withdraw_limit: {
/** Currency Code */
currency: 'BTC',
/** withdraw Minimum Price/Count */
minimum: null,
/** One Time Withdraw Maximum */
onetime: null,
/** Daily Withdraw Maximum */
daily: '10.0',
/** Remaining Daily Withdraw Limit */
remaining_daily: '10.0',
/** Remaining Daily Withdraw Limit On KRW */
remaining_daily_krw: '0.0',
/** Withdraw Price/Count Number of decimal places */
fixed: null,
/** Is Support Withdraw */
can_withdraw: true,
}
}
```

65 changes: 65 additions & 0 deletions docs/exchange-api/withdraw/get-withdraws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
### Example
```typescript

const param = {
/** required */
/** Crypto Currency Code */
currenecy: 'XRP';
/** required */
/** Withdrawal Status */
state: 'submitting' | 'submitted' | 'almost_accepted' | 'rejected' | 'accepted' | 'processing' | 'done' | 'canceled',
/** required */
/** Withdraw Unique ID */
uuids: [];
/** required */
/** Withdraw TX ID */
txids: [];
/** optional */
/** Default 100, Max 100 */
limit: 100;
/** optional */
/** Default 1 */
page: 1;
/** optional */
/** Default 'desc' */
order_by: 'desc' | 'asc';
};

// ES6
import ApiUpbit from 'node-upbit-api';

const res = await new ApiUpbit('accessKey', 'secretKey').getWithdraws(param);
console.log(res);

// ES5
var ApiUpbit = required('node-upbit-api');

new ApiUpbit('accessKey', 'secretKey').getWithdraws(param).then(res => console.log(res));

// console.log(res)
[
{
/** Deposit And Withdrawal Type */
type: 'withdraw',
/** Withdraw Unique ID */
uuid: '35a4f1dc-1db5-4d6b-89b5-7ec137875956',
/** Crypto Currenecy Code */
currency: 'XRP';
/** Withdraw TX ID */
txid: '98c15999f0bdc4ae0e8a-ed35868bb0c204fe6ec29e4058a3451e-88636d1040f4baddf943274ce37cf9cc';
/** Withdrawal Status */
state: 'submitting' | 'submitted' | 'almost_accepted' | 'rejected' | 'accepted' | 'processing' | 'done' | 'canceled',
/** Create Datetime */
created_at: '2019-02-28T15:17:51+09:00';
/** Done Datetime */
done_at: '2019-02-28T15:22:12+09:00';
/** Withdraw Price/Count */
amount: '1.0';
/** Withdraw Fee */
fee: '0.0';
/** Withdraw Type */
transaction_type: 'default' | 'internal';
}
]
```

59 changes: 59 additions & 0 deletions docs/exchange-api/withdraw/post-withdraws-coin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
### Example
```typescript

/** Either (uuid, txid) value must be included. */
const param = {
/** required */
/** Crypto Currency Code */
currenecy: 'XRP',
/** required */
/** Withdraw Count */
amount: 10,
/** required */
/** Withdrawal Address Registered in the Withdrawal Address */
address: 'r213421-df232f12-f321fd-21f32',
/** optional */
/** Second Withdrawal Address (Only the Coins Needed) */
secondary_address: '13f1d123v-f2c1crvcf-rf13cv1x-fr1fc2',
/** optional */
/** Withdraw Transaction Type */
transaction_type: 'default' | 'interanl',
};

// ES6
import ApiUpbit from 'node-upbit-api';

const res = await new ApiUpbit('accessKey', 'secretKey').postWithdrawsCoin(param);
console.log(res);

// ES5
var ApiUpbit = required('node-upbit-api');

new ApiUpbit('accessKey', 'secretKey').postWithdrawsCoin(param).then(res => console.log(res));

// console.log(res)
{
/** Deposit And Withdrawal Type */
type: 'withdraw',
/** Withdraw Unique ID */
uuid: '35a4f1dc-1db5-4d6b-89b5-7ec137875956',
/** Crypto Currenecy Code */
currency: 'XRP',
/** Withdraw TX ID */
txid: '98c15999f0bdc4ae0e8a-ed35868bb0c204fe6ec29e4058a3451e-88636d1040f4baddf943274ce37cf9cc',
/** Withdrawal Status */
state: 'submitting' | 'submitted' | 'almost_accepted' | 'rejected' | 'accepted' | 'processing' | 'done' | 'canceled',
/** Create Datetime */
created_at: '2019-02-28T15:17:51+09:00',
/** Done Datetime */
done_at: '2019-02-28T15:22:12+09:00',
/** Withdraw Price/Count */
amount: '10.0',
/** Withdraw Fee */
fee: '0.0',
/** KRW Conversion price. */
krw_amount: '5000.0',
/** Withdraw Type */
transaction_type: 'default' | 'internal',
}
```
44 changes: 44 additions & 0 deletions docs/exchange-api/withdraw/post-withdraws-krw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
### Example
```typescript

const param = {
/** required */
/** Withdraw price */
amount: 100000,
};

// ES6
import ApiUpbit from 'node-upbit-api';

const res = await new ApiUpbit('accessKey', 'secretKey').postWithdrawsKrw(param);
console.log(res);

// ES5
var ApiUpbit = required('node-upbit-api');

new ApiUpbit('accessKey', 'secretKey').postWithdrawsKrw(param).then(res => console.log(res));

// console.log(res)
{
/** Deposit And Withdrawal Type */
type: 'withdraw',
/** Withdraw Unique ID */
uuid: '35a4f1dc-1db5-4d6b-89b5-7ec137875956',
/** Crypto Currenecy Code */
currency: 'KRW',
/** Withdraw TX ID */
txid: '98c15999f0bdc4ae0e8a-ed35868bb0c204fe6ec29e4058a3451e-88636d1040f4baddf943274ce37cf9cc',
/** Withdrawal Status */
state: 'submitting' | 'submitted' | 'almost_accepted' | 'rejected' | 'accepted' | 'processing' | 'done' | 'canceled',
/** Create Datetime */
created_at: '2019-02-28T15:17:51+09:00',
/** Done Datetime */
done_at: null,
/** Withdraw Price/Count */
amount: '100000',
/** Withdraw Fee */
fee: '0.0',
/** Withdraw Type */
transaction_type: 'default' | 'internal',
}
```
Loading