Backend: - AuthModule with register, login, logout, refresh, profile endpoints - JwtAuthGuard (global, opt-out via @Public) + RolesGuard (@Roles) - PrismaModule with SQLite via @prisma/adapter-libsql (Prisma 7) - Auth configuration in configuration.ts Frontend: - Auth context with session restoration via refresh cookie - Login, Register, Profile pages with ProtectedRoute - Auto-refresh on 401 with token rotation - API client refactored for auth headers Russian text: auth flows translated to Russian All text translated: auth pages, profile, layout, loading states
7.2 KiB
API Reference
Все эндпоинты находятся под префиксом /api/v1. Swagger UI: /api/docs.
Защищённые эндпоинты требуют заголовок Authorization: Bearer <accessToken>.
Auth
POST /auth/register
Регистрация нового пользователя.
Request:
{
"email": "user@example.com",
"password": "securePass123",
"name": "John"
}
Response: { data: { user, accessToken }, meta } + Set-Cookie: refresh_token.
POST /auth/login
Вход по email и паролю.
Request:
{
"email": "user@example.com",
"password": "securePass123"
}
Response: { data: { user, accessToken }, meta } + Set-Cookie: refresh_token.
POST /auth/refresh
Обновление access token через refresh token из cookie.
Response: { data: { user, accessToken }, meta } + новый Set-Cookie: refresh_token.
POST /auth/logout
Выход из системы. Удаляет refresh token из БД и чистит cookie.
Headers: Authorization: Bearer <accessToken>
Response: { data: { message }, meta }.
GET /auth/me
Информация о текущем пользователе.
Headers: Authorization: Bearer <accessToken>
Response:
{
"data": {
"id": 1,
"email": "user@example.com",
"name": "John",
"role": "user"
},
"meta": { "fromCache": false, "cachedAt": null }
}
PATCH /auth/me
Обновление профиля текущего пользователя.
Headers: Authorization: Bearer <accessToken>
Request:
{
"name": "John Doe"
}
Response: { data: { id, email, name, role }, meta }.
Health
GET /health
Проверка состояния сервиса.
Response:
{
"status": "ok",
"timestamp": "2026-06-13T12:00:00.000Z",
"uptime": 1234.56
}
Securities
GET /securities/search
Поиск по инструментам.
Parameters:
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
q |
string | yes | — | Поисковый запрос (1-100 символов) |
type |
enum | no | all |
Фильтр: all, share, bond |
limit |
integer | no | 20 |
Лимит результатов |
Response:
{
"data": [
{
"secid": "SBER",
"isin": "RU0009029540",
"shortName": "Сбербанк",
"type": "share",
"listLevel": 1,
"currency": "RUB",
"price": null
}
],
"meta": { "fromCache": false, "cachedAt": null }
}
Shares
GET /securities/shares/:secid
Спецификация акции.
Parameters: secid — тикер (например, SBER)
Response: ShareResponse — спецификация + текущие рыночные данные.
{
"data": {
"secid": "SBER",
"isin": "RU0009029540",
"name": "Сбербанк России ПАО ао",
"shortName": "Сбербанк",
"latName": null,
"listLevel": 1,
"issueSize": 21586948000,
"faceValue": 3,
"faceUnit": "RUB",
"type": "common_share",
"marketData": {
"price": 322.35,
"change": 1.15,
"changePercent": 0.36,
"open": 321.3,
"high": 322.66,
"low": 321.2,
"volume": 1925163,
"value": 620184479,
"issueCapitalization": 6958336818320,
"updatedAt": "2026-06-13T10:30:00.000Z"
}
},
"meta": { "fromCache": false, "cachedAt": null }
}
GET /securities/shares/:secid/marketdata
Рыночные данные акции (без спецификации).
Response:
{
"data": {
"price": 322.35,
"change": 1.15,
"changePercent": 0.36,
"open": 321.3,
"high": 322.66,
"low": 321.2,
"volume": 1925163,
"value": 620184479,
"issueCapitalization": 6958336818320,
"updatedAt": "2026-06-13T10:30:00.000Z"
},
"meta": { "fromCache": true, "cachedAt": null }
}
GET /securities/shares/:secid/dividends
Дивиденды акции.
Parameters: secid — тикер
Response:
{
"data": [
{
"registryCloseDate": "2026-07-10",
"value": 33.4,
"currency": "RUB"
}
],
"meta": { "fromCache": false, "cachedAt": null }
}
GET /securities/shares/:secid/history
Дневная история торгов акции.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
from |
string (date) | yes | Начальная дата (YYYY-MM-DD) |
till |
string (date) | yes | Конечная дата (YYYY-MM-DD) |
Response:
{
"data": [
{
"date": "2026-06-13",
"open": 321.3,
"high": 322.66,
"low": 321.2,
"close": 322.35,
"volume": 1925163,
"value": 620184479
}
],
"meta": { "fromCache": false, "cachedAt": null }
}
Bonds
GET /securities/bonds/:secid
Спецификация облигации.
Parameters: secid — тикер
Response: BondResponse — спецификация + рыночные данные.
{
"data": {
"secid": "SU26238RMFS5",
"isin": "RU000A106ZJ4",
"name": "ОФЗ 26238",
"shortName": "ОФЗ 26238",
"latName": null,
"listLevel": 1,
"issueSize": 500000000,
"faceValue": 1000,
"faceUnit": "RUB",
"matDate": "2041-05-15",
"couponValue": 34.9,
"couponPercent": 6.98,
"couponPeriod": 182,
"nextCoupon": "2026-12-01",
"accruedInt": 12.45,
"bondType": "OFZ",
"bondSubType": "",
"offerDate": null,
"buybackDate": null,
"marketData": {
"price": 98.45,
"yieldToMaturity": 7.12,
"duration": 8.34,
"accruedInt": 12.45,
"couponValue": 34.9,
"couponPercent": 6.98,
"nextCouponDate": "2026-12-01",
"open": 98.3,
"high": 98.6,
"low": 98.2,
"volume": 1500000,
"updatedAt": "2026-06-13T10:30:00.000Z"
}
},
"meta": { "fromCache": false, "cachedAt": null }
}
GET /securities/bonds/:secid/marketdata
Рыночные данные облигации.
GET /securities/bonds/:secid/history
Дневная история торгов облигации.
Parameters: from, till (date)
Response:
{
"data": [
{
"date": "2026-06-13",
"closePrice": 98.45,
"yieldClose": 7.12,
"duration": 8.34
}
],
"meta": { "fromCache": false, "cachedAt": null }
}
Candles
GET /securities/shares/:secid/candles
Свечи акции.
GET /securities/bonds/:secid/candles
Свечи облигации.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
interval |
enum | yes | 1h или 24h |
from |
string (date) | yes | Начальная дата |
till |
string (date) | yes | Конечная дата |
Response:
{
"data": [
{
"open": 321.3,
"high": 322.66,
"low": 321.2,
"close": 322.35,
"volume": 1925163,
"value": 620184479,
"begin": "2026-06-13T10:00:00",
"end": "2026-06-13T10:59:59"
}
],
"meta": { "fromCache": false, "cachedAt": null }
}