Skip to content

Commit

Permalink
Use parameters for the getAvailableLiquidity method
Browse files Browse the repository at this point in the history
  • Loading branch information
skubarenko committed Aug 21, 2022
1 parent 76b20cd commit 33de36a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/exchange/exchangeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ordersHelper, symbolsHelper } from './helpers/index';
import type {
CancelAllOrdersRequest, CancelOrderRequest, CurrencyDirection, ExchangeSymbol,
OrderPreviewParameters as OrderPreviewParameters,
NewOrderRequest, Order, OrderBook, OrderPreview, OrdersSelector, Quote, OrderType, NormalizedOrderPreviewParameters, FilledNewOrderRequest, SymbolLiquidity
NewOrderRequest, Order, OrderBook, OrderPreview, OrdersSelector, Quote, OrderType, NormalizedOrderPreviewParameters, FilledNewOrderRequest, SymbolLiquidity, SymbolLiquidityParameters
} from './models/index';
import type { ManagedOrderBookProvider } from './orderBookProvider';

Expand Down Expand Up @@ -186,9 +186,7 @@ export class ExchangeManager implements AtomexService {
};
}

getAvailableLiquidity(symbol: string, orderType: OrderType): Promise<SymbolLiquidity | undefined>;
getAvailableLiquidity(direction: CurrencyDirection, orderType: OrderType): Promise<SymbolLiquidity | undefined>;
getAvailableLiquidity(_symbolOrDirection: string | CurrencyDirection, _orderType: OrderType): Promise<SymbolLiquidity | undefined> {
getAvailableLiquidity(_parameters: SymbolLiquidityParameters): Promise<SymbolLiquidity | undefined> {
throw new Error('Not implemented');
}

Expand Down
1 change: 1 addition & 0 deletions src/exchange/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type { SymbolCurrency } from './symbolCurrency';
export type { OrderPreview } from './orderPreview';
export type { OrderPreviewParameters, NormalizedOrderPreviewParameters } from './orderPreviewParameters';
export type { SymbolLiquidity } from './symbolLiquidity';
export type { SymbolLiquidityParameters } from './symbolLiquidityParameters';
export type { ExchangeSymbol } from './exchangeSymbol';
export type { NewOrderRequest, FilledNewOrderRequest } from './newOrderRequest';
export type { CancelOrderRequest } from './cancelOrderRequest';
Expand Down
21 changes: 21 additions & 0 deletions src/exchange/models/symbolLiquidityParameters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Side } from '../../common/index';
import type { CurrencyDirection } from './currencyDirection';
import type { OrderType } from './orderType';

export interface SymbolLiquidityParametersBase {
type: OrderType;
}

export type SymbolLiquidityParameters = SymbolLiquidityParametersBase & (
| {
from: CurrencyDirection['from'];
to: CurrencyDirection['to'];
symbol?: never;
side?: never;
}
| {
from?: never;
to?: never;
symbol: string;
side: Side;
});

0 comments on commit 33de36a

Please sign in to comment.