diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2019-01-08 03:11:19 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2019-01-08 03:11:19 +0800 |
commit | fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4 (patch) | |
tree | 094420dc85ebaa83cc5e44ab7805f278418c953e /packages/pipeline/src/parsers/idex_orders/index.ts | |
parent | 24564b986daa703f66e54f85abf4782d99a40f94 (diff) | |
download | dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar.gz dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar.bz2 dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar.lz dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar.xz dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.tar.zst dexon-sol-tools-fd37e88bdbdcc821e4aa734aed6ad1f499b2b3e4.zip |
Use enums in pipeline
Diffstat (limited to 'packages/pipeline/src/parsers/idex_orders/index.ts')
-rw-r--r-- | packages/pipeline/src/parsers/idex_orders/index.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/pipeline/src/parsers/idex_orders/index.ts b/packages/pipeline/src/parsers/idex_orders/index.ts index dfe27455c..14b871195 100644 --- a/packages/pipeline/src/parsers/idex_orders/index.ts +++ b/packages/pipeline/src/parsers/idex_orders/index.ts @@ -2,7 +2,7 @@ import { BigNumber } from '@0x/utils'; import { aggregateOrders } from '../utils'; -import { IdexOrder, IdexOrderbook, IdexOrderParam } from '../../data_sources/idex'; +import { IdexOrderbook, IdexOrderParam } from '../../data_sources/idex'; import { TokenOrderbookSnapshot as TokenOrder } from '../../entities'; import { OrderType } from '../../types'; @@ -21,7 +21,9 @@ export function parseIdexOrders(idexOrderbook: IdexOrderbook, observedTimestamp: const idexBidOrder = idexOrderbook.bids[0]; const parsedBids = aggregatedBids.length > 0 - ? aggregatedBids.map(order => parseIdexOrder(idexBidOrder.params, observedTimestamp, 'bid', source, order)) + ? aggregatedBids.map(order => + parseIdexOrder(idexBidOrder.params, observedTimestamp, OrderType.Bid, source, order), + ) : []; const aggregatedAsks = aggregateOrders(idexOrderbook.asks); @@ -29,7 +31,9 @@ export function parseIdexOrders(idexOrderbook: IdexOrderbook, observedTimestamp: const idexAskOrder = idexOrderbook.asks[0]; const parsedAsks = aggregatedAsks.length > 0 - ? aggregatedAsks.map(order => parseIdexOrder(idexAskOrder.params, observedTimestamp, 'ask', source, order)) + ? aggregatedAsks.map(order => + parseIdexOrder(idexAskOrder.params, observedTimestamp, OrderType.Ask, source, order), + ) : []; return parsedBids.concat(parsedAsks); } @@ -62,7 +66,7 @@ export function parseIdexOrder( tokenOrder.baseVolume = amount; tokenOrder.quoteVolume = price.times(amount); - if (orderType === 'bid') { + if (orderType === OrderType.Bid) { tokenOrder.baseAssetSymbol = idexOrderParam.buySymbol; tokenOrder.baseAssetAddress = idexOrderParam.tokenBuy; tokenOrder.quoteAssetSymbol = idexOrderParam.sellSymbol; |