From cd07802400301f2ab3f2f4b3ef9e6ff7a416bf18 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Apr 2024 15:29:32 +0200 Subject: [PATCH] Bugfix/fix historical market data gathering for asset profiles with manual data source (#3336) * Fix historical market data gathering for asset profiles with MANUAL data source * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/import/import.service.ts | 5 +++++ apps/api/src/app/order/order.service.ts | 3 ++- apps/api/src/services/data-provider/manual/manual.service.ts | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18e38e100..e558f5afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the form submit in the asset profile details dialog of the admin control due to the `url` validation +- Fixed the historical market data gathering for asset profiles with `MANUAL` data source ## 2.76.0 - 2024-04-23 diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 26df9d069..a1ddeb482 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -416,6 +416,11 @@ export class ImportService { User: { connect: { id: user.id } }, userId: user.id }); + + if (order.SymbolProfile?.symbol) { + // Update symbol that may have been assigned in createOrder() + assetProfile.symbol = order.SymbolProfile.symbol; + } } const value = new Big(quantity).mul(unitPrice).toNumber(); diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index a78daa143..e976fc80d 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -140,7 +140,8 @@ export class OrderService { return { id }; }) } - } + }, + include: { SymbolProfile: true } }); if (updateAccountBalance === true) { diff --git a/apps/api/src/services/data-provider/manual/manual.service.ts b/apps/api/src/services/data-provider/manual/manual.service.ts index 4ff3ba653..5066a4d3a 100644 --- a/apps/api/src/services/data-provider/manual/manual.service.ts +++ b/apps/api/src/services/data-provider/manual/manual.service.ts @@ -91,7 +91,7 @@ export class ManualService implements DataProviderInterface { headers = {}, selector, url - } = symbolProfile.scraperConfiguration ?? {}; + } = symbolProfile?.scraperConfiguration ?? {}; if (defaultMarketPrice) { const historical: {