Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | 1x 1x 3x 1x 2x 1x 2x 1x 2x 2x 1x 2x 1x 1x 2x 2x 1x 1x | import { Common } from './common';
import { OrderBy } from './interfaces/common/orderBy.type';
import { Trade } from './interfaces/common/trade.interface';
import { DepositAddress } from './interfaces/private/depositAddress.interface';
import { Deposit } from './interfaces/private/deposits.interface';
import { Members } from './interfaces/private/members.interface';
import { Order, OrdType, Side } from './interfaces/private/orders.interface';
import { Withdraw } from './interfaces/private/withdraw.interface';
export class Private {
private common: Common;
constructor(
accessKey?: string,
secret?: string,
) {
this.common = new Common(accessKey, secret);
}
public async deposit(txid: string): Promise<Deposit> {
const qs = {
txid,
};
return this.common.request(true, 'GET', 'deposit.json', qs);
}
public async deposits(currency?: string, limit?: number, state?: string): Promise<Deposit> {
const qs = {
currency,
limit,
state,
};
return this.common.request(true, 'GET', 'deposits.json', qs);
}
public async depositAddress(currency: string): Promise<DepositAddress> {
const qs = {
currency,
};
return this.common.request(true, 'GET', 'deposit_address.json', qs);
}
public async members(): Promise<Members> {
return this.common.request(true, 'GET', 'members/me.json');
}
public async getOrder(id: number): Promise<Trade> {
const qs = {
id,
};
return this.common.request(true, 'GET', 'order.json', qs);
}
public async getOrders(market: string, state?: string, limit?: number, page?: number, orderBy?: OrderBy): Promise<Trade[]> {
const qs = {
market,
state,
limit,
page,
order_by: orderBy,
};
return this.common.request(true, 'GET', 'orders.json', qs);
}
public async postOrder(market: string, side: Side, volume: number, price?: number, ordType?: OrdType): Promise<Trade> {
const body = {
market,
side,
volume,
price,
ord_type: ordType,
};
return this.common.request(true, 'POST', 'orders.json', null, body);
}
public async postOrders(market: string, orders: Order[]): Promise<Trade> {
const body = {
market,
orders,
};
return this.common.request(true, 'POST', 'orders/multi.json', null, body);
}
public async clearOrders(side?: Side, market?: string): Promise<Trade[]> {
const body = {
side,
market,
};
return this.common.request(true, 'POST', 'orders/clear.json', null, body);
}
public async deleteOrder(id: string): Promise<Trade> {
const body = {
id,
};
return this.common.request(true, 'POST', 'order/delete.json', null, body);
}
public async deleteOrders(ids: string[]): Promise<number[]> {
const body = {
ids: ids.join(','),
};
return this.common.request(true, 'POST', 'orders/delete.json', null, body);
}
public async trades(market: string, limit?: number, timestamp?: number, from?: number, to?: number, orderBy?: OrderBy): Promise<Trade[]> {
const qs = {
market,
limit,
timestamp,
from,
to,
order_by: orderBy,
};
return this.common.request(true, 'GET', 'trades/my.json', qs);
}
public async getWithdraws(currency?: string, limit?: number, state?: string): Promise<Withdraw[]> {
const qs = {
currency,
limit,
state,
};
return this.common.request(true, 'GET', 'withdraws.json', qs);
}
public async getWithdraw(id: string): Promise<Withdraw> {
const qs = {
id,
};
return this.common.request(true, 'GET', 'withdraw.json', qs);
}
public async postWithdraw(currency: string, sum: number, address: string): Promise<Withdraw> {
const body = {
currency,
sum,
address,
};
return this.common.request(true, 'POST', 'withdraw.json', null, body);
}
}
|