aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts
diff options
context:
space:
mode:
authorzkao <zichongkao@gmail.com>2018-12-05 05:21:46 +0800
committerFred Carlsen <fred@sjelfull.no>2018-12-06 19:05:38 +0800
commitf96711bac373ac7caaca647defd68d91ba43a181 (patch)
tree64c8933954de8ec8eb0cc8c7437543c649a65329 /packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts
parentddd246a945cb29ba0115987cc215398e4fc0066b (diff)
downloaddexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar.gz
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar.bz2
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar.lz
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar.xz
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.tar.zst
dexon-sol-tools-f96711bac373ac7caaca647defd68d91ba43a181.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.ts30
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);
+ }
+}