Skip to content

Commit

Permalink
Merge pull request coinbase#213 from blair/improve-gdax-cancel-all-or…
Browse files Browse the repository at this point in the history
…ders-types

cancelAllOrders: makde product argument optional.
  • Loading branch information
fb55 authored Apr 10, 2018
2 parents 713bfd5 + 207dff2 commit db30cb0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/Trader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class Trader extends Writable {
* listed in the in-memory orderbook, use `cancelMyOrders`
*/
cancelAllOrders(): Promise<string[]> {
return this.api.cancelAllOrders(null).then((ids: string[]) => {
return this.api.cancelAllOrders().then((ids: string[]) => {
this.myBook.clear();
this.emitMessageAsync('Trader.all-orders-cancelled', ids);
return ids;
Expand Down
4 changes: 2 additions & 2 deletions src/exchanges/AuthenticatedExchangeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export interface AuthenticatedExchangeAPI {
cancelOrder(id: string): Promise<string>;

/**
* Cancel all orders. If product is not null, only cancel orders from that book
* Cancel all orders. If product is truthy, only cancel orders from that book
*/
cancelAllOrders(product: string): Promise<string[]>;
cancelAllOrders(gdaxProduct?: string): Promise<string[]>;

/**
* Load details for a user-placed order on the exchange
Expand Down
2 changes: 1 addition & 1 deletion src/exchanges/bitfinex/BitfinexExchangeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class BitfinexExchangeAPI implements PublicExchangeAPI, AuthenticatedExch
});
}

cancelAllOrders(): Promise<string[]> {
cancelAllOrders(gdaxProduct?: string): Promise<string[]> {
return this.checkAuth().then((auth: ExchangeAuthConfig) => {
return BitfinexAuth.cancelAllOrders(auth).then((result: BitfinexResult) => {
if (this.logger) {
Expand Down
2 changes: 1 addition & 1 deletion src/exchanges/ccxt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default class CCXTExchangeWrapper implements PublicExchangeAPI, Authentic
throw new Error('Not implemented yet');
}

cancelAllOrders(product: string): Promise<string[]> {
cancelAllOrders(gdaxProduct?: string): Promise<string[]> {
throw new Error('Not implemented yet');
}

Expand Down
2 changes: 1 addition & 1 deletion src/exchanges/gdax/GDAXExchangeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class GDAXExchangeAPI implements PublicExchangeAPI, AuthenticatedExchange

}

cancelAllOrders(product: string): Promise<string[]> {
cancelAllOrders(product?: string): Promise<string[]> {
const apiCall = this.authCall('DELETE', `/orders`, {});
const options = product ? {product_id: product} : null;
return this.handleResponse<string[]>(apiCall, options);
Expand Down

0 comments on commit db30cb0

Please sign in to comment.