Browse Source

Merge branch 'main' into fix/fix-import-by-isin-number

pull/3051/head
Thomas Kaul 2 years ago
committed by GitHub
parent
commit
2c0acb2d7a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      CHANGELOG.md
  2. 21
      apps/api/src/app/import/import.service.ts
  3. 15
      apps/api/src/app/order/order.service.ts
  4. 4
      apps/api/src/app/portfolio/portfolio.service.ts
  5. 2
      package.json

11
CHANGELOG.md

@ -11,6 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the activities import by `isin` in the _Yahoo Finance_ service - Improved the activities import by `isin` in the _Yahoo Finance_ service
## 2.58.0 - 2024-02-27
### Changed
- Improved the handling of activities without account
### Fixed
- Fixed the query to filter activities of excluded accounts
- Improved the asset profile validation in the activities import
## 2.57.0 - 2024-02-25 ## 2.57.0 - 2024-02-25
### Changed ### Changed

21
apps/api/src/app/import/import.service.ts

@ -570,17 +570,10 @@ export class ImportService {
[assetProfileIdentifier: string]: Partial<SymbolProfile>; [assetProfileIdentifier: string]: Partial<SymbolProfile>;
} = {}; } = {};
const uniqueActivitiesDto = uniqBy(
activitiesDto,
({ dataSource, symbol }) => {
return getAssetProfileIdentifier({ dataSource, symbol });
}
);
for (const [ for (const [
index, index,
{ currency, dataSource, symbol, type } { currency, dataSource, symbol, type }
] of uniqueActivitiesDto.entries()) { ] of activitiesDto.entries()) {
if (!this.configurationService.get('DATA_SOURCES').includes(dataSource)) { if (!this.configurationService.get('DATA_SOURCES').includes(dataSource)) {
throw new Error( throw new Error(
`activities.${index}.dataSource ("${dataSource}") is not valid` `activities.${index}.dataSource ("${dataSource}") is not valid`
@ -602,6 +595,7 @@ export class ImportService {
} }
} }
if (!assetProfiles[getAssetProfileIdentifier({ dataSource, symbol })]) {
const assetProfile = { const assetProfile = {
currency, currency,
...( ...(
@ -618,15 +612,9 @@ export class ImportService {
); );
} }
if ( if (assetProfile.currency !== currency) {
assetProfile.currency !== currency &&
!this.exchangeRateDataService.hasCurrencyPair(
currency,
assetProfile.currency
)
) {
throw new Error( throw new Error(
`activities.${index}.currency ("${currency}") does not match with "${assetProfile.currency}" and no exchange rate is available from "${currency}" to "${assetProfile.currency}"` `activities.${index}.currency ("${currency}") does not match with currency of ${assetProfile.symbol} ("${assetProfile.currency}")`
); );
} }
} }
@ -634,6 +622,7 @@ export class ImportService {
assetProfiles[getAssetProfileIdentifier({ dataSource, symbol })] = assetProfiles[getAssetProfileIdentifier({ dataSource, symbol })] =
assetProfile; assetProfile;
} }
}
return assetProfiles; return assetProfiles;
} }

15
apps/api/src/app/order/order.service.ts

@ -292,19 +292,14 @@ export class OrderService {
} }
if (types) { if (types) {
where.OR = types.map((type) => { where.type = { in: types };
return {
type: {
equals: type
}
};
});
} }
if (withExcludedAccounts === false) { if (withExcludedAccounts === false) {
where.Account = { where.OR = [
NOT: { isExcluded: true } { Account: null },
}; { Account: { NOT: { isExcluded: true } } }
];
} }
const [orders, count] = await Promise.all([ const [orders, count] = await Promise.all([

4
apps/api/src/app/portfolio/portfolio.service.ts

@ -749,7 +749,9 @@ export class PortfolioService {
} = position; } = position;
const accounts: PortfolioPositionDetail['accounts'] = uniqBy( const accounts: PortfolioPositionDetail['accounts'] = uniqBy(
orders, orders.filter(({ Account }) => {
return Account;
}),
'Account.id' 'Account.id'
).map(({ Account }) => { ).map(({ Account }) => {
return Account; return Account;

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.57.0", "version": "2.58.0",
"homepage": "https://ghostfol.io", "homepage": "https://ghostfol.io",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"repository": "https://github.com/ghostfolio/ghostfolio", "repository": "https://github.com/ghostfolio/ghostfolio",

Loading…
Cancel
Save