@dhedge/backend-flatcoin-core 0.3.17 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/constants/enum.d.ts +3 -0
  2. package/dist/constants/enum.js +5 -1
  3. package/dist/entity/apy-history.d.ts +2 -2
  4. package/dist/entity/apy-history.js +4 -4
  5. package/dist/entity/apy.d.ts +1 -1
  6. package/dist/entity/apy.js +2 -2
  7. package/dist/entity/borrowing-rate-apy-history.d.ts +2 -2
  8. package/dist/entity/borrowing-rate-apy-history.js +4 -4
  9. package/dist/entity/flatcoin-pnl.d.ts +1 -1
  10. package/dist/entity/flatcoin-pnl.js +2 -2
  11. package/dist/entity/flatcoin.price.parent.d.ts +1 -1
  12. package/dist/entity/flatcoin.price.parent.js +2 -2
  13. package/dist/entity/leverage-leaderboard.d.ts +1 -1
  14. package/dist/entity/leverage-leaderboard.js +2 -2
  15. package/dist/entity/leverage-monthly-pnl.d.ts +1 -1
  16. package/dist/entity/leverage-monthly-pnl.js +2 -2
  17. package/dist/entity/limit-order.entity.d.ts +1 -1
  18. package/dist/entity/limit-order.entity.js +2 -2
  19. package/dist/entity/multichain-config.d.ts +1 -1
  20. package/dist/entity/multichain-config.js +2 -2
  21. package/dist/entity/order-execution.d.ts +1 -1
  22. package/dist/entity/order-execution.js +2 -2
  23. package/dist/entity/period-performance.d.ts +1 -1
  24. package/dist/entity/period-performance.js +2 -2
  25. package/dist/entity/position-entity.d.ts +1 -1
  26. package/dist/entity/position-entity.js +2 -2
  27. package/dist/entity/protocol-metrics.d.ts +1 -1
  28. package/dist/entity/protocol-metrics.js +2 -2
  29. package/dist/repository/apy-history.repository.d.ts +1 -1
  30. package/dist/repository/apy-history.repository.js +2 -2
  31. package/dist/repository/apy.repository.d.ts +1 -1
  32. package/dist/repository/apy.repository.js +2 -5
  33. package/dist/repository/borrowing-rate-apy-history.repository.d.ts +1 -1
  34. package/dist/repository/borrowing-rate-apy-history.repository.js +2 -2
  35. package/dist/repository/flatcoin-pnl.repository.d.ts +3 -3
  36. package/dist/repository/flatcoin-pnl.repository.js +7 -12
  37. package/dist/repository/leverage-balance.repository.d.ts +1 -1
  38. package/dist/repository/leverage-balance.repository.js +2 -2
  39. package/dist/repository/leverage-leaderboard.repository.d.ts +4 -4
  40. package/dist/repository/leverage-leaderboard.repository.js +8 -8
  41. package/dist/repository/leverage-monthly-pnl.repository.d.ts +3 -3
  42. package/dist/repository/leverage-monthly-pnl.repository.js +6 -6
  43. package/dist/repository/limit-order.repository.d.ts +2 -2
  44. package/dist/repository/limit-order.repository.js +4 -4
  45. package/dist/repository/multichain-config.repository.d.ts +1 -1
  46. package/dist/repository/multichain-config.repository.js +3 -5
  47. package/dist/repository/order-execution.repository.d.ts +1 -1
  48. package/dist/repository/order-execution.repository.js +2 -3
  49. package/dist/repository/position.repository.d.ts +4 -4
  50. package/dist/repository/position.repository.js +8 -8
  51. package/dist/repository/price.repository.d.ts +5 -5
  52. package/dist/repository/price.repository.js +10 -15
  53. package/dist/repository/protocol-metrics.repository.d.ts +1 -1
  54. package/dist/repository/protocol-metrics.repository.js +2 -2
  55. package/dist/repository/unit-balance.repository.d.ts +1 -1
  56. package/dist/repository/unit-balance.repository.js +2 -2
  57. package/package.json +1 -1
@@ -10,6 +10,9 @@ export declare enum BlockchainCode {
10
10
  BASE = "BASE",
11
11
  ARBITRUM = "ARBITRUM"
12
12
  }
