diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c10402f1..b829416ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for commodities (via futures) +- Added support for real estate ### Changed @@ -21,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed the import validation for numbers equal 0 - Fixed the color of the spinner in the activities filter component (dark mode) +### Todo + +- Apply data migration (`yarn database:migrate`) + ## 1.143.0 - 26.04.2022 ### Changed diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts index 3d07c833b..0f0683ac8 100644 --- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts @@ -365,6 +365,16 @@ export class YahooFinanceService implements DataProviderInterface { case 'future': assetClass = AssetClass.COMMODITY; assetSubClass = AssetSubClass.COMMODITY; + + if ( + aPrice?.shortName?.toLowerCase()?.startsWith('gold') || + aPrice?.shortName?.toLowerCase()?.startsWith('palladium') || + aPrice?.shortName?.toLowerCase()?.startsWith('platinum') || + aPrice?.shortName?.toLowerCase()?.startsWith('silver') + ) { + assetSubClass = AssetSubClass.PRECIOUS_METAL; + } + break; case 'mutualfund': assetClass = AssetClass.EQUITY; diff --git a/prisma/migrations/20220430083454_added_real_estate_to_asset_class/migration.sql b/prisma/migrations/20220430083454_added_real_estate_to_asset_class/migration.sql new file mode 100644 index 000000000..32707aff7 --- /dev/null +++ b/prisma/migrations/20220430083454_added_real_estate_to_asset_class/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "AssetClass" ADD VALUE 'REAL_ESTATE'; diff --git a/prisma/migrations/20220430083631_added_precious_metal_to_asset_sub_class/migration.sql b/prisma/migrations/20220430083631_added_precious_metal_to_asset_sub_class/migration.sql new file mode 100644 index 000000000..149f87b72 --- /dev/null +++ b/prisma/migrations/20220430083631_added_precious_metal_to_asset_sub_class/migration.sql @@ -0,0 +1,2 @@ +-- AlterEnum +ALTER TYPE "AssetSubClass" ADD VALUE 'PRECIOUS_METAL'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index db2ee93c8..a267ab811 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -185,6 +185,7 @@ enum AssetClass { COMMODITY EQUITY FIXED_INCOME + REAL_ESTATE } enum AssetSubClass { @@ -193,6 +194,7 @@ enum AssetSubClass { CRYPTOCURRENCY ETF MUTUALFUND + PRECIOUS_METAL STOCK }