diff options
author | zkao <zichongkao@gmail.com> | 2018-12-05 05:21:46 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:25:42 +0800 |
commit | 87ffa5d7ab19d2288bf68131a7e7ec77578c564c (patch) | |
tree | 68bb07481756ba578a89303f33d5c0ce8656f3a4 /packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts | |
parent | 7198b441e0d85785eec7244dd60bcd92269d954e (diff) | |
download | dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar.gz dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar.bz2 dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar.lz dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar.xz dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.tar.zst dexon-sol-tools-87ffa5d7ab19d2288bf68131a7e7ec77578c564c.zip |
Token_orderbook_snapshots for Ddex and Paradex(#1354)
* Implements the TokenOrderbookSnapshot Table
* Scripts, Data Sources and Entities to pull Ddex and Paradex API data.
Diffstat (limited to 'packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts')
-rw-r--r-- | packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts b/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts new file mode 100644 index 000000000..a7117c753 --- /dev/null +++ b/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts @@ -0,0 +1,30 @@ +import { MigrationInterface, QueryRunner, Table } from 'typeorm'; + +const tokenOrderbookSnapshots = new Table({ + name: 'raw.token_orderbook_snapshots', + columns: [ + { name: 'observed_timestamp', type: 'bigint', isPrimary: true }, + { name: 'source', type: 'varchar', isPrimary: true }, + { name: 'order_type', type: 'order_t' }, + { name: 'price', type: 'numeric', isPrimary: true }, + + { name: 'base_asset_symbol', type: 'varchar', isPrimary: true }, + { name: 'base_asset_address', type: 'char(42)' }, + { name: 'base_volume', type: 'numeric' }, + + { name: 'quote_asset_symbol', type: 'varchar', isPrimary: true }, + { name: 'quote_asset_address', type: 'char(42)' }, + { name: 'quote_volume', type: 'numeric' }, + ], +}); + +export class TokenOrderbookSnapshots1543434472116 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise<any> { + await queryRunner.query(`CREATE TYPE order_t AS enum('bid', 'ask');`); + await queryRunner.createTable(tokenOrderbookSnapshots); + } + + public async down(queryRunner: QueryRunner): Promise<any> { + await queryRunner.dropTable(tokenOrderbookSnapshots.name); + } +} |