13
+ export declare enum Market {
14
+ RETH_BASE = "RETH_BASE"
15
+ }
13
16
  export declare enum HistoricalPeriod {
14
17
  ONE_DAY = "1d",
15
18
  ONE_WEEK = "1w",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimitOrderStatus = exports.LimitOrderExecutionType = exports.OrderType = exports.LeveragePositionStatus = exports.getChartPeriod = exports.PERIOD_IN_SECONDS = exports.HistoricalPeriod = exports.BlockchainCode = exports.PERIODS = void 0;
3
+ exports.LimitOrderStatus = exports.LimitOrderExecutionType = exports.OrderType = exports.LeveragePositionStatus = exports.getChartPeriod = exports.PERIOD_IN_SECONDS = exports.HistoricalPeriod = exports.Market = exports.BlockchainCode = exports.PERIODS = void 0;
4
4
  var PERIODS;
5
5
  (function (PERIODS) {
6
6
  PERIODS["DAY"] = "DAY";
@@ -15,6 +15,10 @@ var BlockchainCode;
15
15
  BlockchainCode["BASE"] = "BASE";
16
16
  BlockchainCode["ARBITRUM"] = "ARBITRUM";
17
17
  })(BlockchainCode || (exports.BlockchainCode = BlockchainCode = {}));
18
+ var Market;
19
+ (function (Market) {
20
+ Market["RETH_BASE"] = "RETH_BASE";
21
+ })(Market || (exports.Market = Market = {}));
18
22
  var HistoricalPeriod;
19
23
  (function (HistoricalPeriod) {
20
24
  HistoricalPeriod["ONE_DAY"] = "1d";
@@ -1,8 +1,8 @@
1
1
  export declare class ApyHistory {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  daily: number;
5
5
  weekly: number;
6
6
  timestamp: number;
7
- constructor(daily: number, weekly: number, timestamp: number, blockchainCode: string);
7
+ constructor(daily: number, weekly: number, timestamp: number, marketId: string);
8
8
  }
@@ -14,11 +14,11 @@ const typeorm_1 = require("typeorm");
14
14
  const graphql_1 = require("@nestjs/graphql");
15
15
  const utils_1 = require("../utils");
16
16
  let ApyHistory = class ApyHistory {
17
- constructor(daily, weekly, timestamp, blockchainCode) {
17
+ constructor(daily, weekly, timestamp, marketId) {
18
18
  this.daily = daily;
19
19
  this.weekly = weekly;
20
20
  this.timestamp = timestamp;
21
- this.blockchainCode = blockchainCode;
21
+ this.marketId = marketId;
22
22
  }
23
23
  };
24
24
  exports.ApyHistory = ApyHistory;
@@ -28,9 +28,9 @@ __decorate([
28
28
  ], ApyHistory.prototype, "id", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => String, { nullable: false }),
31
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
31
+ (0, typeorm_1.Column)({ name: 'market_id' }),
32
32
  __metadata("design:type", String)
33
- ], ApyHistory.prototype, "blockchainCode", void 0);
33
+ ], ApyHistory.prototype, "marketId", void 0);
34
34
  __decorate([
35
35
  (0, graphql_1.Field)(() => graphql_1.Float, { nullable: false }),
36
36
  (0, typeorm_1.Column)({ name: 'daily', type: 'decimal', precision: 30, scale: 2, nullable: false, transformer: utils_1.numericTransformer }),
@@ -1,6 +1,6 @@
1
1
  export declare class Apy {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  monthly: number;
5
5
  weekly: number;
6
6
  daily: number;
@@ -22,9 +22,9 @@ __decorate([
22
22
  ], Apy.prototype, "id", void 0);
23
23
  __decorate([
24
24
  (0, graphql_1.Field)(() => String, { nullable: false }),
25
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
25
+ (0, typeorm_1.Column)({ name: 'market_id' }),
26
26
  __metadata("design:type", String)
27
- ], Apy.prototype, "blockchainCode", void 0);
27
+ ], Apy.prototype, "marketId", void 0);
28
28
  __decorate([
29
29
  (0, graphql_1.Field)(() => graphql_1.Float, { nullable: false }),
30
30
  (0, typeorm_1.Column)({ name: 'monthly', type: 'decimal', precision: 30, scale: 2, transformer: utils_1.numericTransformer }),
@@ -1,8 +1,8 @@
1
1
  export declare class BorrowingRateApyHistory {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  daily: number;
5
5
  eightHour: number;
6
6
  timestamp: number;
7
- constructor(daily: number, eightHour: number, timestamp: number, blockchainCode: string);
7
+ constructor(daily: number, eightHour: number, timestamp: number, marketId: string);
8
8
  }
@@ -14,11 +14,11 @@ const typeorm_1 = require("typeorm");
14
14
  const graphql_1 = require("@nestjs/graphql");
15
15
  const utils_1 = require("../utils");
16
16
  let BorrowingRateApyHistory = class BorrowingRateApyHistory {
17
- constructor(daily, eightHour, timestamp, blockchainCode) {
17
+ constructor(daily, eightHour, timestamp, marketId) {
18
18
  this.daily = daily;
19
19
  this.eightHour = eightHour;
20
20
  this.timestamp = timestamp;
21
- this.blockchainCode = blockchainCode;
21
+ this.marketId = marketId;
22
22
  }
23
23
  };
24
24
  exports.BorrowingRateApyHistory = BorrowingRateApyHistory;
@@ -28,9 +28,9 @@ __decorate([
28
28
  ], BorrowingRateApyHistory.prototype, "id", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => String, { nullable: false }),
31
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
31
+ (0, typeorm_1.Column)({ name: 'market_id' }),
32
32
  __metadata("design:type", String)
33
- ], BorrowingRateApyHistory.prototype, "blockchainCode", void 0);
33
+ ], BorrowingRateApyHistory.prototype, "marketId", void 0);
34
34
  __decorate([
35
35
  (0, graphql_1.Field)(() => graphql_1.Float, { nullable: false }),
36
36
  (0, typeorm_1.Column)({ name: 'daily', type: 'decimal', precision: 30, scale: 2, nullable: false, transformer: utils_1.numericTransformer }),
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from 'ethers';
2
2
  export declare class FlatcoinPnl {
3
3
  id: number;
4
- blockchainCode: string;
4
+ marketId: string;
5
5
  account: string;
6
6
  pnlUsdFormatted: number;
7
7
  pnlPercentage: number;
@@ -23,9 +23,9 @@ __decorate([
23
23
  ], FlatcoinPnl.prototype, "id", void 0);
24
24
  __decorate([
25
25
  (0, graphql_1.Field)(() => String, { nullable: false }),
26
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
26
+ (0, typeorm_1.Column)({ name: 'market_id' }),
27
27
  __metadata("design:type", String)
28
- ], FlatcoinPnl.prototype, "blockchainCode", void 0);
28
+ ], FlatcoinPnl.prototype, "marketId", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => String, { nullable: false }),
31
31
  (0, typeorm_1.Column)({ name: 'account' }),
@@ -1,6 +1,6 @@
1
1
  export declare abstract class FlatcoinPriceParent {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  priceUsd: string;
5
5
  priceUsdFormatted: number;
6
6
  timestamp: number;
@@ -22,9 +22,9 @@ __decorate([
22
22
  ], FlatcoinPriceParent.prototype, "id", void 0);
23
23
  __decorate([
24
24
  (0, graphql_1.Field)(() => String, { nullable: false }),
25
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
25
+ (0, typeorm_1.Column)({ name: 'market_id' }),
26
26
  __metadata("design:type", String)
27
- ], FlatcoinPriceParent.prototype, "blockchainCode", void 0);
27
+ ], FlatcoinPriceParent.prototype, "marketId", void 0);
28
28
  __decorate([
29
29
  (0, graphql_1.Field)(),
30
30
  (0, typeorm_1.Column)({ name: 'price_usd', type: 'numeric', precision: 30 }),
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from 'ethers';
2
2
  export declare class LeverageLeaderboard {
3
3
  id: number;
4
- blockchainCode: string;
4
+ marketId: string;
5
5
  account: string;
6
6
  period: string;
7
7
  totalPnlReth: BigNumber;
@@ -23,9 +23,9 @@ __decorate([
23
23
  ], LeverageLeaderboard.prototype, "id", void 0);
24
24
  __decorate([
25
25
  (0, graphql_1.Field)(() => String, { nullable: false }),
26
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
26
+ (0, typeorm_1.Column)({ name: 'market_id' }),
27
27
  __metadata("design:type", String)
28
- ], LeverageLeaderboard.prototype, "blockchainCode", void 0);
28
+ ], LeverageLeaderboard.prototype, "marketId", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => String, { nullable: false }),
31
31
  (0, typeorm_1.Column)({ name: 'account', unique: true, nullable: false }),
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from 'ethers';
2
2
  export declare class LeverageMonthlyPnl {
3
3
  id: number;
4
- blockchainCode: string;
4
+ marketId: string;
5
5
  account: string;
6
6
  pnlReth: BigNumber;
7
7
  pnlCollateral: BigNumber;
@@ -23,9 +23,9 @@ __decorate([
23
23
  ], LeverageMonthlyPnl.prototype, "id", void 0);
24
24
  __decorate([
25
25
  (0, graphql_1.Field)(() => String, { nullable: false }),
26
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
26
+ (0, typeorm_1.Column)({ name: 'market_id' }),
27
27
  __metadata("design:type", String)
28
- ], LeverageMonthlyPnl.prototype, "blockchainCode", void 0);
28
+ ], LeverageMonthlyPnl.prototype, "marketId", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => String, { nullable: false }),
31
31
  (0, typeorm_1.Column)({ name: 'account', unique: true, nullable: false }),
