aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/test/entities/ohlcv_external_test.ts
diff options
context:
space:
mode:
authorXianny <8582774+xianny@users.noreply.github.com>2018-12-05 05:36:18 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:26:03 +0800
commit8c21a700bae0c751f7f9ca47f9a47628a4478911 (patch)
tree2c3efb6ba20987ffaa68c39a3246ed7802849479 /packages/pipeline/test/entities/ohlcv_external_test.ts
parent87ffa5d7ab19d2288bf68131a7e7ec77578c564c (diff)
downloaddexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar.gz
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar.bz2
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar.lz
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar.xz
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.tar.zst
dexon-0x-contracts-8c21a700bae0c751f7f9ca47f9a47628a4478911.zip
pull OHLCV records from Crypto Compare (#1349)
* [WIP] pull OHLCV records from Crypto Compare * lint * refactor to pull logic out of script and into modules * add entity test for ohlcv_external entity * implement rate limit and chronological backfill for ohlcv * add unit tests; cleanup variable names * Fetch OHLCV pairs params from events table * better method names * fix outdated test * lint * Clean up after review * oops * fix failing test * better filtering of most recent records * fix bug when generating pairs * fix default earliest backfill date * fix bug with retrieving backfill time * prettier
Diffstat (limited to 'packages/pipeline/test/entities/ohlcv_external_test.ts')
-rw-r--r--packages/pipeline/test/entities/ohlcv_external_test.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/pipeline/test/entities/ohlcv_external_test.ts b/packages/pipeline/test/entities/ohlcv_external_test.ts
new file mode 100644
index 000000000..8b995db50
--- /dev/null
+++ b/packages/pipeline/test/entities/ohlcv_external_test.ts
@@ -0,0 +1,35 @@
+import 'mocha';
+import 'reflect-metadata';
+
+import { OHLCVExternal } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const ohlcvExternal: OHLCVExternal = {
+ exchange: 'CCCAGG',
+ fromSymbol: 'ETH',
+ toSymbol: 'ZRX',
+ startTime: 1543352400000,
+ endTime: 1543356000000,
+ open: 307.41,
+ close: 310.08,
+ low: 304.6,
+ high: 310.27,
+ volumeFrom: 904.6,
+ volumeTo: 278238.5,
+ source: 'Crypto Compare',
+ observedTimestamp: 1543442338074,
+};
+
+// tslint:disable:custom-no-magic-numbers
+describe('OHLCVExternal entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(OHLCVExternal);
+ await testSaveAndFindEntityAsync(repository, ohlcvExternal);
+ });
+});