diff options
Diffstat (limited to 'packages/pipeline')
-rw-r--r-- | packages/pipeline/README.md | 14 | ||||
-rw-r--r-- | packages/pipeline/src/scripts/pull_radar_relay_orders.ts | 29 |
2 files changed, 18 insertions, 25 deletions
diff --git a/packages/pipeline/README.md b/packages/pipeline/README.md index 0f4abd935..794488cac 100644 --- a/packages/pipeline/README.md +++ b/packages/pipeline/README.md @@ -150,17 +150,17 @@ set the`ZEROEX_DATA_PIPELINE_DB_URL` environment variable to a valid #### Additional guidelines and tips: -- Table names should be plural and separated by underscores (e.g., +* Table names should be plural and separated by underscores (e.g., `exchange_fill_events`). -- Any table which contains data which comes directly from a third-party source +* Any table which contains data which comes directly from a third-party source should be namespaced in the `raw` PostgreSQL schema. -- Column names in the database should be separated by underscores (e.g., +* Column names in the database should be separated by underscores (e.g., `maker_asset_type`). -- Field names in entity classes (like any other fields in TypeScript) should +* Field names in entity classes (like any other fields in TypeScript) should be camel-cased (e.g., `makerAssetType`). -- All timestamps should be stored as milliseconds since the Unix Epoch. -- Use the `BigNumber` type for TypeScript code which deals with 256-bit +* All timestamps should be stored as milliseconds since the Unix Epoch. +* Use the `BigNumber` type for TypeScript code which deals with 256-bit numbers from smart contracts or for any case where we are dealing with large floating point numbers. -- [TypeORM documentation](http://typeorm.io/#/) is pretty robust and can be a +* [TypeORM documentation](http://typeorm.io/#/) is pretty robust and can be a helpful resource. diff --git a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts index bbbef9b47..6c18bcaef 100644 --- a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts +++ b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts @@ -29,22 +29,17 @@ async function getOrderbookAsync(): Promise<void> { console.log(`Got ${rawOrders.records.length} orders.`); console.log('Parsing orders...'); // Parse the sra orders, then add source url to each. - const orders = R.pipe( - parseSraOrders, - R.map(setSourceUrl(RADAR_RELAY_URL)), - )(rawOrders); + const orders = R.pipe(parseSraOrders, R.map(setSourceUrl(RADAR_RELAY_URL)))(rawOrders); // Save all the orders and update the observed time stamps in a single // transaction. console.log('Saving orders and updating timestamps...'); - await connection.transaction( - async (manager: EntityManager): Promise<void> => { - for (const order of orders) { - await manager.save(SraOrder, order); - const observedTimestamp = createObservedTimestampForOrder(order); - await manager.save(observedTimestamp); - } - }, - ); + await connection.transaction(async (manager: EntityManager): Promise<void> => { + for (const order of orders) { + await manager.save(SraOrder, order); + const observedTimestamp = createObservedTimestampForOrder(order); + await manager.save(observedTimestamp); + } + }); } const sourceUrlProp = R.lensProp('sourceUrl'); @@ -53,8 +48,6 @@ const sourceUrlProp = R.lensProp('sourceUrl'); * Sets the source url for a single order. Returns a new order instead of * mutating the given one. */ -const setSourceUrl = R.curry( - (sourceURL: string, order: SraOrder): SraOrder => { - return R.set(sourceUrlProp, sourceURL, order); - }, -); +const setSourceUrl = R.curry((sourceURL: string, order: SraOrder): SraOrder => { + return R.set(sourceUrlProp, sourceURL, order); +}); |