aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/entities/ohlcv_external.ts
blob: 4f55dd9306426850c94e7946bf216ccfb8cc2505 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Column, Entity, PrimaryColumn } from 'typeorm';

import { numberToBigIntTransformer } from '../utils';

@Entity({ name: 'ohlcv_external', schema: 'raw' })
export class OHLCVExternal {
    @PrimaryColumn() public exchange!: string;

    @PrimaryColumn({ name: 'from_symbol', type: 'varchar' })
    public fromSymbol!: string;
    @PrimaryColumn({ name: 'to_symbol', type: 'varchar' })
    public toSymbol!: string;
    @PrimaryColumn({ name: 'start_time', transformer: numberToBigIntTransformer })
    public startTime!: number;
    @PrimaryColumn({ name: 'end_time', transformer: numberToBigIntTransformer })
    public endTime!: number;

    @Column() public open!: number;
    @Column() public close!: number;
    @Column() public low!: number;
    @Column() public high!: number;
    @Column({ name: 'volume_from' })
    public volumeFrom!: number;
    @Column({ name: 'volume_to' })
    public volumeTo!: number;

    @PrimaryColumn() public source!: string;
    @PrimaryColumn({ name: 'observed_timestamp', transformer: numberToBigIntTransformer })
    public observedTimestamp!: number;
}