@@ -2,7 +2,7 @@ import { BigNumber } from 'ethers';
2
2
  import { PositionEntity } from './position-entity';
3
3
  export declare class LimitOrderEntity {
4
4
  id: number;
5
- blockchainCode: string;
5
+ marketId: string;
6
6
  status: string;
7
7
  priceLowerThreshold: BigNumber;
8
8
  priceUpperThreshold: BigNumber;
@@ -22,9 +22,9 @@ __decorate([
22
22
  __metadata("design:type", Number)
23
23
  ], LimitOrderEntity.prototype, "id", void 0);
24
24
  __decorate([
25
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
25
+ (0, typeorm_1.Column)({ name: 'market_id' }),
26
26
  __metadata("design:type", String)
27
- ], LimitOrderEntity.prototype, "blockchainCode", void 0);
27
+ ], LimitOrderEntity.prototype, "marketId", void 0);
28
28
  __decorate([
29
29
  (0, typeorm_1.Column)({ name: 'status', nullable: false }),
30
30
  __metadata("design:type", String)
@@ -1,6 +1,6 @@
1
1
  export declare class MultichainConfig {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  appName: string;
5
5
  blockchainNetworkName: string;
6
6
  blockchainId: number;
@@ -19,9 +19,9 @@ __decorate([
19
19
  __metadata("design:type", Number)
20
20
  ], MultichainConfig.prototype, "id", void 0);
21
21
  __decorate([
22
- (0, typeorm_1.Column)({ name: 'blockchain_code', nullable: false }),
22
+ (0, typeorm_1.Column)({ name: 'market_id' }),
23
23
  __metadata("design:type", String)
24
- ], MultichainConfig.prototype, "blockchainCode", void 0);
24
+ ], MultichainConfig.prototype, "marketId", void 0);
25
25
  __decorate([
26
26
  (0, typeorm_1.Column)({ name: 'app_name', nullable: false }),
27
27
  __metadata("design:type", String)
@@ -1,6 +1,6 @@
1
1
  export declare class OrderExecution {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  txHash: string;
5
5
  executorAddress: string;
6
6
  type: string;
@@ -20,9 +20,9 @@ __decorate([
20
20
  __metadata("design:type", Number)
21
21
  ], OrderExecution.prototype, "id", void 0);
22
22
  __decorate([
23
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
23
+ (0, typeorm_1.Column)({ name: 'market_id' }),
24
24
  __metadata("design:type", String)
25
- ], OrderExecution.prototype, "blockchainCode", void 0);
25
+ ], OrderExecution.prototype, "marketId", void 0);
26
26
  __decorate([
27
27
  (0, typeorm_1.Column)({ name: 'tx_hash' }),
28
28
  __metadata("design:type", String)
@@ -1,6 +1,6 @@
1
1
  export declare class PeriodPerformance {
2
2
  id: number;
3
- blockchainCode: string;
3
+ marketId: string;
4
4
  day: number;
5
5
  week: number;
6
6
  month: number;
@@ -22,9 +22,9 @@ __decorate([
22
22
  ], PeriodPerformance.prototype, "id", void 0);
23
23
  __decorate([
24
24
  (0, graphql_1.Field)(() => String, { nullable: false }),
25
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
25
+ (0, typeorm_1.Column)({ name: 'market_id' }),
26
26
  __metadata("design:type", String)
27
- ], PeriodPerformance.prototype, "blockchainCode", void 0);
27
+ ], PeriodPerformance.prototype, "marketId", void 0);
28
28
  __decorate([
29
29
  (0, graphql_1.Field)(() => graphql_1.Float, { nullable: false }),
30
30
  (0, typeorm_1.Column)({ name: 'day', type: 'decimal', precision: 30, scale: 2, transformer: utils_1.numericTransformer }),
@@ -2,7 +2,7 @@ import { BigNumber } from 'ethers';
2
2
  import { LimitOrderEntity } from './limit-order.entity';
3
3
  export declare class PositionEntity {
4
4
  id: number;
5
- blockchainCode: string;
5
+ marketId: string;
6
6
  tokenId: number;
7
7
  account: string;
8
8
  status: string;
@@ -22,9 +22,9 @@ __decorate([
22
22
  __metadata("design:type", Number)
23
23
  ], PositionEntity.prototype, "id", void 0);
24
24
  __decorate([
25
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
25
+ (0, typeorm_1.Column)({ name: 'market_id' }),
26
26
  __metadata("design:type", String)
27
- ], PositionEntity.prototype, "blockchainCode", void 0);
27
+ ], PositionEntity.prototype, "marketId", void 0);
28
28
  __decorate([
29
29
  (0, typeorm_1.Column)({
30
30
  name: 'token_id',
@@ -1,7 +1,7 @@
1
1
  import { BigNumber } from 'ethers';
2
2
  export declare class ProtocolMetrics {
3
3
  id: number;
4
- blockchainCode: string;
4
+ marketId: string;
5
5
  unitDepositsVolume: BigNumber;
6
6
  unitWithdrawalsVolume: BigNumber;
7
7
  leverageTotalVolumeUsd: number;
@@ -24,9 +24,9 @@ __decorate([
24
24
  ], ProtocolMetrics.prototype, "id", void 0);
25
25
  __decorate([
26
26
  (0, graphql_1.Field)(() => String, { nullable: false }),
27
- (0, typeorm_1.Column)({ name: 'blockchain_code' }),
27
+ (0, typeorm_1.Column)({ name: 'market_id' }),
28
28
  __metadata("design:type", String)
29
- ], ProtocolMetrics.prototype, "blockchainCode", void 0);
29
+ ], ProtocolMetrics.prototype, "marketId", void 0);
30
30
  __decorate([
31
31
  (0, graphql_1.Field)(() => utils_2.CustomBigNumberScalar, { nullable: false }),
32
32
  (0, typeorm_1.Column)({ name: 'unit_deposits_volume', type: 'bigint', precision: 30, transformer: utils_1.bigNumberTransformer }),
@@ -5,6 +5,6 @@ export declare class ApyHistoryRepository {
5
5
  private readonly repository;
6
6
  private readonly logger;
7
7
  constructor(repository: Repository<ApyHistory>, logger: Logger);
8
- getAllFromTimestamp(blockchainCode: string, fromTimestamp: number): Promise<ApyHistory[]>;
8
+ getAllFromTimestamp(marketId: string, fromTimestamp: number): Promise<ApyHistory[]>;
9
9
  save(apyHistory: ApyHistory): void;
10
10
  }
@@ -22,11 +22,11 @@ let ApyHistoryRepository = class ApyHistoryRepository {
22
22
  this.repository = repository;
23
23
  this.logger = logger;
24
24
  }
25
- async getAllFromTimestamp(blockchainCode, fromTimestamp) {
25
+ async getAllFromTimestamp(marketId, fromTimestamp) {
26
26
  return await this.repository
27
27
  .createQueryBuilder('apy_history')
28
28
  .where('timestamp > :fromTimestamp', { fromTimestamp: fromTimestamp })
29
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
29
+ .andWhere('market_id = :marketId', { marketId: marketId })
30
30
  .orderBy('apy_history.timestamp', 'ASC')
31
31
  .getMany();
32
32
  }
@@ -5,6 +5,6 @@ export declare class ApyRepository {
5
5
  private repository;
6
6
  private readonly logger;
7
7
  constructor(repository: Repository<Apy>, logger: Logger);
8
- getApy(blockchainCode: string): Promise<Apy | null>;
8
+ getApy(marketId: string): Promise<Apy | null>;
9
9
  save(apy: Apy): void;
10
10
  }
@@ -22,11 +22,8 @@ let ApyRepository = class ApyRepository {
22
22
  this.repository = repository;
23
23
  this.logger = logger;
24
24
  }
25
- async getApy(blockchainCode) {
26
- return this.repository
27
- .createQueryBuilder()
28
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
29
- .getOne();
25
+ async getApy(marketId) {
26
+ return this.repository.createQueryBuilder().where('market_id = :marketId', { marketId: marketId }).getOne();
30
27
  }
31
28
  save(apy) {
32
29
  this.repository.save(apy).catch((error) => this.logger.error('Error while saving apy', error));
@@ -3,6 +3,6 @@ import { BorrowingRateApyHistory } from '../entity';
3
3
  export declare class BorrowingRateApyHistoryRepository {
4
4
  private readonly repository;
5
5
  constructor(repository: Repository<BorrowingRateApyHistory>);
6
- getAllFromTimestamp(blockchainCode: string, fromTimestamp: number): Promise<BorrowingRateApyHistory[]>;
6
+ getAllFromTimestamp(marketId: string, fromTimestamp: number): Promise<BorrowingRateApyHistory[]>;
7
7
  save(apyHistory: BorrowingRateApyHistory): Promise<void>;
8
8
  }
@@ -21,11 +21,11 @@ let BorrowingRateApyHistoryRepository = class BorrowingRateApyHistoryRepository
21
21
  constructor(repository) {
22
22
  this.repository = repository;
23
23
  }
24
- async getAllFromTimestamp(blockchainCode, fromTimestamp) {
24
+ async getAllFromTimestamp(marketId, fromTimestamp) {
25
25
  return await this.repository
26
26
  .createQueryBuilder()
27
27
  .where('timestamp > :fromTimestamp', { fromTimestamp: fromTimestamp })
28
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
28
+ .andWhere('market_id = :marketId', { marketId: marketId })
29
29
  .orderBy('timestamp', 'ASC')
30
30
  .getMany();
31
31
  }
@@ -5,9 +5,9 @@ export declare class FlatcoinPnlRepository {
5
5
  private readonly repository;
6
6
  private readonly logger;
7
7
  constructor(repository: Repository<FlatcoinPnl>, logger: Logger);
8
- getAll(blockchainCode: string): Promise<FlatcoinPnl[]>;
8
+ getAll(marketId: string): Promise<FlatcoinPnl[]>;
9
9
  save(flatcoinPnl: FlatcoinPnl): void;
10
10
  saveAll(flatcoinPnls: FlatcoinPnl[]): void;
11
- getLastUpdatedAt(blockchainCode: string): Promise<FlatcoinPnl | null>;
12
- findByAccount(account: string, blockchainCode: string): Promise<FlatcoinPnl | null>;
11
+ getLastUpdatedAt(marketId: string): Promise<FlatcoinPnl | null>;
12
+ findByAccount(account: string, marketId: string): Promise<FlatcoinPnl | null>;
13
13
  }
@@ -22,11 +22,8 @@ let FlatcoinPnlRepository = class FlatcoinPnlRepository {
22
22
  this.repository = repository;
23
23
  this.logger = logger;
24
24
  }
25
- async getAll(blockchainCode) {
26
- return this.repository
27
- .createQueryBuilder()
28
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
29
- .getMany();
25
+ async getAll(marketId) {
26
+ return this.repository.createQueryBuilder().where('market_id = :marketId', { marketId: marketId }).getMany();
30
27
  }
31
28
  save(flatcoinPnl) {
32
29
  this.repository.save(flatcoinPnl).catch((error) => this.logger.error('Error while saving flatcoin pnl', error));
@@ -34,21 +31,19 @@ let FlatcoinPnlRepository = class FlatcoinPnlRepository {
34
31
  saveAll(flatcoinPnls) {
35
32
  this.repository.save(flatcoinPnls).catch((error) => this.logger.error('Error while saving flatcoin pnl', error));
36
33
  }
37
- async getLastUpdatedAt(blockchainCode) {
34
+ async getLastUpdatedAt(marketId) {
38
35
  return await this.repository
39
36
  .createQueryBuilder('pnl')
40
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
37
+ .where('market_id = :marketId', { marketId: marketId })
41
38
  .orderBy('pnl.block_updated_at', 'DESC')
42
39
  .take(1)
43
40
  .getOne();
44
41
  }
45
- async findByAccount(account, blockchainCode) {
42
+ async findByAccount(account, marketId) {
46
43
  return await this.repository
47
44
  .createQueryBuilder('pnl')
48
- .where('pnl.account = :account')
49
- .andWhere('blockchain_code = :blockchainCode')
50
- .setParameter('blockchainCode', blockchainCode)
51
- .setParameter('account', account)
45
+ .where('pnl.account = :account', { account: account })
46
+ .andWhere('market_id = :marketId', { marketId: marketId })
52
47
  .take(1)
53
48
  .getOne();
54
49
  }
@@ -12,6 +12,6 @@ export declare class LeverageBalanceRepository {
12
12
  private leverageBalanceThreeMonthsRepository;
13
13
  private leverageBalanceOneYearRepository;
14
14
  constructor(leverageBalanceOneDayRepository: Repository<LeverageBalanceOneDay>, leverageBalanceOneWeekRepository: Repository<LeverageBalanceOneWeek>, leverageBalanceOneMonthRepository: Repository<LeverageBalanceOneMonth>, leverageBalanceThreeMonthsRepository: Repository<LeverageBalanceThreeMonths>, leverageBalanceOneYearRepository: Repository<LeverageBalanceOneYear>);
15
- findAllByPeriod(account: string, blockchainCode: string, period: string): Promise<UnitBalanceParent[]>;
15
+ findAllByPeriod(account: string, marketId: string, period: string): Promise<UnitBalanceParent[]>;
16
16
  getRepository(period: string): Repository<any>;
17
17
  }
@@ -30,11 +30,11 @@ let LeverageBalanceRepository = class LeverageBalanceRepository {
30
30
  this.leverageBalanceThreeMonthsRepository = leverageBalanceThreeMonthsRepository;
31
31
  this.leverageBalanceOneYearRepository = leverageBalanceOneYearRepository;
32
32
  }
33
- async findAllByPeriod(account, blockchainCode, period) {
33
+ async findAllByPeriod(account, marketId, period) {
34
34
  return this.getRepository(period)
35
35
  .createQueryBuilder()
36
36
  .where('account = :account', { account: account })
37
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
37
+ .andWhere('market_id = :marketId', { marketId: marketId })
38
38
  .orderBy('timestamp', 'ASC')
39
39
  .getMany();
40
40
  }
@@ -3,9 +3,9 @@ import { LeverageLeaderboard } from '../entity';
3
3
  export declare class LeverageLeaderboardRepository {
4
4
  private repository;
5
5
  constructor(repository: Repository<LeverageLeaderboard>);
6
- findByLastTimestamp(blockchainCode: string, period: string): Promise<LeverageLeaderboard | null>;
7
- findByAccount(account: string, blockchainCode: string, period: string): Promise<LeverageLeaderboard | null>;
8
- findAllOrderedByPnl(blockchainCode: string, period: string): Promise<LeverageLeaderboard[]>;
6
+ findByLastTimestamp(marketId: string, period: string): Promise<LeverageLeaderboard | null>;
7
+ findByAccount(account: string, marketId: string, period: string): Promise<LeverageLeaderboard | null>;
8
+ findAllOrderedByPnl(marketId: string, period: string): Promise<LeverageLeaderboard[]>;
9
9
  saveAll(leverageLeaderboard: LeverageLeaderboard[]): Promise<void>;
10
- deleteByCodeAndPeriod(blockchainCode: string, period: string): Promise<void>;
10
+ deleteByCodeAndPeriod(marketId: string, period: string): Promise<void>;
11
11
  }
@@ -21,28 +21,28 @@ let LeverageLeaderboardRepository = class LeverageLeaderboardRepository {
21
21
  constructor(repository) {
22
22
  this.repository = repository;
23
23
  }
24
- async findByLastTimestamp(blockchainCode, period) {
24
+ async findByLastTimestamp(marketId, period) {
25
25
  return await this.repository
26
26
  .createQueryBuilder('leverageLeaderboard')
27
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
27
+ .where('market_id = :marketId', { marketId: marketId })
28
28
  .andWhere('period = :period', { period: period })
29
29
  .orderBy('leverageLeaderboard.last_closed_position_timestamp', 'DESC')
30
30
  .take(1)
31
31
  .getOne();
32
32
  }
33
- async findByAccount(account, blockchainCode, period) {
33
+ async findByAccount(account, marketId, period) {
34
34
  return await this.repository
35
35
  .createQueryBuilder('leverageLeaderboard')
36
36
  .where('leverageLeaderboard.account = :account', { account: account })
37
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
37
+ .andWhere('market_id = :marketId', { marketId: marketId })
38
38
  .andWhere('period = :period', { period: period })
39
39
  .take(1)
40
40
  .getOne();
41
41
  }
42
- async findAllOrderedByPnl(blockchainCode, period) {
42
+ async findAllOrderedByPnl(marketId, period) {
43
43
  return this.repository
44
44
  .createQueryBuilder('leverageLeaderboard')
45
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
45
+ .where('market_id = :marketId', { marketId: marketId })
46
46
  .andWhere('period = :period', { period: period })
47
47
  .orderBy('leverageLeaderboard.total_pnl_reth', 'DESC')
48
48
  .getMany();
@@ -50,10 +50,10 @@ let LeverageLeaderboardRepository = class LeverageLeaderboardRepository {
50
50
  async saveAll(leverageLeaderboard) {
51
51
  await this.repository.save(leverageLeaderboard);
52
52
  }
53
- async deleteByCodeAndPeriod(blockchainCode, period) {
53
+ async deleteByCodeAndPeriod(marketId, period) {
54
54
  await this.repository
55
55
  .createQueryBuilder()
56
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
56
+ .where('market_id = :marketId', { marketId: marketId })
57
57
  .andWhere('period = :period', { period: period })
58
58
  .delete();
59
59
  }
@@ -3,8 +3,8 @@ import { Repository } from 'typeorm';
3
3
  export declare class LeverageMonthlyPnlRepository {
4
4
  private repository;
5
5
  constructor(repository: Repository<LeverageMonthlyPnl>);
6
- findAllByAccount(account: string, blockchainCode: string): Promise<LeverageMonthlyPnl[]>;
7
- findByLastTimestamp(blockchainCode: string): Promise<LeverageMonthlyPnl | null>;
8
- findByAccountAndTimestamp(account: string, timestamp: number, blockchainCode: string): Promise<LeverageMonthlyPnl | null>;
6
+ findAllByAccount(account: string, marketId: string): Promise<LeverageMonthlyPnl[]>;
7
+ findByLastTimestamp(marketId: string): Promise<LeverageMonthlyPnl | null>;
8
+ findByAccountAndTimestamp(account: string, timestamp: number, marketId: string): Promise<LeverageMonthlyPnl | null>;
9
9
  saveAll(leverageLeaderboard: LeverageMonthlyPnl[]): Promise<void>;
10
10
  }
@@ -21,28 +21,28 @@ let LeverageMonthlyPnlRepository = class LeverageMonthlyPnlRepository {
21
21
  constructor(repository) {
22
22
  this.repository = repository;
23
23
  }
24
- async findAllByAccount(account, blockchainCode) {
24
+ async findAllByAccount(account, marketId) {
25
25
  return await this.repository
26
26
  .createQueryBuilder()
27
27
  .where('account = :account', { account: account })
28
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
28
+ .andWhere('market_id = :marketId', { marketId: marketId })
29
29
  .orderBy('timestamp', 'ASC')
30
30
  .getMany();
31
31
  }
32
- async findByLastTimestamp(blockchainCode) {
32
+ async findByLastTimestamp(marketId) {
33
33
  return await this.repository
34
34
  .createQueryBuilder()
35
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
35
+ .where('market_id = :marketId', { marketId: marketId })
36
36
  .orderBy('last_closed_position_timestamp', 'DESC')
37
37
  .take(1)
38
38
  .getOne();
39
39
  }
40
- async findByAccountAndTimestamp(account, timestamp, blockchainCode) {
40
+ async findByAccountAndTimestamp(account, timestamp, marketId) {
41
41
  return await this.repository
42
42
  .createQueryBuilder()
43
43
  .where('account = :account', { account: account })
44
44
  .andWhere('timestamp = :timestamp', { timestamp: timestamp })
45
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
45
+ .andWhere('market_id = :marketId', { marketId: marketId })
46
46
  .take(1)
47
47
  .getOne();
48
48
  }
@@ -5,6 +5,6 @@ export declare class LimitOrderRepository {
5
5
  constructor(repository: Repository<LimitOrderEntity>);
6
6
  save(limitOrder: LimitOrderEntity): Promise<LimitOrderEntity>;
7
7
  saveAll(limitOrder: LimitOrderEntity[]): Promise<LimitOrderEntity[]>;
8
- getAllByStatusOpen(blockchainCode: string): Promise<LimitOrderEntity[]>;
9
- getByTokenId(tokenId: number, blockchainCode: string): Promise<LimitOrderEntity | null>;
8
+ getAllByStatusOpen(marketId: string): Promise<LimitOrderEntity[]>;
9
+ getByTokenId(tokenId: number, marketId: string): Promise<LimitOrderEntity | null>;
10
10
  }
@@ -28,19 +28,19 @@ let LimitOrderRepository = class LimitOrderRepository {
28
28
  async saveAll(limitOrder) {
29
29
  return this.repository.save(limitOrder);
30
30
  }
31
- async getAllByStatusOpen(blockchainCode) {
31
+ async getAllByStatusOpen(marketId) {
32
32
  return this.repository
33
33
  .createQueryBuilder()
34
34
  .where('status = :status', { status: constants_1.LimitOrderStatus.OPEN })
35
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
35
+ .andWhere('market_id = :marketId', { marketId: marketId })
36
36
  .orderBy('liquidation_price', 'DESC')
37
37
  .getMany();
38
38
  }
39
- async getByTokenId(tokenId, blockchainCode) {
39
+ async getByTokenId(tokenId, marketId) {
40
40
  return await this.repository
41
41
  .createQueryBuilder()
42
42
  .where('token_id = :tokenId', { tokenId: tokenId })
43
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
43
+ .andWhere('market_id = :marketId', { marketId: marketId })
44
44
  .where('status = :status', { status: constants_1.LimitOrderStatus.OPEN })
45
45
  .take(1)
46
46
  .getOne();
@@ -4,5 +4,5 @@ export declare class MultichainConfigRepository {
4
4
  private repository;
5
5
  constructor(repository: Repository<MultichainConfig>);
6
6
  getById(id: number): Promise<MultichainConfig | null>;
7
- getByAppAndCode(appName: string, blockchainCode: string): Promise<MultichainConfig | null>;
7
+ getByAppAndCode(appName: string, marketId: string): Promise<MultichainConfig | null>;
8
8
  }
@@ -24,13 +24,11 @@ let MultichainConfigRepository = class MultichainConfigRepository {
24
24
  async getById(id) {
25
25
  return this.repository.createQueryBuilder().where('id = :id').setParameter('id', id).take(1).getOne();
26
26
  }
27
- async getByAppAndCode(appName, blockchainCode) {
27
+ async getByAppAndCode(appName, marketId) {
28
28
  return this.repository
29
29
  .createQueryBuilder()
30
- .where('app_name = :appName')
31
- .andWhere('blockchain_code = :blockchainCode')
32
- .setParameter('appName', appName)
33
- .setParameter('blockchainCode', blockchainCode)
30
+ .where('app_name = :appName', { appName: appName })
31
+ .andWhere('market_id = :marketId', { marketId: marketId })
34
32
  .take(1)
35
33
  .getOne();
36
34
  }
@@ -5,5 +5,5 @@ export declare class OrderExecutionRepository {
5
5
  constructor(repository: Repository<OrderExecution>);
6
6
  save(orderExecution: OrderExecution): Promise<OrderExecution>;
7
7
  saveAll(orderExecutions: OrderExecution[]): Promise<OrderExecution[]>;
8
- getLatestRecord(blockchainCode: string): Promise<OrderExecution | null>;
8
+ getLatestRecord(marketId: string): Promise<OrderExecution | null>;
9
9
  }
@@ -27,11 +27,10 @@ let OrderExecutionRepository = class OrderExecutionRepository {
27
27
  async saveAll(orderExecutions) {
28
28
  return this.repository.save(orderExecutions);
29
29
  }
30
- async getLatestRecord(blockchainCode) {
30
+ async getLatestRecord(marketId) {
31
31
  return this.repository
32
32
  .createQueryBuilder()
33
- .where('blockchain_code = :blockchainCode')
34
- .setParameter('blockchainCode', blockchainCode)
33
+ .where('market_id = :marketId', { marketId: marketId })
35
34
  .orderBy('executed_at', 'DESC')
36
35
  .limit(1)
37
36
  .getOne();
@@ -6,8 +6,8 @@ export declare class PositionRepository {
6
6
  constructor(repository: Repository<PositionEntity>);
7
7
  save(position: PositionEntity): Promise<PositionEntity>;
8
8
  saveAll(positions: PositionEntity[]): Promise<PositionEntity[]>;
9
- getAllByStatusOpen(blockchainCode: string): Promise<PositionEntity[]>;
10
- updateLiquidationPrice(tokenId: number, blockchainCode: string, liqPrice: BigNumber): Promise<void>;
11
- getOneByTokenId(tokenId: number, blockchainCode: string): Promise<PositionEntity | null>;
12
- getLatestUpdateAtBlock(blockchainCode: string): Promise<number>;
9
+ getAllByStatusOpen(marketId: string): Promise<PositionEntity[]>;
10
+ updateLiquidationPrice(tokenId: number, marketId: string, liqPrice: BigNumber): Promise<void>;
11
+ getOneByTokenId(tokenId: number, marketId: string): Promise<PositionEntity | null>;
12
+ getLatestUpdateAtBlock(marketId: string): Promise<number>;
13
13
  }
@@ -28,36 +28,36 @@ let PositionRepository = class PositionRepository {
28
28
  async saveAll(positions) {
29
29
  return this.repository.save(positions);
30
30
  }
31
- async getAllByStatusOpen(blockchainCode) {
31
+ async getAllByStatusOpen(marketId) {
32
32
  return this.repository
33
33
  .createQueryBuilder()
34
34
  .where('status = :status', { status: constants_1.LeveragePositionStatus.OPEN })
35
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
35
+ .andWhere('market_id = :marketId', { marketId: marketId })
36
36
  .orderBy('liquidation_price', 'DESC')
37
37
  .getMany();
38
38
  }
39
- async updateLiquidationPrice(tokenId, blockchainCode, liqPrice) {
39
+ async updateLiquidationPrice(tokenId, marketId, liqPrice) {
40
40
  await this.repository
41
41
  .createQueryBuilder()
42
42
  .update(entity_1.PositionEntity)
43
43
  .set({ liquidationPrice: liqPrice })
44
44
  .where('token_id = :tokenId', { tokenId: tokenId })
45
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
45
+ .andWhere('market_id = :marketId', { marketId: marketId })
46
46
  .execute();
47
47
  }
48
- async getOneByTokenId(tokenId, blockchainCode) {
48
+ async getOneByTokenId(tokenId, marketId) {
49
49
  return await this.repository
50
50
  .createQueryBuilder()
51
51
  .where('token_id = :tokenId', { tokenId: tokenId })
52
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
52
+ .andWhere('market_id = :marketId', { marketId: marketId })
53
53
  .take(1)
54
54
  .getOne();
55
55
  }
56
- async getLatestUpdateAtBlock(blockchainCode) {
56
+ async getLatestUpdateAtBlock(marketId) {
57
57
  const p = await this.repository
58
58
  .createQueryBuilder('position')
59
59
  .select(['position.block_updated_at'])
60
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
60
+ .where('market_id = :marketId', { marketId: marketId })
61
61
  .orderBy('block_updated_at', 'DESC')
62
62
  .getRawOne();
63
63
  return p ? parseInt(p.block_updated_at) : 0;
@@ -7,10 +7,10 @@ export declare class PriceRepository {
7
7
  private flatcoinPriceOneYearRepository;
8
8
  private readonly repository;
9
9
  constructor(flatcoinPriceOneDayRepository: Repository<FlatcoinPriceOneDay>, flatcoinPriceOneWeekRepository: Repository<FlatcoinPriceOneWeek>, flatcoinPriceOneMonthRepository: Repository<FlatcoinPriceOneMonth>, flatcoinPriceOneYearRepository: Repository<FlatcoinPriceOneYear>, repository: Repository<FlatcoinPrice>);
10
- findAllByPeriod(period: string, blockchainCode: string): Promise<FlatcoinPriceParent[]>;
11
- findLast(blockchainCode: string): Promise<FlatcoinPrice | null>;
12
- findFirstByTimestamp(fromTimestamp: number, blockchainCode: string): Promise<FlatcoinPrice | null>;
13
- findFirstByBlock(fromBlock: number, blockchainCode: string): Promise<FlatcoinPrice | null>;
14
- findFirst(blockchainCode: string): Promise<FlatcoinPrice | null>;
10
+ findAllByPeriod(period: string, marketId: string): Promise<FlatcoinPriceParent[]>;
11
+ findLast(marketId: string): Promise<FlatcoinPrice | null>;
12
+ findFirstByTimestamp(fromTimestamp: number, marketId: string): Promise<FlatcoinPrice | null>;
13
+ findFirstByBlock(fromBlock: number, marketId: string): Promise<FlatcoinPrice | null>;
14
+ findFirst(marketId: string): Promise<FlatcoinPrice | null>;
15
15
  private getRepository;
16
16
  }
@@ -26,50 +26,45 @@ let PriceRepository = class PriceRepository {
26
26
  this.flatcoinPriceOneYearRepository = flatcoinPriceOneYearRepository;
27
27
  this.repository = repository;
28
28
  }
29
- async findAllByPeriod(period, blockchainCode) {
29
+ async findAllByPeriod(period, marketId) {
30
30
  return this.getRepository(period)
31
31
  .createQueryBuilder('price')
32
- .where('blockchain_code = :blockchainCode')
33
- .setParameter('blockchainCode', blockchainCode)
32
+ .where('market_id = :marketId', { marketId: marketId })
34
33
  .orderBy('price.timestamp', 'ASC')
35
34
  .getMany();
36
35
  }
37
- async findLast(blockchainCode) {
36
+ async findLast(marketId) {
38
37
  return this.repository
39
38
  .createQueryBuilder()
40
- .where('blockchain_code = :blockchainCode')
41
- .setParameter('blockchainCode', blockchainCode)
39
+ .where('market_id = :marketId', { marketId: marketId })
42
40
  .orderBy('timestamp', 'DESC')
43
41
  .take(1)
44
42
  .getOne();
45
43
  }
46
- async findFirstByTimestamp(fromTimestamp, blockchainCode) {
44
+ async findFirstByTimestamp(fromTimestamp, marketId) {
47
45
  return await this.repository
48
46
  .createQueryBuilder('price')
49
47
  .where('timestamp > :fromTimestamp')
50
- .andWhere('blockchain_code = :blockchainCode')
51
- .setParameter('blockchainCode', blockchainCode)
48
+ .andWhere('market_id = :marketId', { marketId: marketId })
52
49
  .orderBy('price.timestamp', 'ASC')
53
50
  .setParameter('fromTimestamp', fromTimestamp)
54
51
  .take(1)
55
52
  .getOne();
56
53
  }
57
- async findFirstByBlock(fromBlock, blockchainCode) {
54
+ async findFirstByBlock(fromBlock, marketId) {
58
55
  return await this.repository
59
56
  .createQueryBuilder()
60
57
  .where('block_number > :fromBlock')
61
- .andWhere('blockchain_code = :blockchainCode')
62
- .setParameter('blockchainCode', blockchainCode)
58
+ .andWhere('market_id = :marketId', { marketId: marketId })
63
59
  .setParameter('fromBlock', fromBlock)
64
60
  .orderBy('timestamp', 'ASC')
65
61
  .take(1)
66
62
  .getOne();
67
63
  }
68
- async findFirst(blockchainCode) {
64
+ async findFirst(marketId) {
69
65
  return await this.repository
70
66
  .createQueryBuilder('price')
71
- .where('blockchain_code = :blockchainCode')
72
- .setParameter('blockchainCode', blockchainCode)
67
+ .where('market_id = :marketId', { marketId: marketId })
73
68
  .orderBy('price.timestamp', 'ASC')
74
69
  .take(1)
75
70
  .getOne();
@@ -4,5 +4,5 @@ export declare class ProtocolMetricsRepository {
4
4
  private repository;
5
5
  constructor(repository: Repository<ProtocolMetrics>);
6
6
  save(protocolMetrics: ProtocolMetrics): Promise<ProtocolMetrics>;
7
- getLatestRecord(blockchainCode: string): Promise<ProtocolMetrics | null>;
7
+ getLatestRecord(marketId: string): Promise<ProtocolMetrics | null>;
8
8
  }
@@ -24,10 +24,10 @@ let ProtocolMetricsRepository = class ProtocolMetricsRepository {
24
24
  async save(protocolMetrics) {
25
25
  return this.repository.save(protocolMetrics);
26
26
  }
27
- async getLatestRecord(blockchainCode) {
27
+ async getLatestRecord(marketId) {
28
28
  return this.repository
29
29
  .createQueryBuilder()
30
- .where('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
30
+ .where('market_id = :marketId', { marketId: marketId })
31
31
  .limit(1)
32
32
  .getOne();
33
33
  }
@@ -12,6 +12,6 @@ export declare class UnitBalanceRepository {
12
12
  private unitBalanceHalfYearRepository;
13
13
  private unitBalanceOneYearRepository;
14
14
  constructor(unitBalanceOneWeekRepository: Repository<UnitBalanceOneWeek>, unitBalanceOneMonthRepository: Repository<UnitBalanceOneMonth>, unitBalanceThreeMonthsRepository: Repository<UnitBalanceThreeMonths>, unitBalanceHalfYearRepository: Repository<UnitBalanceHalfYear>, unitBalanceOneYearRepository: Repository<UnitBalanceOneYear>);
15
- findAllByPeriod(account: string, period: string, blockchainCode: string): Promise<UnitBalanceParent[]>;
15
+ findAllByPeriod(account: string, period: string, marketId: string): Promise<UnitBalanceParent[]>;
16
16
  getRepository(period: string): Repository<any>;
17
17
  }
@@ -30,11 +30,11 @@ let UnitBalanceRepository = class UnitBalanceRepository {
30
30
  this.unitBalanceHalfYearRepository = unitBalanceHalfYearRepository;
31
31
  this.unitBalanceOneYearRepository = unitBalanceOneYearRepository;
32
32
  }
33
- async findAllByPeriod(account, period, blockchainCode) {
33
+ async findAllByPeriod(account, period, marketId) {
34
34
  return this.getRepository(period)
35
35
  .createQueryBuilder()
36
36
  .where('account = :account', { account: account })
37
- .andWhere('blockchain_code = :blockchainCode', { blockchainCode: blockchainCode })
37
+ .andWhere('market_id = :marketId', { marketId: marketId })
38
38
  .orderBy('timestamp', 'ASC')
39
39
  .getMany();
40
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/backend-flatcoin-core",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Backend Flatcoin Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",