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 | 1x 5x 1x 1x 3x 2x 2x 2x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x 1x 1x | import Common from './common';
import { Account, AccountExternal, AccountLine, AccountLineQueryString } from './interfaces/accounts.interface';
import { Fee, FeeQueryString } from './interfaces/fees.interface';
import { Fill, FillQueryString } from './interfaces/fills.interface';
import { Order, OrderCreate, OrderQueryString } from './interfaces/orders.interface';
import { Products } from './interfaces/products.interface';
import { Token, TokenGenerate } from './interfaces/tokens.interface';
import { Transfer, TransferCreate, TransferQueryString } from './interfaces/transfers.interface';
import { User, UserUpdate } from './interfaces/users.interface';
class Trading {
private common: Common;
constructor(
token: string,
sandbox?: boolean,
) {
this.common = new Common(sandbox, 'api', token);
}
public async getAccounts(): Promise<Account[]> {
return this.common.request(true, 'get', `accounts`);
}
public async getAccountsExternal(): Promise<AccountExternal[]> {
return this.common.request(true, 'get', `accounts/external`);
}
public async getAccount(accountNumber: string): Promise<Account> {
return this.common.request(true, 'get', `accounts/${accountNumber}`);
}
public async getAccountLines(accountNumber: string, qs?: AccountLineQueryString): Promise<AccountLine[]> {
return this.common.request(true, 'get', `accounts/${accountNumber}/lines`, qs);
}
public async getFees(qs?: FeeQueryString): Promise<Fee[]> {
return this.common.request(true, 'get', `fee_charges`, qs);
}
public async getFills(qs?: FillQueryString): Promise<Fill[]> {
return this.common.request(true, 'get', `fills`, qs);
}
public async getFill(tid: string): Promise<Fill> {
return this.common.request(true, 'get', `fills/${tid}`);
}
public async getOrders(qs?: OrderQueryString): Promise<Order[]> {
return this.common.request(true, 'get', `orders`, qs);
}
public async getOrdersAll(qs?: OrderQueryString): Promise<Order[]> {
return this.common.request(true, 'get', `orders/all`, qs);
}
public async postOrderCreate(data: OrderCreate): Promise<Order> {
return this.common.request(true, 'post', `orders`, null, data);
}
public async getOrder(oid: number): Promise<Order> {
return this.common.request(true, 'get', `orders/${oid}`);
}
public async deleteCancelOrder(oid: number): Promise<Order> {
return this.common.request(true, 'delete', `orders/${oid}`);
}
public async getProducts(): Promise<Products[]> {
return this.common.request(true, 'get', `products`);
}
public async getProduct(id: string): Promise<Products> {
return this.common.request(true, 'get', `products/${id}`);
}
public async getTokens(): Promise<Token[]> {
return this.common.request(true, 'get', `tokens`);
}
public async postTokenGenerate(data: TokenGenerate): Promise<Token> {
return this.common.request(true, 'post', `tokens`, null, data);
}
public async deleteTokenRevoke(id: string): Promise<Token> {
return this.common.request(true, 'delete', `tokens/${id}`);
}
public async getTransfers(qs?: TransferQueryString): Promise<Transfer[]> {
return this.common.request(true, 'get', `transfers`, qs);
}
public async postTransfersCreate(data: TransferCreate): Promise<Transfer> {
return this.common.request(true, 'post', `transfers`, null, data);
}
public async getUser(): Promise<User> {
return this.common.request(true, 'get', `users/current`);
}
public async patchUpdateUser(data: UserUpdate): Promise<User> {
return this.common.request(true, 'patch', `users/current`, null, data);
}
}
export default Trading;
|