aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-11 07:38:41 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-11 07:38:41 +0800
commit127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a (patch)
treeb83bfacfef382e61ded1dd4044721039d32f7905 /packages/asset-buyer
parent2360b8282fe40e1c1b1336b17872b5699bde610e (diff)
downloaddexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar.gz
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar.bz2
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar.lz
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar.xz
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.tar.zst
dexon-sol-tools-127bd4bf9dd99c0520dcc4fbd5413d98e1dac65a.zip
Getting rid of unused params and adding documentation
Diffstat (limited to 'packages/asset-buyer')
-rw-r--r--packages/asset-buyer/src/asset_buyer.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts
index 92a99c28c..77cf403d7 100644
--- a/packages/asset-buyer/src/asset_buyer.ts
+++ b/packages/asset-buyer/src/asset_buyer.ts
@@ -17,6 +17,7 @@ import {
BuyQuoteExecutionOpts,
BuyQuoteRequestOpts,
LiquidityForAssetData,
+ LiquidityRequestOpts,
OrderProvider,
OrderProviderResponse,
OrdersAndFillableAmounts,
@@ -208,19 +209,22 @@ export class AssetBuyer {
const buyQuote = this.getBuyQuoteAsync(assetData, assetBuyAmount, options);
return buyQuote;
}
+ /**
+ * Returns information about available liquidity for an asset
+ * Does not factor in slippage or fees
+ * @param assetData The assetData of the desired asset to buy (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+ * @param options Options for the request. See type definition for more information.
+ *
+ * @return An object that conforms to LiquidityForAssetData that satisfies the request. See type definition for more information.
+ */
public async getLiquidityForAssetDataAsync(
assetData: string,
- options: Partial<BuyQuoteRequestOpts> = {},
+ options: Partial<LiquidityRequestOpts> = {},
): Promise<LiquidityForAssetData> {
- const { feePercentage, shouldForceOrderRefresh, slippagePercentage } = _.merge(
- {},
- constants.DEFAULT_BUY_QUOTE_REQUEST_OPTS,
- options,
- );
+ const shouldForceOrderRefresh =
+ options.shouldForceOrderRefresh !== undefined ? options.shouldForceOrderRefresh : false;
assert.isString('assetData', assetData);
- assert.isValidPercentage('feePercentage', feePercentage);
assert.isBoolean('shouldForceOrderRefresh', shouldForceOrderRefresh);
- assert.isNumber('slippagePercentage', slippagePercentage);
const assetPairs = await this.orderProvider.getAvailableMakerAssetDatasAsync(assetData);
if (!assetPairs.includes(assetData)) {
@@ -321,6 +325,8 @@ export class AssetBuyer {
}
/**
* Grab orders from the map, if there is a miss or it is time to refresh, fetch and process the orders
+ * @param assetData The assetData of the desired asset to buy (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+ * @param shouldForceOrderRefresh If set to true, new orders and state will be fetched instead of waiting for the next orderRefreshIntervalMs.
*/
public async getOrdersAndFillableAmountsAsync(
assetData: string,