aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/utils/calculate_liquidity.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/asset-buyer/src/utils/calculate_liquidity.ts')
-rw-r--r--packages/asset-buyer/src/utils/calculate_liquidity.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/packages/asset-buyer/src/utils/calculate_liquidity.ts b/packages/asset-buyer/src/utils/calculate_liquidity.ts
deleted file mode 100644
index a8d165b4b..000000000
--- a/packages/asset-buyer/src/utils/calculate_liquidity.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-import { LiquidityForAssetData, OrdersAndFillableAmounts } from '../types';
-
-import { orderUtils } from './order_utils';
-
-export const calculateLiquidity = (ordersAndFillableAmounts: OrdersAndFillableAmounts): LiquidityForAssetData => {
- const { orders, remainingFillableMakerAssetAmounts } = ordersAndFillableAmounts;
- const liquidityInBigNumbers = orders.reduce(
- (acc, order, curIndex) => {
- const availableMakerAssetAmount = remainingFillableMakerAssetAmounts[curIndex];
- if (availableMakerAssetAmount === undefined) {
- throw new Error(`No corresponding fillableMakerAssetAmounts at index ${curIndex}`);
- }
-
- const tokensAvailableForCurrentOrder = availableMakerAssetAmount;
- const ethValueAvailableForCurrentOrder = orderUtils.getTakerFillAmount(order, availableMakerAssetAmount);
- return {
- tokensAvailableInBaseUnits: acc.tokensAvailableInBaseUnits.plus(tokensAvailableForCurrentOrder),
- ethValueAvailableInWei: acc.ethValueAvailableInWei.plus(ethValueAvailableForCurrentOrder),
- };
- },
- {
- tokensAvailableInBaseUnits: new BigNumber(0),
- ethValueAvailableInWei: new BigNumber(0),
- },
- );
-
- // Turn into regular numbers
- return {
- tokensAvailableInBaseUnits: liquidityInBigNumbers.tokensAvailableInBaseUnits,
- ethValueAvailableInWei: liquidityInBigNumbers.ethValueAvailableInWei,
- };
-};