chore(release): 1.1.0 #67
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
branches: [develop, main]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
types: [opened, synchronize, reopened]
|
||||
schedule:
|
||||
- cron: '17 5 * * *'
|
||||
|
||||
|
||||
@@ -6,10 +6,6 @@ import {
|
||||
|
||||
type StockCandles = NonNullable<paths["/api/v1/stocks/{uid}/candles"]["get"]["responses"][200]["content"]["application/json"]["data"]>;
|
||||
|
||||
type StockPosition = NonNullable<paths["/api/v1/stocks/{uid}/position"]["get"]["responses"][200]["content"]["application/json"]["data"]>;
|
||||
|
||||
const MIN_STOCK_SEARCH_LENGTH = 2;
|
||||
|
||||
type StockDividends = NonNullable<paths["/api/v1/stocks/{uid}/dividends"]["get"]["responses"][200]["content"]["application/json"]["data"]>;
|
||||
|
||||
type StockPeriod = NonNullable<
|
||||
@@ -18,6 +14,8 @@ type StockPeriod = NonNullable<
|
||||
>["period"]
|
||||
>;
|
||||
|
||||
type StockPosition = NonNullable<paths["/api/v1/stocks/{uid}/position"]["get"]["responses"][200]["content"]["application/json"]["data"]>;
|
||||
|
||||
const STOCK_STALE_TIME_MS = 30_000;
|
||||
|
||||
function useStock(identifier: string) {
|
||||
@@ -96,18 +94,7 @@ function useStockQuote(uid: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function useStockSearch(query: string) {
|
||||
return useResourceQuery({
|
||||
...apiQueryClient.queryOptions("get", "/api/v1/stocks", {
|
||||
params: { query: { query } },
|
||||
}),
|
||||
enabled: query.length >= MIN_STOCK_SEARCH_LENGTH,
|
||||
staleTime: STOCK_STALE_TIME_MS,
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
MIN_STOCK_SEARCH_LENGTH,
|
||||
type StockCandles,
|
||||
type StockDividends,
|
||||
type StockPosition,
|
||||
@@ -117,5 +104,4 @@ export {
|
||||
useStockDividends,
|
||||
useStockPosition,
|
||||
useStockQuote,
|
||||
useStockSearch,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export {
|
||||
MIN_STOCK_SEARCH_LENGTH,
|
||||
type StockCandles,
|
||||
type StockDividends,
|
||||
type StockPosition,
|
||||
@@ -9,5 +8,4 @@ export {
|
||||
useStockDividends,
|
||||
useStockPosition,
|
||||
useStockQuote,
|
||||
useStockSearch,
|
||||
} from "./api/queries";
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
import { MantineProvider } from "@mantine/core";
|
||||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { configureAuthClient } from "@/shared/api";
|
||||
import { createTestQueryClient } from "@/test/query";
|
||||
import { resource } from "@/test/resource";
|
||||
import { server } from "@/test/server";
|
||||
|
||||
import { StocksPage } from "./StocksPage";
|
||||
import { useStocksPageVm } from "./StocksPage.vm";
|
||||
|
||||
const StocksPageVmProbe = () => {
|
||||
const vm = useStocksPageVm();
|
||||
|
||||
return (
|
||||
<>
|
||||
<button onClick={vm.onSearch}>search</button>
|
||||
<button onClick={() => vm.onPage(2)}>page</button>
|
||||
<output>{vm.items.map(item => item.name).join(", ")}</output>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
afterEach(() => vi.useRealTimers());
|
||||
|
||||
@@ -18,27 +30,28 @@ describe("stock search", () => {
|
||||
it("waits for a meaningful query and uses the server-verified ticker link", async () => {
|
||||
const query = vi.fn();
|
||||
server.use(
|
||||
http.get("*/api/v1/stocks", ({ request }) => {
|
||||
query(new URL(request.url).searchParams.get("query"));
|
||||
http.post("*/api/v1/stocks/screener/search", async ({ request }) => {
|
||||
query(await request.json());
|
||||
|
||||
return HttpResponse.json(
|
||||
resource([
|
||||
{
|
||||
apiTradeAvailable: true,
|
||||
classCode: "TQBR",
|
||||
instrumentUid: "unique-stock",
|
||||
isin: "RU0009029540",
|
||||
logoName: "sber.png",
|
||||
name: "Сбербанк",
|
||||
price: { currency: "RUB", value: "306.12" },
|
||||
priceAt: "2026-09-10T10:00:00Z",
|
||||
realExchange: "REAL_EXCHANGE_MOEX",
|
||||
shareType: "SHARE_TYPE_COMMON",
|
||||
slug: "SBER",
|
||||
ticker: "SBER",
|
||||
},
|
||||
]),
|
||||
);
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: false,
|
||||
items: [{
|
||||
countryOfRisk: "RU",
|
||||
currency: "RUB",
|
||||
instrumentUid: "e6123145-9665-43e0-8413-cd61b8aa9b13",
|
||||
isin: "RU0009029540",
|
||||
logoName: "sber.png",
|
||||
lot: 10,
|
||||
name: "Сбербанк",
|
||||
realExchange: "REAL_EXCHANGE_MOEX",
|
||||
sector: "financial",
|
||||
shareType: "SHARE_TYPE_COMMON",
|
||||
ticker: "SBER",
|
||||
}],
|
||||
page: 1,
|
||||
searchId: "search-id",
|
||||
});
|
||||
}),
|
||||
);
|
||||
configureAuthClient({
|
||||
@@ -46,7 +59,6 @@ describe("stock search", () => {
|
||||
clear: vi.fn(),
|
||||
refresh: () => Promise.resolve(false),
|
||||
});
|
||||
vi.useFakeTimers();
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<MantineProvider>
|
||||
@@ -56,23 +68,212 @@ describe("stock search", () => {
|
||||
</MantineProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
const input = screen.getByLabelText("Поиск акций");
|
||||
fireEvent.change(input, { target: { value: "S" } });
|
||||
await act(() => vi.advanceTimersByTimeAsync(300));
|
||||
expect(query).not.toHaveBeenCalled();
|
||||
fireEvent.change(input, { target: { value: "SB" } });
|
||||
await act(() => vi.advanceTimersByTimeAsync(299));
|
||||
expect(query).not.toHaveBeenCalled();
|
||||
// The final input uses real timers for network and query notifications.
|
||||
vi.useRealTimers();
|
||||
const input = screen.getByLabelText("Название или тикер");
|
||||
fireEvent.change(input, { target: { value: "SBER" } });
|
||||
expect(query).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Найти" }));
|
||||
expect(
|
||||
await screen.findByRole("link", { name: /Сбербанк/ }),
|
||||
).toHaveAttribute("href", "/stocks/SBER");
|
||||
expect(screen.getByText("306,12 ₽")).toBeVisible();
|
||||
expect(screen.getByText("Режим: TQBR")).toBeVisible();
|
||||
).toHaveAttribute("href", "/stocks/e6123145-9665-43e0-8413-cd61b8aa9b13");
|
||||
expect(screen.getByText("Список получен 10.10.2026, 10:00")).toBeVisible();
|
||||
expect(screen.getByText("Лот: 10 шт.")).toBeVisible();
|
||||
expect(screen.getByText("ISIN: RU0009029540")).toBeVisible();
|
||||
expect(screen.getByText("Мосбиржа")).toBeVisible();
|
||||
await waitFor(() => expect(query).toHaveBeenCalledExactlyOnceWith("SBER"));
|
||||
expect(screen.getAllByText("Мосбиржа")[0]).toBeVisible();
|
||||
expect(screen.getByAltText("")).toHaveAttribute(
|
||||
"src",
|
||||
"https://invest-brands.cdn-tinkoff.ru/sberx160.png",
|
||||
);
|
||||
await waitFor(() => expect(query).toHaveBeenCalledExactlyOnceWith({ query: "SBER" }));
|
||||
});
|
||||
|
||||
it("searches by the selected sector without a text query", async () => {
|
||||
const query = vi.fn();
|
||||
server.use(
|
||||
http.post("*/api/v1/stocks/screener/search", async ({ request }) => {
|
||||
query(await request.json());
|
||||
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: false,
|
||||
items: [],
|
||||
page: 1,
|
||||
searchId: "sector-search",
|
||||
});
|
||||
}),
|
||||
);
|
||||
configureAuthClient({
|
||||
accessToken: () => "synthetic",
|
||||
clear: vi.fn(),
|
||||
refresh: () => Promise.resolve(false),
|
||||
});
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<MantineProvider>
|
||||
<MemoryRouter>
|
||||
<StocksPage />
|
||||
</MemoryRouter>
|
||||
</MantineProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
fireEvent.click(screen.getByRole("combobox", { name: "Сектор" }));
|
||||
fireEvent.click(await screen.findByRole("option", { name: "Энергетика" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Найти" }));
|
||||
|
||||
await waitFor(() => expect(query).toHaveBeenCalledExactlyOnceWith({
|
||||
sector: "energy",
|
||||
}));
|
||||
});
|
||||
|
||||
it("shows known result pages and reads the selected page", async () => {
|
||||
const requestedPages = vi.fn();
|
||||
server.use(
|
||||
http.post("*/api/v1/stocks/screener/search", () => HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: true,
|
||||
items: [],
|
||||
page: 1,
|
||||
searchId: "paged-search",
|
||||
})),
|
||||
http.get("*/api/v1/stocks/screener/search/paged-search", ({ request }) => {
|
||||
const page = Number(new URL(request.url).searchParams.get("page"));
|
||||
requestedPages(page);
|
||||
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: false,
|
||||
items: [],
|
||||
page,
|
||||
searchId: "paged-search",
|
||||
});
|
||||
}),
|
||||
);
|
||||
configureAuthClient({
|
||||
accessToken: () => "synthetic",
|
||||
clear: vi.fn(),
|
||||
refresh: () => Promise.resolve(false),
|
||||
});
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<MantineProvider>
|
||||
<MemoryRouter>
|
||||
<StocksPage />
|
||||
</MemoryRouter>
|
||||
</MantineProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Найти" }));
|
||||
fireEvent.click(await screen.findByRole(
|
||||
"button",
|
||||
{ name: "Страница 2" },
|
||||
));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(requestedPages).toHaveBeenCalledExactlyOnceWith(2),
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps a newer search when an earlier page request finishes late", async () => {
|
||||
const oldPage = Promise.withResolvers<void>();
|
||||
let searches = 0;
|
||||
|
||||
server.use(
|
||||
http.post("*/api/v1/stocks/screener/search", () => {
|
||||
searches += 1;
|
||||
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: searches === 1,
|
||||
items: [{
|
||||
countryOfRisk: "RU",
|
||||
currency: "RUB",
|
||||
instrumentUid: searches === 1 ? "old" : "new",
|
||||
isin: null,
|
||||
logoName: null,
|
||||
lot: 1,
|
||||
name: searches === 1 ? "Старый" : "Новый",
|
||||
realExchange: "REAL_EXCHANGE_MOEX",
|
||||
sector: "financial",
|
||||
shareType: "SHARE_TYPE_COMMON",
|
||||
ticker: searches === 1 ? "OLD" : "NEW",
|
||||
}],
|
||||
page: 1,
|
||||
searchId: searches === 1 ? "old-search" : "new-search",
|
||||
});
|
||||
}),
|
||||
http.get("*/api/v1/stocks/screener/search/old-search", async () => {
|
||||
await oldPage.promise;
|
||||
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: false,
|
||||
items: [{
|
||||
countryOfRisk: "RU",
|
||||
currency: "RUB",
|
||||
instrumentUid: "old-page",
|
||||
isin: null,
|
||||
logoName: null,
|
||||
lot: 1,
|
||||
name: "Старый результат",
|
||||
realExchange: "REAL_EXCHANGE_MOEX",
|
||||
sector: "financial",
|
||||
shareType: "SHARE_TYPE_COMMON",
|
||||
ticker: "OLD",
|
||||
}],
|
||||
page: 2,
|
||||
searchId: "old-search",
|
||||
});
|
||||
}),
|
||||
);
|
||||
render(<StocksPageVmProbe />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "search" }));
|
||||
await screen.findByText("Старый");
|
||||
fireEvent.click(screen.getByRole("button", { name: "page" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "search" }));
|
||||
await screen.findByText("Новый");
|
||||
oldPage.resolve();
|
||||
|
||||
await waitFor(() => expect(screen.getByText("Новый")).toBeVisible());
|
||||
expect(screen.queryByText("Старый результат")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("disables filters and shows loading while searching", async () => {
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
server.use(
|
||||
http.post("*/api/v1/stocks/screener/search", async () => {
|
||||
await promise;
|
||||
|
||||
return HttpResponse.json({
|
||||
asOf: "2026-10-10T10:00:00Z",
|
||||
hasNext: false,
|
||||
items: [],
|
||||
page: 1,
|
||||
searchId: "pending-search",
|
||||
});
|
||||
}),
|
||||
);
|
||||
configureAuthClient({
|
||||
accessToken: () => "synthetic",
|
||||
clear: vi.fn(),
|
||||
refresh: () => Promise.resolve(false),
|
||||
});
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<MantineProvider>
|
||||
<MemoryRouter>
|
||||
<StocksPage />
|
||||
</MemoryRouter>
|
||||
</MantineProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Найти" }));
|
||||
|
||||
await waitFor(() => expect(
|
||||
screen.getByRole("combobox", { name: "Сектор" }),
|
||||
).toBeDisabled());
|
||||
expect(screen.getByRole("button", { name: "Найти" })).toHaveAttribute(
|
||||
"data-loading",
|
||||
"true",
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,89 +1,274 @@
|
||||
import type { FC } from "react";
|
||||
|
||||
import { Badge, Group, Text } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { ChangeEvent, FC } from "react";
|
||||
|
||||
import {
|
||||
InstrumentSearch,
|
||||
InstrumentSearchCard,
|
||||
} from "@/features/instrument-search";
|
||||
import { formatMoney, formatSnapshotTime } from "@/shared/lib";
|
||||
Alert,
|
||||
Anchor,
|
||||
Avatar,
|
||||
Badge,
|
||||
Button,
|
||||
Card,
|
||||
Fieldset,
|
||||
Group,
|
||||
NumberInput,
|
||||
Pagination,
|
||||
Select,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import type { StocksPageVm } from "./StocksPage.vm";
|
||||
import { formatSnapshotTime, instrumentLogoUrl } from "@/shared/lib";
|
||||
|
||||
import type { Criteria, StocksPageVm } from "./StocksPage.vm";
|
||||
|
||||
import { useStocksPagePresentationVm } from "./StocksPagePresentation.vm";
|
||||
|
||||
type CriteriaField = {
|
||||
label: keyof Criteria;
|
||||
options?: readonly string[];
|
||||
type?: "number";
|
||||
};
|
||||
|
||||
type StockCardProps = { item: StocksPageVm["items"][number] };
|
||||
|
||||
type StockCriteriaFieldProps = {
|
||||
criteria: Criteria;
|
||||
field: CriteriaField;
|
||||
onChange: (name: keyof Criteria, value: string) => void;
|
||||
};
|
||||
|
||||
type StocksPageViewProps = { vm: StocksPageVm };
|
||||
|
||||
const criteriaFields: CriteriaField[] = [
|
||||
{ label: "query" },
|
||||
{
|
||||
label: "sector",
|
||||
options: [
|
||||
"consumer",
|
||||
"energy",
|
||||
"financial",
|
||||
"health_care",
|
||||
"industrials",
|
||||
"it",
|
||||
"materials",
|
||||
"real_estate",
|
||||
"telecom",
|
||||
"utilities",
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "shareType",
|
||||
options: [
|
||||
"SHARE_TYPE_ADR",
|
||||
"SHARE_TYPE_COMMON",
|
||||
"SHARE_TYPE_GDR",
|
||||
"SHARE_TYPE_PREFERRED",
|
||||
],
|
||||
},
|
||||
{ label: "currency", options: ["RUB", "USD", "EUR", "CNY", "HKD", "TRY"] },
|
||||
{
|
||||
label: "realExchange",
|
||||
options: [
|
||||
"REAL_EXCHANGE_MOEX",
|
||||
"REAL_EXCHANGE_RTS",
|
||||
"REAL_EXCHANGE_OTC",
|
||||
"REAL_EXCHANGE_DEALER",
|
||||
],
|
||||
},
|
||||
{ label: "countryOfRisk", options: ["RU", "US", "CN", "KZ", "HK", "TR"] },
|
||||
{ label: "maxLot", type: "number" },
|
||||
];
|
||||
|
||||
function numberChange(
|
||||
field: keyof Criteria,
|
||||
onChange: StockCriteriaFieldProps["onChange"],
|
||||
) {
|
||||
return (value: number | string) => onChange(field, String(value));
|
||||
}
|
||||
|
||||
function selectChange(
|
||||
field: keyof Criteria,
|
||||
onChange: StockCriteriaFieldProps["onChange"],
|
||||
) {
|
||||
return (value: null | string) => onChange(field, value ?? "");
|
||||
}
|
||||
|
||||
function selectOptions(field: CriteriaField, translate: ReturnType<typeof useTranslation>["t"]) {
|
||||
return field.options?.map(value => ({
|
||||
label: translate(`stock.screener.options.${field.label}.${value}`, {
|
||||
defaultValue: value,
|
||||
}),
|
||||
value,
|
||||
}));
|
||||
}
|
||||
|
||||
function textChange(
|
||||
field: keyof Criteria,
|
||||
onChange: StockCriteriaFieldProps["onChange"],
|
||||
) {
|
||||
return (event: ChangeEvent<HTMLInputElement>) =>
|
||||
onChange(field, event.currentTarget.value);
|
||||
}
|
||||
|
||||
const StockCriteriaField: FC<StockCriteriaFieldProps> = (props) => {
|
||||
const { criteria, field, onChange } = props;
|
||||
const { t } = useTranslation();
|
||||
const options = selectOptions(field, t);
|
||||
if (field.type === "number") return (
|
||||
<NumberInput
|
||||
label={t(`stock.screener.${field.label}`)}
|
||||
min={1}
|
||||
onChange={numberChange(field.label, onChange)}
|
||||
value={criteria[field.label]}
|
||||
/>
|
||||
);
|
||||
|
||||
if (options) return (
|
||||
<Select
|
||||
clearable
|
||||
data={options}
|
||||
label={t(`stock.screener.${field.label}`)}
|
||||
onChange={selectChange(field.label, onChange)}
|
||||
value={criteria[field.label] || null}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<TextInput
|
||||
label={t(`stock.screener.${field.label}`)}
|
||||
onChange={textChange(field.label, onChange)}
|
||||
value={criteria[field.label]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const StockCard: FC<StockCardProps> = (props) => {
|
||||
const { item } = props;
|
||||
const { t } = useTranslation();
|
||||
|
||||
const exchange = item.realExchange
|
||||
? t(`stock.exchanges.${item.realExchange}`, {
|
||||
defaultValue: item.realExchange,
|
||||
})
|
||||
: undefined;
|
||||
|
||||
const lot = item.lot === null
|
||||
? undefined
|
||||
: t("stock.lot", { value: item.lot });
|
||||
|
||||
return (
|
||||
<Card p="md" withBorder>
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
<Avatar alt="" radius="md" size={40} src={instrumentLogoUrl(item.logoName)}>
|
||||
{item.name[0]}
|
||||
</Avatar>
|
||||
|
||||
<Stack gap={2} miw={0}>
|
||||
<Anchor
|
||||
c="inherit"
|
||||
component={Link}
|
||||
fw={600}
|
||||
to={`/stocks/${item.instrumentUid}`}
|
||||
>
|
||||
{item.name}
|
||||
</Anchor>
|
||||
|
||||
<Text c="dimmed" size="xs">
|
||||
{item.ticker ?? "-"} · {item.shareType ?? "-"}
|
||||
</Text>
|
||||
|
||||
<Group gap="xs">
|
||||
{exchange && <Badge color="gray" variant="light">{exchange}</Badge>}
|
||||
|
||||
{item.currency && (
|
||||
<Badge color="gray" variant="light">{item.currency}</Badge>
|
||||
)}
|
||||
|
||||
{lot && <Text c="dimmed" size="xs">{lot}</Text>}
|
||||
</Group>
|
||||
|
||||
{item.isin && (
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("stock.isin", { value: item.isin })}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
</Group>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
const StocksPageView: FC<StocksPageViewProps> = (props) => {
|
||||
const { vm } = props;
|
||||
const { t } = useTranslation();
|
||||
const { getControlProps, getItemProps } = useStocksPagePresentationVm();
|
||||
|
||||
return (
|
||||
<InstrumentSearch kind="stock" vm={vm}>
|
||||
{vm.items.map((stock) => {
|
||||
const quote = (
|
||||
<>
|
||||
<Text fw={650} size="xl">
|
||||
{stock.price ? formatMoney(stock.price) : "—"}
|
||||
</Text>
|
||||
<Stack gap="lg">
|
||||
<div>
|
||||
<Title order={1}>{t("stock.screenerTitle")}</Title>
|
||||
|
||||
<Text c="dimmed" size="xs">
|
||||
{stock.price && stock.priceAt
|
||||
? t("stock.priceAt", {
|
||||
date: formatSnapshotTime(stock.priceAt),
|
||||
})
|
||||
: t("stock.priceUnavailable")}
|
||||
</Text>
|
||||
<Text c="dimmed" mt="xs">{t("stock.screenerSubtitle")}</Text>
|
||||
</div>
|
||||
|
||||
{stock.apiTradeAvailable === true && (
|
||||
<Text c="green.8" mt="sm" size="xs">
|
||||
{t("stock.apiAvailable")}
|
||||
</Text>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
<Fieldset disabled={vm.loading} variant="unstyled">
|
||||
<SimpleGrid cols={{ base: 1, sm: 2 }}>
|
||||
{criteriaFields.map(field => (
|
||||
<StockCriteriaField
|
||||
criteria={vm.criteria}
|
||||
field={field}
|
||||
key={field.label}
|
||||
onChange={vm.onCriteriaChange}
|
||||
/>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
|
||||
return (
|
||||
<InstrumentSearchCard
|
||||
instrument={stock}
|
||||
key={stock.instrumentUid}
|
||||
quote={quote}
|
||||
>
|
||||
<Text c="dimmed" size="sm">
|
||||
{stock.ticker} ·{" "}
|
||||
{t(`stock.shareTypes.${stock.shareType}`, {
|
||||
defaultValue: t("stock.share"),
|
||||
})}
|
||||
</Text>
|
||||
<Group mt="lg">
|
||||
<Button loading={vm.loading} onClick={vm.onSearch}>
|
||||
{t("stock.screener.search")}
|
||||
</Button>
|
||||
</Group>
|
||||
</Fieldset>
|
||||
|
||||
<Group gap="xs" mt="sm">
|
||||
<Badge color="gray" variant="light">
|
||||
{t(`stock.exchanges.${stock.realExchange}`, {
|
||||
defaultValue: t("stock.exchangeUnknown"),
|
||||
})}
|
||||
</Badge>
|
||||
{!!vm.error && (
|
||||
<Alert color="orange" role="status">{t("stock.screener.error")}</Alert>
|
||||
)}
|
||||
|
||||
{!!stock.classCode && (
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("stock.classCode", { code: stock.classCode })}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
{vm.resultTime && (
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("stock.screener.asOf", {
|
||||
date: formatSnapshotTime(vm.resultTime),
|
||||
})}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{!!stock.isin && (
|
||||
<Text c="dimmed" mt={4} size="xs">
|
||||
{t("stock.isin", { value: stock.isin })}
|
||||
</Text>
|
||||
)}
|
||||
{vm.searched && !vm.loading && !vm.error && vm.items.length === 0 && (
|
||||
<Text c="dimmed">{t("stock.screener.empty")}</Text>
|
||||
)}
|
||||
|
||||
{stock.apiTradeAvailable === false && (
|
||||
<Text c="dimmed" mt={4} size="xs">
|
||||
{t("stock.apiUnavailable")}
|
||||
</Text>
|
||||
)}
|
||||
</InstrumentSearchCard>
|
||||
);
|
||||
})}
|
||||
</InstrumentSearch>
|
||||
<Stack gap="sm">
|
||||
{vm.items.map(item => (
|
||||
<StockCard item={item} key={item.instrumentUid} />
|
||||
))}
|
||||
</Stack>
|
||||
|
||||
{vm.totalPages > 1 && (
|
||||
<Group aria-label={t("stock.screener.pagination")} component="nav" justify="center">
|
||||
<Pagination
|
||||
disabled={vm.loading}
|
||||
getControlProps={getControlProps}
|
||||
getItemProps={getItemProps}
|
||||
onChange={vm.onPage}
|
||||
total={vm.totalPages}
|
||||
value={vm.page ?? 1}
|
||||
/>
|
||||
</Group>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,43 +1,119 @@
|
||||
import { MIN_STOCK_SEARCH_LENGTH, useStockSearch } from "@/entities/stock";
|
||||
import { useInstrumentSearch } from "@/features/instrument-search";
|
||||
import { useScreenSync } from "@/features/tbank-connection";
|
||||
import { apiErrorCode } from "@/shared/api";
|
||||
import { instrumentLogoUrl } from "@/shared/lib";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
import { apiClient } from "@/shared/api";
|
||||
|
||||
type Criteria = {
|
||||
countryOfRisk: string;
|
||||
currency: string;
|
||||
maxLot: string;
|
||||
query: string;
|
||||
realExchange: string;
|
||||
sector: string;
|
||||
shareType: string;
|
||||
};
|
||||
|
||||
type ScreenerPage = Awaited<ReturnType<typeof readPage>>;
|
||||
|
||||
type StocksPageVm = ReturnType<typeof useStocksPageVm>;
|
||||
|
||||
const emptyCriteria: Criteria = {
|
||||
countryOfRisk: "",
|
||||
currency: "",
|
||||
maxLot: "",
|
||||
query: "",
|
||||
realExchange: "",
|
||||
sector: "",
|
||||
shareType: "",
|
||||
};
|
||||
|
||||
async function createSearch(criteria: Criteria) {
|
||||
const { data } = await apiClient.POST("/api/v1/stocks/screener/search", {
|
||||
body: {
|
||||
...(criteria.countryOfRisk && { countryOfRisk: criteria.countryOfRisk }),
|
||||
...(criteria.currency && { currency: criteria.currency }),
|
||||
...(criteria.maxLot && { maxLot: Number(criteria.maxLot) }),
|
||||
...(criteria.query && { query: criteria.query }),
|
||||
...(criteria.realExchange && { realExchange: criteria.realExchange }),
|
||||
...(criteria.sector && { sector: criteria.sector }),
|
||||
...(criteria.shareType && { shareType: criteria.shareType }),
|
||||
},
|
||||
});
|
||||
|
||||
if (!data) throw new Error("Stock screener search failed");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async function readPage(searchId: string, page: number) {
|
||||
const { data } = await apiClient.GET(
|
||||
"/api/v1/stocks/screener/search/{searchId}",
|
||||
{ params: { path: { searchId }, query: { page } } },
|
||||
);
|
||||
|
||||
if (!data) throw new Error("Stock screener page failed");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function useStocksPageVm() {
|
||||
const search = useInstrumentSearch(MIN_STOCK_SEARCH_LENGTH);
|
||||
const { canSearch, debounced, isWaiting, query } = search;
|
||||
const result = useStockSearch(debounced);
|
||||
useScreenSync({ query: debounced, screen: "stocks" }, [result]);
|
||||
const [criteria, setCriteria] = useState(emptyCriteria);
|
||||
const [page, setPage] = useState<null | ScreenerPage>(null);
|
||||
const [pending, setPending] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const requestIdRef = useRef(0);
|
||||
|
||||
const search = async () => {
|
||||
const currentRequestId = requestIdRef.current + 1;
|
||||
requestIdRef.current = currentRequestId;
|
||||
setPending(true);
|
||||
setError(false);
|
||||
|
||||
try {
|
||||
const result = await createSearch(criteria);
|
||||
if (requestIdRef.current === currentRequestId) setPage(result);
|
||||
}
|
||||
catch {
|
||||
if (requestIdRef.current === currentRequestId) setError(true);
|
||||
}
|
||||
finally {
|
||||
if (requestIdRef.current === currentRequestId) setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
const changePage = async (nextPage: number) => {
|
||||
if (!page) return;
|
||||
|
||||
const currentRequestId = requestIdRef.current + 1;
|
||||
requestIdRef.current = currentRequestId;
|
||||
setPending(true);
|
||||
setError(false);
|
||||
|
||||
try {
|
||||
const result = await readPage(page.searchId, nextPage);
|
||||
if (requestIdRef.current === currentRequestId) setPage(result);
|
||||
}
|
||||
catch {
|
||||
if (requestIdRef.current === currentRequestId) setError(true);
|
||||
}
|
||||
finally {
|
||||
if (requestIdRef.current === currentRequestId) setPending(false);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
canSearch,
|
||||
code: apiErrorCode(result.error),
|
||||
error:
|
||||
!result.data
|
||||
&& (result.isError || result.meta?.lastAttempt.state === "failed"),
|
||||
items:
|
||||
result.data?.map(stock => ({
|
||||
...stock,
|
||||
logoSrc: instrumentLogoUrl(stock.logoName),
|
||||
to: `/stocks/${encodeURIComponent(stock.slug)}`,
|
||||
})) ?? [],
|
||||
loading:
|
||||
canSearch
|
||||
&& (isWaiting
|
||||
|| (!result.data
|
||||
&& !result.isError
|
||||
&& result.meta?.lastAttempt.state !== "failed")),
|
||||
onQueryChange: search.onQueryChange,
|
||||
partial: result.meta?.completeness === "incomplete",
|
||||
query,
|
||||
ready:
|
||||
debounced.length >= MIN_STOCK_SEARCH_LENGTH
|
||||
&& !isWaiting
|
||||
&& Boolean(result.data),
|
||||
criteria,
|
||||
error,
|
||||
items: page?.items ?? [],
|
||||
loading: pending,
|
||||
onCriteriaChange: (name: keyof Criteria, value: string) =>
|
||||
setCriteria(current => ({ ...current, [name]: value })),
|
||||
onPage: (nextPage: number) => void changePage(nextPage),
|
||||
onSearch: () => void search(),
|
||||
page: page?.page,
|
||||
resultTime: page?.asOf,
|
||||
searched: page !== null,
|
||||
totalPages: page ? page.page + Number(page.hasNext) : 0,
|
||||
};
|
||||
}
|
||||
|
||||
export { type StocksPageVm, useStocksPageVm };
|
||||
export { type Criteria, type StocksPageVm, useStocksPageVm };
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { Pagination } from "@mantine/core";
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
function useStocksPagePresentationVm() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const getControlProps: ComponentProps<typeof Pagination>["getControlProps"] = control => ({
|
||||
"aria-label": t(control === "previous" ? "stock.previous" : "stock.next"),
|
||||
});
|
||||
|
||||
const getItemProps: ComponentProps<typeof Pagination>["getItemProps"] = page => ({
|
||||
"aria-label": t("stock.screener.page", { page }),
|
||||
});
|
||||
|
||||
return { getControlProps, getItemProps };
|
||||
}
|
||||
|
||||
export { useStocksPagePresentationVm };
|
||||
Vendored
+199
@@ -436,6 +436,38 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/stocks/screener/search": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
post: operations["createStockScreenerSearch"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/stocks/screener/search/{searchId}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get: operations["readStockScreenerPage"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/stocks/{uid}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -1250,6 +1282,37 @@ export interface components {
|
||||
data: components["schemas"]["StockDto"] | null;
|
||||
meta: components["schemas"]["InvestmentResourceMetaDto"];
|
||||
};
|
||||
StockScreenerCriteriaDto: {
|
||||
query?: string;
|
||||
sector?: string;
|
||||
shareType?: string;
|
||||
currency?: string;
|
||||
realExchange?: string;
|
||||
countryOfRisk?: string;
|
||||
maxLot?: number;
|
||||
};
|
||||
StockScreenerItemDto: {
|
||||
/** Format: uuid */
|
||||
instrumentUid: string;
|
||||
name: string;
|
||||
ticker: string | null;
|
||||
isin: string | null;
|
||||
logoName: string | null;
|
||||
shareType: string | null;
|
||||
sector: string | null;
|
||||
currency: string | null;
|
||||
realExchange: string | null;
|
||||
countryOfRisk: string | null;
|
||||
lot: number | null;
|
||||
};
|
||||
StockScreenerPageDto: {
|
||||
searchId: string;
|
||||
/** Format: date-time */
|
||||
asOf: string;
|
||||
page: number;
|
||||
hasNext: boolean;
|
||||
items: components["schemas"]["StockScreenerItemDto"][];
|
||||
};
|
||||
StockQuoteDto: {
|
||||
price: components["schemas"]["MoneyDto"] | null;
|
||||
/** Format: date-time */
|
||||
@@ -4077,6 +4140,142 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
createStockScreenerSearch: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["StockScreenerCriteriaDto"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["StockScreenerPageDto"];
|
||||
};
|
||||
};
|
||||
/** @description Invalid request */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Authentication required */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Resource not found */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Internal server error */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Upstream service unavailable */
|
||||
503: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
readStockScreenerPage: {
|
||||
parameters: {
|
||||
query: {
|
||||
page: number;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
searchId: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["StockScreenerPageDto"];
|
||||
};
|
||||
};
|
||||
/** @description Invalid request */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Authentication required */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Resource not found */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Internal server error */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
/** @description Upstream service unavailable */
|
||||
503: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
StockController_get: {
|
||||
parameters: {
|
||||
query?: {
|
||||
|
||||
@@ -3333,6 +3333,188 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/stocks/screener/search": {
|
||||
"post": {
|
||||
"operationId": "createStockScreenerSearch",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/StockScreenerCriteriaDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/StockScreenerPageDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Resource not found",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"503": {
|
||||
"description": "Upstream service unavailable",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
}
|
||||
],
|
||||
"summary": "",
|
||||
"tags": [
|
||||
"stocks"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/stocks/screener/search/{searchId}": {
|
||||
"get": {
|
||||
"operationId": "readStockScreenerPage",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "searchId",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/StockScreenerPageDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Resource not found",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"503": {
|
||||
"description": "Upstream service unavailable",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetailsDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
}
|
||||
],
|
||||
"summary": "",
|
||||
"tags": [
|
||||
"stocks"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/stocks/{uid}": {
|
||||
"get": {
|
||||
"operationId": "StockController_get",
|
||||
@@ -7310,6 +7492,133 @@
|
||||
"meta"
|
||||
]
|
||||
},
|
||||
"StockScreenerCriteriaDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string",
|
||||
"maxLength": 80
|
||||
},
|
||||
"sector": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"shareType": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"realExchange": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"countryOfRisk": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"maxLot": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"StockScreenerItemDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"instrumentUid": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"ticker": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"isin": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"logoName": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"shareType": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"sector": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"realExchange": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"countryOfRisk": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"lot": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"instrumentUid",
|
||||
"name",
|
||||
"ticker",
|
||||
"isin",
|
||||
"logoName",
|
||||
"shareType",
|
||||
"sector",
|
||||
"currency",
|
||||
"realExchange",
|
||||
"countryOfRisk",
|
||||
"lot"
|
||||
]
|
||||
},
|
||||
"StockScreenerPageDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"searchId": {
|
||||
"type": "string"
|
||||
},
|
||||
"asOf": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"page": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"hasNext": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"items": {
|
||||
"maxItems": 30,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/StockScreenerItemDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"searchId",
|
||||
"asOf",
|
||||
"page",
|
||||
"hasNext",
|
||||
"items"
|
||||
]
|
||||
},
|
||||
"StockQuoteDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -636,6 +636,57 @@ const ru = {
|
||||
quantity: "Количество акций",
|
||||
record: "Дата реестра",
|
||||
refreshPrice: "Обновить цену",
|
||||
screener: {
|
||||
asOf: "Список получен {{date}}",
|
||||
countryOfRisk: "Страна риска",
|
||||
currency: "Валюта расчётов",
|
||||
empty: "Подходящие акции не найдены.",
|
||||
error: "Не удалось получить результат скринера. Попробуйте найти снова.",
|
||||
maxLot: "Максимальный размер лота",
|
||||
options: {
|
||||
countryOfRisk: {
|
||||
CN: "Китай",
|
||||
HK: "Гонконг",
|
||||
KZ: "Казахстан",
|
||||
RU: "Россия",
|
||||
TR: "Турция",
|
||||
US: "США",
|
||||
},
|
||||
realExchange: {
|
||||
REAL_EXCHANGE_DEALER: "Площадка брокера",
|
||||
REAL_EXCHANGE_MOEX: "Мосбиржа",
|
||||
REAL_EXCHANGE_OTC: "Внебиржевой рынок",
|
||||
REAL_EXCHANGE_RTS: "СПБ Биржа",
|
||||
},
|
||||
sector: {
|
||||
consumer: "Потребительский сектор",
|
||||
energy: "Энергетика",
|
||||
financial: "Финансы",
|
||||
health_care: "Здравоохранение",
|
||||
industrials: "Промышленность",
|
||||
it: "Информационные технологии",
|
||||
materials: "Материалы",
|
||||
real_estate: "Недвижимость",
|
||||
telecom: "Телекоммуникации",
|
||||
utilities: "Коммунальные услуги",
|
||||
},
|
||||
shareType: {
|
||||
SHARE_TYPE_ADR: "Депозитарная расписка",
|
||||
SHARE_TYPE_COMMON: "Обыкновенная акция",
|
||||
SHARE_TYPE_GDR: "Глобальная депозитарная расписка",
|
||||
SHARE_TYPE_PREFERRED: "Привилегированная акция",
|
||||
},
|
||||
},
|
||||
page: "Страница {{page}}",
|
||||
pagination: "Страницы результатов",
|
||||
query: "Название или тикер",
|
||||
realExchange: "Площадка",
|
||||
search: "Найти",
|
||||
sector: "Сектор",
|
||||
shareType: "Тип акции",
|
||||
},
|
||||
screenerSubtitle: "Подберите акции по данным каталога T-Bank. Доступность не гарантирует исполнение сделки.",
|
||||
screenerTitle: "Скринер акций",
|
||||
searchHint: "Введите хотя бы два символа.",
|
||||
searching: "Ищем акции",
|
||||
searchLabel: "Поиск акций",
|
||||
|
||||
Reference in New Issue
Block a user