Skip to content

Commit

Permalink
feat: add the getOrder method
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Sep 15, 2020
1 parent 2162cbf commit 08735a3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ export interface ICancelOrderOptions extends IVersion {

export type IModifyOrderOptions = IReplaceOrderOptions | ICancelOrderOptions;

export interface IOrderId extends IVersion {
/**
* The order identifier
*/
orderId: string;
}

export interface IUserAccount {
/**
* Account status
Expand Down Expand Up @@ -1100,6 +1107,19 @@ export class RestClient {
return order;
}

/**
* Get the order with specified identifier
*/
public async getOrder({
version = DefaultAPIVersion,
orderId,
}: IOrderId): Promise<IOrder> {
const url = new URL(`/trade/${version}/orders/${orderId}`, this.url);

const order = (await this.fetch(url)) as IOrder;
return order;
}

/**
* Get a JSON Web Token
*/
Expand Down

0 comments on commit 08735a3

Please sign in to comment.