feat(portfolio): show stock tickers
This commit is contained in:
@@ -67,6 +67,7 @@ const portfolio: Portfolio = {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: null,
|
absoluteReturn: null,
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: "vtoraya.png",
|
logoName: "vtoraya.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -78,6 +79,7 @@ const portfolio: Portfolio = {
|
|||||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||||
absoluteReturn: { currency: "RUB", value: "-1" },
|
absoluteReturn: { currency: "RUB", value: "-1" },
|
||||||
isin: "RU000A0JX0J2",
|
isin: "RU000A0JX0J2",
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -193,6 +195,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "3" },
|
absoluteReturn: { currency: "RUB", value: "3" },
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -204,6 +207,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "0" },
|
absoluteReturn: { currency: "RUB", value: "0" },
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -232,6 +236,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||||
absoluteReturn: { currency: "RUB", value: "3" },
|
absoluteReturn: { currency: "RUB", value: "3" },
|
||||||
isin: "RU000QUIET1",
|
isin: "RU000QUIET1",
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -247,6 +252,62 @@ describe("AccountPage states", () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("uses the ticker only for stock cards and otherwise keeps the ISIN", () => {
|
||||||
|
renderPage(
|
||||||
|
<AccountPageLoaded
|
||||||
|
{...loadedProps({
|
||||||
|
...portfolio,
|
||||||
|
positions: [
|
||||||
|
{
|
||||||
|
figi: "FIGI-STOCK",
|
||||||
|
displayName: "Акция с тикером",
|
||||||
|
type: "STOCK",
|
||||||
|
quantity: "1",
|
||||||
|
currentValue: null,
|
||||||
|
averagePurchasePrice: null,
|
||||||
|
absoluteReturn: null,
|
||||||
|
isin: "STOCK-ISIN",
|
||||||
|
ticker: "SBER",
|
||||||
|
logoName: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
figi: "FIGI-FALLBACK",
|
||||||
|
displayName: "Акция без тикера",
|
||||||
|
type: "STOCK",
|
||||||
|
quantity: "2",
|
||||||
|
currentValue: null,
|
||||||
|
averagePurchasePrice: null,
|
||||||
|
absoluteReturn: null,
|
||||||
|
isin: "FALLBACK-ISIN",
|
||||||
|
ticker: null,
|
||||||
|
logoName: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
figi: "FIGI-BOND",
|
||||||
|
displayName: "Облигация",
|
||||||
|
type: "BOND",
|
||||||
|
quantity: "3",
|
||||||
|
currentValue: null,
|
||||||
|
averagePurchasePrice: null,
|
||||||
|
absoluteReturn: null,
|
||||||
|
isin: "BOND-ISIN",
|
||||||
|
ticker: "OFZ",
|
||||||
|
logoName: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText("Количество: 1 · SBER")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("STOCK-ISIN")).not.toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.getByText("Количество: 2 · FALLBACK-ISIN"),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Количество: 3 · BOND-ISIN")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("OFZ")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it("renders bond cards with logo, fallback, and signed unlabeled return like stocks", () => {
|
it("renders bond cards with logo, fallback, and signed unlabeled return like stocks", () => {
|
||||||
renderPage(
|
renderPage(
|
||||||
<AccountPageLoaded
|
<AccountPageLoaded
|
||||||
@@ -262,6 +323,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "2" },
|
absoluteReturn: { currency: "RUB", value: "2" },
|
||||||
isin: "RU000C0XY1Z3",
|
isin: "RU000C0XY1Z3",
|
||||||
|
ticker: null,
|
||||||
logoName: "dolg.png",
|
logoName: "dolg.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -273,6 +335,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "0" },
|
absoluteReturn: { currency: "RUB", value: "0" },
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -307,6 +370,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: { currency: "RUB", value: "950" },
|
averagePurchasePrice: { currency: "RUB", value: "950" },
|
||||||
absoluteReturn: { currency: "RUB", value: "50" },
|
absoluteReturn: { currency: "RUB", value: "50" },
|
||||||
isin: "RU000B0ND123",
|
isin: "RU000B0ND123",
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -355,6 +419,7 @@ describe("AccountPage states", () => {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "-5" },
|
absoluteReturn: { currency: "RUB", value: "-5" },
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: "fond.png",
|
logoName: "fond.png",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const portfolio: Portfolio = {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: { currency: "RUB", value: "10" },
|
absoluteReturn: { currency: "RUB", value: "10" },
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: "akciya.png",
|
logoName: "akciya.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -35,6 +36,7 @@ const portfolio: Portfolio = {
|
|||||||
averagePurchasePrice: { currency: "RUB", value: "45" },
|
averagePurchasePrice: { currency: "RUB", value: "45" },
|
||||||
absoluteReturn: { currency: "RUB", value: "-5" },
|
absoluteReturn: { currency: "RUB", value: "-5" },
|
||||||
isin: "RU000A0JX0J2",
|
isin: "RU000A0JX0J2",
|
||||||
|
ticker: null,
|
||||||
logoName: null,
|
logoName: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -46,6 +48,7 @@ const portfolio: Portfolio = {
|
|||||||
averagePurchasePrice: null,
|
averagePurchasePrice: null,
|
||||||
absoluteReturn: null,
|
absoluteReturn: null,
|
||||||
isin: null,
|
isin: null,
|
||||||
|
ticker: null,
|
||||||
logoName: "fond.png",
|
logoName: "fond.png",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -45,9 +45,11 @@ const PositionCard: FC<PositionCardProps> = (props) => {
|
|||||||
value: position.returnText,
|
value: position.returnText,
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
|
const identifier =
|
||||||
|
variant === "stock" ? (position.ticker ?? position.isin) : position.isin;
|
||||||
const identifierText = [
|
const identifierText = [
|
||||||
t("portfolio.quantity", { value: position.quantity }),
|
t("portfolio.quantity", { value: position.quantity }),
|
||||||
position.isin,
|
identifier,
|
||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(" · ");
|
.join(" · ");
|
||||||
|
|||||||
Vendored
+1
@@ -258,6 +258,7 @@ export interface components {
|
|||||||
averagePurchasePrice: components["schemas"]["MoneyDto"] | null;
|
averagePurchasePrice: components["schemas"]["MoneyDto"] | null;
|
||||||
absoluteReturn: components["schemas"]["MoneyDto"] | null;
|
absoluteReturn: components["schemas"]["MoneyDto"] | null;
|
||||||
isin: string | null;
|
isin: string | null;
|
||||||
|
ticker: string | null;
|
||||||
logoName: string | null;
|
logoName: string | null;
|
||||||
};
|
};
|
||||||
PortfolioDto: {
|
PortfolioDto: {
|
||||||
|
|||||||
@@ -1375,6 +1375,10 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
|
"ticker": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
"logoName": {
|
"logoName": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
@@ -1389,6 +1393,7 @@
|
|||||||
"averagePurchasePrice",
|
"averagePurchasePrice",
|
||||||
"absoluteReturn",
|
"absoluteReturn",
|
||||||
"isin",
|
"isin",
|
||||||
|
"ticker",
|
||||||
"logoName"
|
"logoName"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user