Feature/change data gathering selection (#368)
* Change data gathering selection from distinct orders to symbol profiles * Update changelog
This commit is contained in:
parent
d2aeeb3e88
commit
4a815d2031
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Optimized the annualized performance calculation
|
- Optimized the annualized performance calculation
|
||||||
|
- Changed the data gathering selection from distinct orders to symbol profiles
|
||||||
|
|
||||||
## 1.52.0 - 11.09.2021
|
## 1.52.0 - 11.09.2021
|
||||||
|
|
||||||
|
@ -309,27 +309,20 @@ export class DataGatheringService {
|
|||||||
private async getSymbols7D(): Promise<IDataGatheringItem[]> {
|
private async getSymbols7D(): Promise<IDataGatheringItem[]> {
|
||||||
const startDate = subDays(resetHours(new Date()), 7);
|
const startDate = subDays(resetHours(new Date()), 7);
|
||||||
|
|
||||||
const distinctOrders = await this.prismaService.order.findMany({
|
const symbolProfilesToGather = (
|
||||||
distinct: ['symbol'],
|
await this.prismaService.symbolProfile.findMany({
|
||||||
orderBy: [{ symbol: 'asc' }],
|
orderBy: [{ symbol: 'asc' }],
|
||||||
select: { dataSource: true, symbol: true },
|
select: {
|
||||||
where: {
|
dataSource: true,
|
||||||
date: {
|
symbol: true
|
||||||
lt: endOfToday() // no draft
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const distinctOrdersWithDate: IDataGatheringItem[] = distinctOrders
|
|
||||||
.filter((distinctOrder) => {
|
|
||||||
return !isGhostfolioScraperApiSymbol(distinctOrder.symbol);
|
|
||||||
})
|
})
|
||||||
.map((distinctOrder) => {
|
).map((symbolProfile) => {
|
||||||
return {
|
return {
|
||||||
...distinctOrder,
|
...symbolProfile,
|
||||||
date: startDate
|
date: startDate
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const currencyPairsToGather = currencyPairs.map(
|
const currencyPairsToGather = currencyPairs.map(
|
||||||
({ dataSource, symbol }) => {
|
({ dataSource, symbol }) => {
|
||||||
@ -348,7 +341,7 @@ export class DataGatheringService {
|
|||||||
...this.getBenchmarksToGather(startDate),
|
...this.getBenchmarksToGather(startDate),
|
||||||
...customSymbolsToGather,
|
...customSymbolsToGather,
|
||||||
...currencyPairsToGather,
|
...currencyPairsToGather,
|
||||||
...distinctOrdersWithDate
|
...symbolProfilesToGather
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,22 +361,20 @@ export class DataGatheringService {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const distinctOrders = await this.prismaService.order.findMany({
|
const symbolProfilesToGather =
|
||||||
distinct: ['symbol'],
|
await this.prismaService.symbolProfile.findMany({
|
||||||
orderBy: [{ date: 'asc' }],
|
orderBy: [{ symbol: 'asc' }],
|
||||||
select: { dataSource: true, date: true, symbol: true },
|
select: {
|
||||||
where: {
|
dataSource: true,
|
||||||
date: {
|
symbol: true
|
||||||
lt: endOfToday() // no draft
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...this.getBenchmarksToGather(startDate),
|
...this.getBenchmarksToGather(startDate),
|
||||||
...customSymbolsToGather,
|
...customSymbolsToGather,
|
||||||
...currencyPairsToGather,
|
...currencyPairsToGather,
|
||||||
...distinctOrders
|
...symbolProfilesToGather
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Order" ALTER COLUMN "currency" DROP NOT NULL;
|
@ -76,7 +76,7 @@ model Order {
|
|||||||
accountId String?
|
accountId String?
|
||||||
accountUserId String?
|
accountUserId String?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
currency Currency
|
currency Currency?
|
||||||
dataSource DataSource @default(YAHOO)
|
dataSource DataSource @default(YAHOO)
|
||||||
date DateTime
|
date DateTime
|
||||||
fee Float
|
fee Float
|
||||||
|
Loading…
x
Reference in New Issue
Block a user