ghostfolio / ghostfolio

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
https://Ghostfol.io
GNU Affero General Public License v3.0
4.51k stars 454 forks source link

[BUG] Manually added symbols not used during import #2295

Closed pcaro90 closed 1 year ago

pcaro90 commented 1 year ago

The Issue tracker is ONLY used for reporting bugs. New features should be discussed in our Slack community or in Discussions.

Bug Description

After following the guidelines given in #509 in order to add a new symbol (in this case, BME.MC, a Spanish company that ceased trading on the stock market in 2020), I can use this symbol to manually create a new activity, without issue:

image

However, when trying to import activity (both using CSV and JSON), an error is raised for this symbol; probably related

To Reproduce

  1. Create a new Symbol (e.g. INSERT INTO "SymbolProfile" ("name", "symbol", "currency", "dataSource", "id", "updatedAt") VALUES ('Bolsas y Mercados Españoles', 'BME.MC', 'EUR', 'MANUAL', 'eb039bd7-2c57-4263-9816-b143baf57cee', current_timestamp);).
  2. Add entries in MarketData. I added two:
    • INSERT INTO "MarketData"("symbol", "dataSource", "id", "marketPrice", "date") VALUES ('BME.MC', 'MANUAL', 'a2f0cf54-32e8-4d6b-84b7-2381e5f26e18', 33.68, '2015-10-30');
    • INSERT INTO "MarketData"("symbol", "dataSource", "id", "marketPrice", "date") VALUES ('BME.MC', 'MANUAL', 'dbf88287-4d2b-427a-b51a-f81c37893d38', 29.19, '2018-06-15');
  3. Try to import activities containing the created symbol. For example:
    {
    "activities": [
    {
      "date": "2015-10-30T00:00",
      "symbol": "BME.MC",
      "currency": "EUR",
      "unitPrice": 33.68,
      "quantity": 26,
      "type": "BUY",
      "fee": 10.76,
      "accountId": "83ca9c73-97da-45ba-8adc-44a76198f1da"
    }
    ]
    }
  4. The following error is raised:

image

Expected behavior

The activities are imported.

Screenshots

Already given.

Logs

N/A

Environment

Additional context

N/A

pcaro90 commented 1 year ago

Well, it seems that the import works by setting the dataSource to MANUAL, e.g.:

{
  "activities": [
    {
      "date": "2015-10-30T00:00",
      "symbol": "BME.MC",
      "currency": "EUR",
      "unitPrice": 33.68,
      "quantity": 26,
      "type": "BUY",
      "fee": 10.76,
      "dataSource": "MANUAL",
      "accountId": "83ca9c73-97da-45ba-8adc-44a76198f1da"
    }
  ]
}

I'll just close the issue, it may help someone one day.

dtslvr commented 1 year ago

Hi @pcaro90

it seems that the import works by setting the dataSource to MANUAL

The reason of this is, if no dataSource is specified, the default dataSource (YAHOO) is used. Hence the validation error.