{
  "openapi": "3.0.3",
  "info": {
    "title": "SoilWorker REST API",
    "version": "1.0.0",
    "description": "Централизованный сервис синхронизации данных, хранения коллекций проектов и инвестиционной аналитики (**Prognosis**).\n\n### Способы авторизации:\n1. **Personal API Token**: заголовок `Authorization: Token <ваш_токен>`.\n2. **Project Key**: заголовок `X-Project-Key: proj_...` (для выгрузки/чтения данных проектов и внешних сборщиков).\n3. **Web Session**: для работы из веб-интерфейса браузера.",
    "contact": {
      "name": "SoilWorker Support",
      "url": "http://soilworker.ru/"
    }
  },
  "servers": [
    {
      "url": "https://www.soilworker.ru/",
      "description": "Текущий сервер"
    },
    {
      "url": "/",
      "description": "Относительный URL сервера"
    },
    {
      "url": "http://soilworker.ru/",
      "description": "Production сервер"
    },
    {
      "url": "http://localhost:8081/",
      "description": "Локальное окружение (Nginx)"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Получение API-токенов пользователей"
    },
    {
      "name": "Sync",
      "description": "Универсальный шлюз загрузки (Push) и чтения (Pull) данных внешними проектами"
    },
    {
      "name": "Projects",
      "description": "Управление проектами и сырыми данными коллекций"
    },
    {
      "name": "Prognosis: Портфели и Сделки",
      "description": "Учёт портфелей, позиций, сделок, комиссий и расчет сводной аналитики"
    },
    {
      "name": "Prognosis: События",
      "description": "Мировые и корпоративные события с оценкой влияния на компании, индустрии и страны"
    },
    {
      "name": "Prognosis: Компании и Бумаги",
      "description": "Компании, ценные бумаги, дивиденды, целевые цены и биржевые идентификаторы"
    },
    {
      "name": "Prognosis: Котировки",
      "description": "История дневных свечей (OHLCV) и автоматический сбор котировок (MOEX / Yahoo / T-Invest / Twelve Data)"
    },
    {
      "name": "Prognosis: Курсы валют",
      "description": "Курсы валют (ЦБ РФ / T-Invest), витрина актуальных котировок и конвертер сумм"
    },
    {
      "name": "Prognosis: Справочники",
      "description": "Справочники стран, отраслей, отраслевых метрик, угроз и классов событий"
    }
  ],
  "components": {
    "securitySchemes": {
      "TokenAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Персональный API-токен пользователя. Формат: `Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b`"
      },
      "ProjectKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Project-Key",
        "description": "API-ключ проекта для внешних систем (начинается с `proj_`)"
      },
      "SessionAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "sessionid",
        "description": "Сессионная кука авторизованного пользователя"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "TokenAuthRequest": {
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "properties": {
          "username": {
            "type": "string",
            "example": "admin"
          },
          "password": {
            "type": "string",
            "example": "password123"
          }
        }
      },
      "TokenAuthResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
          }
        }
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "Мой Сервис"
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "example": "my-service"
          },
          "description": {
            "type": "string",
            "example": "Описание проекта"
          },
          "api_key": {
            "type": "string",
            "readOnly": true,
            "description": "Ключ для авторизации внешних сервисов при выгрузке/чтении данных (X-Project-Key)",
            "example": "proj_aB9x..."
          },
          "is_active": {
            "type": "boolean"
          },
          "records_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name",
          "slug"
        ]
      },
      "ProjectData": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "project": {
            "type": "integer",
            "description": "ID проекта"
          },
          "project_slug": {
            "type": "string",
            "readOnly": true
          },
          "collection": {
            "type": "string",
            "maxLength": 80,
            "description": "Категория данных (например: users, metrics, inventory, events)",
            "example": "users"
          },
          "external_id": {
            "type": "string",
            "maxLength": 128,
            "description": "ID объекта во внешнем проекте (для обновления или дедупликации)",
            "example": "usr_1024"
          },
          "payload": {
            "type": "object",
            "example": {
              "email": "user@example.com",
              "name": "Иван Иванов"
            }
          },
          "version": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "project",
          "collection"
        ]
      },
      "SyncItem": {
        "type": "object",
        "properties": {
          "collection": {
            "type": "string",
            "maxLength": 80,
            "example": "users"
          },
          "external_id": {
            "type": "string",
            "maxLength": 128,
            "default": "",
            "example": "usr_1024"
          },
          "payload": {
            "type": "object",
            "example": {
              "email": "user@example.com",
              "name": "Иван Иванов"
            }
          },
          "version": {
            "type": "integer",
            "default": 1
          }
        },
        "required": [
          "collection"
        ]
      },
      "SyncPushRequest": {
        "type": "object",
        "properties": {
          "project_slug": {
            "type": "string",
            "maxLength": 120,
            "description": "Обязательно, если авторизация через User Token вместо X-Project-Key",
            "example": "my-service"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SyncItem"
            },
            "description": "Список объектов данных для синхронизации/сохранения"
          }
        },
        "required": [
          "items"
        ]
      },
      "SyncPushResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "success"
          },
          "project": {
            "type": "string",
            "example": "my-service"
          },
          "total_processed": {
            "type": "integer",
            "example": 1
          },
          "created": {
            "type": "integer",
            "example": 1
          },
          "updated": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "SyncLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "project": {
            "type": "integer"
          },
          "project_slug": {
            "type": "string",
            "readOnly": true
          },
          "action": {
            "type": "string",
            "enum": [
              "push",
              "pull",
              "sync"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error",
              "pending"
            ]
          },
          "records_count": {
            "type": "integer"
          },
          "details": {
            "type": "string"
          },
          "ip_address": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "project"
        ]
      },
      "Company": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 160,
            "example": "ПАО Сбербанк"
          },
          "slug": {
            "type": "string",
            "maxLength": 160,
            "example": "sberbank"
          },
          "isin": {
            "type": "string",
            "maxLength": 50
          },
          "country": {
            "type": "integer",
            "nullable": true,
            "description": "ID страны"
          },
          "country_name": {
            "type": "string",
            "readOnly": true
          },
          "state_affiliated_country": {
            "type": "integer",
            "nullable": true,
            "description": "Страна, с которой аффилирована компания (пусто, если нет)"
          },
          "state_affiliated_country_name": {
            "type": "string",
            "readOnly": true
          },
          "is_state_affiliated": {
            "type": "boolean",
            "readOnly": true
          },
          "parent_company": {
            "type": "integer",
            "nullable": true,
            "description": "Материнская компания, если данная организация является дочерней"
          },
          "parent_company_name": {
            "type": "string",
            "readOnly": true
          },
          "is_subsidiary": {
            "type": "boolean",
            "readOnly": true
          },
          "industry": {
            "type": "integer",
            "nullable": true,
            "description": "ID отрасли"
          },
          "industry_name": {
            "type": "string",
            "readOnly": true
          },
          "sector_name": {
            "type": "string",
            "readOnly": true
          },
          "is_public": {
            "type": "boolean"
          },
          "free_float": {
            "type": "number",
            "nullable": true,
            "description": "Процент акций компании в свободном обращении"
          },
          "website": {
            "type": "string",
            "format": "uri",
            "example": "https://sberbank.ru"
          },
          "description": {
            "type": "string"
          },
          "business_metrics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessMetric"
            },
            "readOnly": true
          },
          "business_threats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessThreat"
            },
            "readOnly": true
          },
          "metric_names": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "threat_names": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "capitalization": {
            "type": "number",
            "nullable": true,
            "example": 6500000000000.0
          },
          "morningstar_rating": {
            "type": "string",
            "maxLength": 32,
            "example": "4 звезды"
          },
          "financial_metrics": {
            "type": "object",
            "description": "Годовая выручка, мультипликаторы и дополнительные показатели",
            "example": {
              "pe": 4.2,
              "div_yield": 10.5
            }
          },
          "securities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Security"
            },
            "readOnly": true
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyIdentifier"
            },
            "readOnly": true
          },
          "shareholders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "readOnly": true
                },
                "company": {
                  "type": "integer"
                },
                "company_name": {
                  "type": "string",
                  "readOnly": true
                },
                "holder_type": {
                  "type": "string",
                  "enum": [
                    "person",
                    "company"
                  ]
                },
                "holder_person": {
                  "type": "integer",
                  "nullable": true
                },
                "holder_person_name": {
                  "type": "string",
                  "readOnly": true
                },
                "holder_company": {
                  "type": "integer",
                  "nullable": true
                },
                "holder_company_name": {
                  "type": "string",
                  "readOnly": true
                },
                "holder_name": {
                  "type": "string",
                  "readOnly": true
                },
                "share": {
                  "type": "number"
                },
                "notes": {
                  "type": "string",
                  "maxLength": 255
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true
                }
              },
              "required": [
                "company"
              ]
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "Security": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "company": {
            "type": "integer",
            "nullable": true,
            "description": "ID компании-эмитента"
          },
          "company_name": {
            "type": "string",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "maxLength": 32,
            "example": "SBER"
          },
          "name": {
            "type": "string",
            "maxLength": 160,
            "example": "Сбербанк России (обыкновенная акция)"
          },
          "exchange": {
            "type": "string",
            "maxLength": 64
          },
          "asset_type": {
            "type": "string",
            "enum": [
              "common_stock",
              "preferred_stock",
              "dr",
              "bond",
              "etf",
              "currency",
              "other"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ]
          },
          "lot_size": {
            "type": "number"
          },
          "tracking_status": {
            "type": "string",
            "enum": [
              "in_portfolio",
              "watchlist",
              "exited",
              "none"
            ]
          },
          "is_tracked": {
            "type": "boolean",
            "readOnly": true
          },
          "strategy": {
            "type": "string",
            "enum": [
              "buy",
              "accumulate",
              "hold",
              "reduce",
              "sell",
              "watch",
              "none"
            ]
          },
          "target_price": {
            "type": "number",
            "nullable": true,
            "example": 320.0
          },
          "active_target_price": {
            "type": "object",
            "readOnly": true,
            "nullable": true
          },
          "exit_horizon": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "shares_outstanding": {
            "type": "integer",
            "nullable": true
          },
          "eps": {
            "type": "number",
            "nullable": true
          },
          "last_price": {
            "type": "number",
            "nullable": true,
            "example": 284.5
          },
          "last_price_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "notes": {
            "type": "string"
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyIdentifier"
            },
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "code",
          "name"
        ]
      },
      "Portfolio": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "Основной Брокерский"
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "example": "main"
          },
          "owner": {
            "type": "integer",
            "readOnly": true,
            "nullable": true
          },
          "broker": {
            "type": "string",
            "maxLength": 120,
            "example": "Т-Банк"
          },
          "base_currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ]
          },
          "is_iis": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "operations_count": {
            "type": "integer",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name",
          "slug"
        ]
      },
      "Operation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "portfolio": {
            "type": "integer",
            "description": "ID портфеля"
          },
          "portfolio_slug": {
            "type": "string",
            "readOnly": true
          },
          "security": {
            "type": "integer",
            "nullable": true,
            "description": "ID ценной бумаги"
          },
          "security_code": {
            "type": "string",
            "readOnly": true
          },
          "dividend": {
            "type": "integer",
            "nullable": true
          },
          "related_operation": {
            "type": "integer",
            "nullable": true,
            "description": "Например, парная запись списания/зачисления при редомициляции или обмене"
          },
          "executed_at": {
            "type": "string",
            "format": "date",
            "example": "2026-10-24"
          },
          "executed_time": {
            "type": "string",
            "format": "time",
            "nullable": true
          },
          "operation_type": {
            "type": "string",
            "enum": [
              "buy",
              "sell",
              "dividend",
              "coupon",
              "deposit",
              "withdraw",
              "redomiciliation_in",
              "redomiciliation_out",
              "split",
              "consolidation",
              "tax",
              "fee"
            ],
            "example": "buy"
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ]
          },
          "price": {
            "type": "number",
            "nullable": true,
            "example": 284.5
          },
          "quantity": {
            "type": "number",
            "example": 10.0
          },
          "commission": {
            "type": "number"
          },
          "tax": {
            "type": "number"
          },
          "total_payment": {
            "type": "number",
            "description": "Итоговая сумма (0 - авторасчет)",
            "example": 2845.0
          },
          "fx_rate_to_base": {
            "type": "number"
          },
          "base_currency_amount": {
            "type": "number",
            "nullable": true
          },
          "affects_cash": {
            "type": "boolean",
            "description": "Выключено для неторговых корпоративных действий (редомициляция, сплит)"
          },
          "external_id": {
            "type": "string",
            "maxLength": 128
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "portfolio",
          "executed_at",
          "operation_type"
        ]
      },
      "PriceHistory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "security": {
            "type": "integer"
          },
          "security_code": {
            "type": "string",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ],
            "default": "RUB"
          },
          "open_price": {
            "type": "number",
            "nullable": true
          },
          "high_price": {
            "type": "number",
            "nullable": true
          },
          "low_price": {
            "type": "number",
            "nullable": true
          },
          "close_price": {
            "type": "number",
            "nullable": true
          },
          "effective_price": {
            "type": "number",
            "readOnly": true
          },
          "volume": {
            "type": "integer",
            "nullable": true
          },
          "source": {
            "type": "string",
            "maxLength": 32
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "security",
          "date"
        ]
      },
      "PriceCandleItem": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 32,
            "description": "Тикер Security.code либо значение идентификатора",
            "example": "SBER"
          },
          "source_type": {
            "type": "string",
            "maxLength": 32,
            "default": "",
            "description": "Опционально: источник идентификатора (напр. MOEX, ISIN, TINKOFF_FIGI) для поиска бумаги"
          },
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-10-24"
          },
          "currency": {
            "type": "string",
            "maxLength": 10,
            "default": "RUB"
          },
          "open_price": {
            "type": "number",
            "nullable": true,
            "example": 280.5
          },
          "high_price": {
            "type": "number",
            "nullable": true,
            "example": 285.0
          },
          "low_price": {
            "type": "number",
            "nullable": true,
            "example": 279.0
          },
          "close_price": {
            "type": "number",
            "nullable": true,
            "example": 284.2
          },
          "volume": {
            "type": "integer",
            "nullable": true,
            "example": 1250000
          },
          "source": {
            "type": "string",
            "maxLength": 32,
            "default": "API",
            "example": "MOEX"
          }
        },
        "required": [
          "code",
          "date"
        ]
      },
      "PriceHistoryBulkUpsert": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceCandleItem"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "ExchangeRate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "base_currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ],
            "example": "USD"
          },
          "quote_currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ],
            "default": "RUB"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "rate": {
            "type": "number",
            "example": 96.5
          },
          "open_rate": {
            "type": "number",
            "nullable": true
          },
          "high_rate": {
            "type": "number",
            "nullable": true
          },
          "low_rate": {
            "type": "number",
            "nullable": true
          },
          "nominal": {
            "type": "integer"
          },
          "source": {
            "type": "string",
            "maxLength": 32,
            "example": "CBR"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "base_currency",
          "date",
          "rate"
        ]
      },
      "CompanyIdentifier": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "company": {
            "type": "integer"
          },
          "company_name": {
            "type": "string",
            "readOnly": true
          },
          "security": {
            "type": "integer",
            "nullable": true,
            "description": "Оставьте пустым, если идентификатор относится к компании в целом (например, ИНН)"
          },
          "security_code": {
            "type": "string",
            "readOnly": true
          },
          "source": {
            "type": "string",
            "enum": [
              "MOEX",
              "SPB",
              "NYSE",
              "NASDAQ",
              "TYO",
              "LSE",
              "ISIN",
              "TINKOFF_FIGI",
              "TINKOFF_UID",
              "GOOGLE_FINANCE",
              "YAHOO",
              "TRADINGVIEW",
              "SMARTLAB",
              "INVESTING",
              "INN",
              "OTHER"
            ],
            "example": "MOEX"
          },
          "value": {
            "type": "string",
            "maxLength": 128,
            "example": "SBER"
          },
          "board": {
            "type": "string",
            "maxLength": 32,
            "default": "",
            "description": "Например: TQBR на Московской бирже",
            "example": "TQBR"
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ],
            "example": "RUB"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "is_primary": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "notes": {
            "type": "string",
            "maxLength": 255
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "company",
          "source",
          "value"
        ]
      },
      "Dividend": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "security": {
            "type": "integer"
          },
          "security_code": {
            "type": "string",
            "readOnly": true
          },
          "company_name": {
            "type": "string",
            "readOnly": true
          },
          "declaration_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "record_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "period_label": {
            "type": "string",
            "maxLength": 64,
            "example": "2025"
          },
          "amount_per_share": {
            "type": "number",
            "nullable": true,
            "example": 33.3
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ]
          },
          "yield_pct": {
            "type": "number",
            "nullable": true,
            "example": 11.5
          },
          "status": {
            "type": "string",
            "enum": [
              "forecast",
              "recommended",
              "approved",
              "paid",
              "cancelled"
            ]
          },
          "notes": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "security"
        ]
      },
      "TargetPrice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "security": {
            "type": "integer"
          },
          "security_code": {
            "type": "string",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "price": {
            "type": "number",
            "example": 350.0
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ]
          },
          "notes": {
            "type": "string",
            "maxLength": 200
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "security",
          "date",
          "price"
        ]
      },
      "Country": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "Россия"
          },
          "iso_code": {
            "type": "string",
            "maxLength": 3,
            "example": "RUS"
          },
          "currency": {
            "type": "string",
            "enum": [
              "RUB",
              "USD",
              "EUR",
              "CNY",
              "HKD",
              "JPY",
              "GBP",
              "CHF",
              "KZT"
            ],
            "example": "RUB"
          },
          "foundation_year": {
            "type": "integer",
            "nullable": true
          },
          "population": {
            "type": "integer",
            "nullable": true
          },
          "gdp_bln_usd": {
            "type": "number",
            "nullable": true
          },
          "hdi": {
            "type": "number",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "Industry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 120,
            "example": "Банковский сектор"
          },
          "sector": {
            "type": "string",
            "maxLength": 120,
            "example": "Финансы"
          },
          "description": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "BusinessMetric": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "example": "Чистая процентная маржа (NIM)"
          },
          "kind": {
            "type": "string",
            "enum": [
              "quantitative",
              "qualitative",
              "comparative"
            ],
            "description": "Количественные, качественные или сравнительные показатели"
          },
          "kind_display": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "BusinessThreat": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "example": "Рост стоимости риска (CoR)"
          },
          "kind": {
            "type": "string",
            "enum": [
              "quantitative",
              "qualitative",
              "comparative"
            ],
            "description": "Количественные, качественные или сравнительные показатели"
          },
          "kind_display": {
            "type": "string",
            "readOnly": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "EventClass": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "maxLength": 160,
            "example": "Публикация отчёта"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "name"
        ]
      },
      "EventCompanyImpact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "company": {
            "type": "integer"
          },
          "company_name": {
            "type": "string",
            "readOnly": true
          },
          "company_slug": {
            "type": "string",
            "readOnly": true
          },
          "affected_metrics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessMetric"
            },
            "readOnly": true
          },
          "triggered_threats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessThreat"
            },
            "readOnly": true
          },
          "metric_names": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "threat_names": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "impact_type": {
            "type": "string",
            "enum": [
              "political",
              "financial",
              "product"
            ]
          },
          "impact_degree": {
            "type": "string",
            "enum": [
              "minor",
              "moderate",
              "significant"
            ]
          },
          "impact_direction": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ]
          },
          "horizon": {
            "type": "string",
            "enum": [
              "2w",
              "1m",
              "3m",
              "6m",
              "1y",
              "2y"
            ]
          },
          "confidence": {
            "type": "integer"
          }
        },
        "required": [
          "company"
        ]
      },
      "EventIndustryImpact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "industry": {
            "type": "integer"
          },
          "industry_name": {
            "type": "string",
            "readOnly": true
          },
          "sector_name": {
            "type": "string",
            "readOnly": true
          },
          "impact_type": {
            "type": "string",
            "enum": [
              "political",
              "financial",
              "product"
            ]
          },
          "impact_degree": {
            "type": "string",
            "enum": [
              "minor",
              "moderate",
              "significant"
            ]
          },
          "impact_direction": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ]
          },
          "horizon": {
            "type": "string",
            "enum": [
              "2w",
              "1m",
              "3m",
              "6m",
              "1y",
              "2y"
            ]
          },
          "confidence": {
            "type": "integer"
          }
        },
        "required": [
          "industry"
        ]
      },
      "EventCountryImpact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "country": {
            "type": "integer"
          },
          "country_name": {
            "type": "string",
            "readOnly": true
          },
          "impact_type": {
            "type": "string",
            "enum": [
              "political",
              "financial",
              "product"
            ]
          },
          "impact_degree": {
            "type": "string",
            "enum": [
              "minor",
              "moderate",
              "significant"
            ]
          },
          "impact_direction": {
            "type": "string",
            "enum": [
              "positive",
              "negative"
            ]
          },
          "horizon": {
            "type": "string",
            "enum": [
              "2w",
              "1m",
              "3m",
              "6m",
              "1y",
              "2y"
            ]
          },
          "confidence": {
            "type": "integer"
          }
        },
        "required": [
          "country"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-10-28"
          },
          "title": {
            "type": "string",
            "maxLength": 255,
            "example": "Публикация отчёта за 9 месяцев 2026 года по МСФО"
          },
          "description": {
            "type": "string"
          },
          "event_class": {
            "type": "integer",
            "nullable": true
          },
          "event_class_name": {
            "type": "string"
          },
          "event_class_display": {
            "type": "string",
            "readOnly": true
          },
          "event_type": {
            "type": "string",
            "enum": [
              "intention",
              "start",
              "middle",
              "completion"
            ],
            "example": "completion"
          },
          "event_type_display": {
            "type": "string",
            "readOnly": true
          },
          "financial_report": {
            "type": "integer",
            "nullable": true
          },
          "financial_report_url": {
            "type": "string",
            "readOnly": true
          },
          "company_impacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventCompanyImpact"
            }
          },
          "industry_impacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventIndustryImpact"
            }
          },
          "country_impacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventCountryImpact"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "required": [
          "date",
          "title"
        ]
      }
    }
  },
  "paths": {
    "/api/auth/token/": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Получение персонального API-токена пользователя",
        "description": "Принимает логин и пароль, возвращает персональный токен DRF. Используется в заголовке `Authorization: Token <key>`.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenAuthRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Токен успешно получен",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenAuthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Неверный логин или пароль"
          }
        }
      }
    },
    "/api/v1/projects/": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "Список проектов",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Список проектов",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Project"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Projects"
        ],
        "summary": "Создание нового проекта",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Project"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Проект успешно создан",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка валидации данных"
          }
        }
      }
    },
    "/api/v1/projects/{slug}/": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "Детальная информация о проекте",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "404": {
            "description": "Проект не найден"
          }
        }
      },
      "put": {
        "tags": [
          "Projects"
        ],
        "summary": "Полное обновление проекта",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Project"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Projects"
        ],
        "summary": "Частичное обновление проекта",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Project"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Projects"
        ],
        "summary": "Удаление проекта",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Проект удален"
          }
        }
      }
    },
    "/api/v1/data/": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "Чтение синхронизированных записей данных",
        "description": "Возвращает записи коллекций с возможностью фильтрации по проекту, коллекции и external_id.",
        "parameters": [
          {
            "name": "project",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug проекта"
          },
          {
            "name": "collection",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Имя коллекции (users, orders, metrics)"
          },
          {
            "name": "external_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Внешний ID объекта"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectData"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/data/{id}/": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "Чтение отдельной записи данных по ID",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sync/push/": {
      "post": {
        "tags": [
          "Sync"
        ],
        "summary": "Универсальная выгрузка данных в сервис (Push)",
        "description": "Основной эндпоинт для микросервисов и внешних проектов. Пакетно сохраняет или обновляет (upsert) произвольные JSON-данные в разрезе коллекций.\n\nАвторизация:\n- Заголовок `X-Project-Key: proj_ВАШ_КЛЮЧ`\n- Либо `Authorization: Token <токен>` + указание `project_slug` в теле запроса.",
        "security": [
          {
            "ProjectKeyAuth": []
          },
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SyncPushRequest"
              },
              "example": {
                "items": [
                  {
                    "collection": "users",
                    "external_id": "usr_1024",
                    "payload": {
                      "email": "user@example.com",
                      "name": "Иван Иванов",
                      "is_active": true
                    },
                    "version": 1
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Пакет успешно обработан",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncPushResponse"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка валидации payload"
          },
          "401": {
            "description": "Не авторизован (не передан X-Project-Key или токен)"
          }
        }
      }
    },
    "/api/v1/sync/pull/": {
      "get": {
        "tags": [
          "Sync"
        ],
        "summary": "Получение синхронизированных данных (Pull)",
        "description": "Выгружает до 500 записей проекта для интеграции во внешние сервисы.",
        "parameters": [
          {
            "name": "project",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug проекта (если авторизация по токену)"
          },
          {
            "name": "collection",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Фильтр по названию коллекции"
          }
        ],
        "security": [
          {
            "ProjectKeyAuth": []
          },
          {
            "TokenAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Массив записей",
            "content": {
              "application/json": {
                "example": {
                  "project": "my-service",
                  "collection": "users",
                  "count": 1,
                  "records": [
                    {
                      "collection": "users",
                      "external_id": "usr_1024",
                      "payload": {
                        "email": "user@example.com",
                        "name": "Иван Иванов"
                      },
                      "version": 1,
                      "updated_at": "2026-10-24T22:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Не авторизован"
          }
        }
      }
    },
    "/api/v1/prognosis/companies/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Список компаний",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Поиск по названию компании, тикеру или идентификатору"
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Фильтр по названию страны"
          },
          {
            "name": "sector",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Фильтр по сектору экономики"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Company"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Создание новой компании",
        "description": "Создает компанию-эмитента. Поля `securities` и `identifiers` в API создаются отдельными эндпоинтами.",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Company"
              },
              "example": {
                "name": "ПАО Сбербанк",
                "slug": "sberbank",
                "is_public": true,
                "website": "https://www.sberbank.ru",
                "description": "Крупнейший универсальный банк России",
                "morningstar_rating": "4 звезды"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка валидации"
          }
        }
      }
    },
    "/api/v1/prognosis/companies/{slug}/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Карточка компании с ценными бумагами и идентификаторами",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Обновление компании",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Company"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Удаление компании",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Компания удалена"
          }
        }
      }
    },
    "/api/v1/prognosis/companies/{slug}/sync-quotes/": {
      "post": {
        "tags": [
          "Prognosis: Котировки"
        ],
        "summary": "Сбор котировок по компании за период (до 3 мес.)",
        "description": "Загружает исторические свечи (OHLCV) по бумагам компании из доступных провайдеров (MOEX / Yahoo / T-Invest / Twelve Data).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "date_from",
                  "date_to"
                ],
                "properties": {
                  "date_from": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-08-01"
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-24"
                  },
                  "security": {
                    "type": "string",
                    "default": "all",
                    "example": "all"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Отчёт о собранных котировках"
          },
          "400": {
            "description": "Период превышает 3 месяца или некорректные даты"
          },
          "429": {
            "description": "Лимит запросов провайдеров (активен кул-даун)"
          }
        }
      }
    },
    "/api/v1/prognosis/securities/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Список ценных бумаг",
        "parameters": [
          {
            "name": "tracking_status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "in_portfolio",
                "watchlist",
                "exited",
                "none"
              ]
            }
          },
          {
            "name": "tracked",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Только отслеживаемые (1 / true)"
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Security"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Создание ценной бумаги",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Security"
              },
              "example": {
                "company": 1,
                "code": "SBER",
                "name": "Сбербанк России (обыкновенная)",
                "asset_type": "common_stock",
                "currency": "RUB",
                "tracking_status": "in_portfolio",
                "strategy": "buy",
                "target_price": 320.0
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Security"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/securities/{code}/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Детальная информация о бумаге по тикеру",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "SBER"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Security"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Security"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Security"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Security"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Security"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/securities/tracked/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Список интересных бумаг (в портфеле или отслеживании)",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Security"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/securities/sync-targets/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Все активные бумаги отслеживаемых компаний",
        "parameters": [
          {
            "name": "market",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "rf",
                "world"
              ],
              "default": "all"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Security"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/securities/{code}/set_strategy/": {
      "post": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Установка инвестиционной стратегии бумаги",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "strategy"
                ],
                "properties": {
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "buy",
                      "accumulate",
                      "hold",
                      "reduce",
                      "sell",
                      "watch",
                      "none"
                    ],
                    "example": "buy"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Стратегия обновлена"
          }
        }
      }
    },
    "/api/v1/prognosis/securities/{code}/toggle_active/": {
      "post": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Переключение статуса активности ценной бумаги",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "SBER"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Статус активности обновлён",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "code": {
                      "type": "string",
                      "example": "SBER"
                    },
                    "is_active": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Переключение статуса активности ценной бумаги (PATCH)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "SBER"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Статус активности обновлён"
          }
        }
      }
    },
    "/api/v1/prognosis/securities/{code}/target_price/": {
      "post": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Установка целевой цены и опционального уведомления в Т-Инвестициях",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "SBER"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "price"
                ],
                "properties": {
                  "price": {
                    "type": "number",
                    "example": 320.0,
                    "description": "Новая целевая цена бумаги"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-24",
                    "description": "Дата фиксации (по умолчанию сегодня)"
                  },
                  "comment": {
                    "type": "string",
                    "example": "Пересмотр модели дисконтирования"
                  },
                  "sync_tinkoff": {
                    "type": "boolean",
                    "default": false,
                    "description": "Создать/проверить ценовое уведомление в Т-Инвестициях"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Целевая цена сохранена"
          },
          "400": {
            "description": "Некорректная целевая цена или дата"
          }
        }
      },
      "patch": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Обновление целевой цены бумаги (PATCH)",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "SBER"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "price"
                ],
                "properties": {
                  "price": {
                    "type": "number",
                    "example": 320.0,
                    "description": "Новая целевая цена бумаги"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-24",
                    "description": "Дата фиксации (по умолчанию сегодня)"
                  },
                  "comment": {
                    "type": "string",
                    "example": "Пересмотр модели дисконтирования"
                  },
                  "sync_tinkoff": {
                    "type": "boolean",
                    "default": false,
                    "description": "Создать/проверить ценовое уведомление в Т-Инвестициях"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Целевая цена сохранена"
          }
        }
      }
    },
    "/api/v1/prognosis/portfolios/": {
      "get": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Список портфелей",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Portfolio"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Создание портфеля",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Portfolio"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Portfolio"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/portfolios/{slug}/": {
      "get": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Параметры портфеля",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Portfolio"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/portfolios/{slug}/summary/": {
      "get": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Сводная аналитика, балансы и позиции портфеля",
        "description": "Рассчитывает денежные остатки по валютам, общую стоимость портфеля, чистый ввод/вывод средств, реализованную прибыль, нереализованную прибыль, полученные дивиденды, а также открытые и закрытые позиции со средневзвешенными ценами и пересчетом в валюту отображения.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Сводная структура портфеля",
            "content": {
              "application/json": {
                "example": {
                  "base_currency": "RUB",
                  "display_currency": "RUB",
                  "total_equity_display": "1500000.00",
                  "cash_total_display": "250000.00",
                  "market_value_total_display": "1250000.00",
                  "unrealized_profit_total_display": "145000.00",
                  "unrealized_profit_total_pct_display": "+13.12%",
                  "open_positions": [],
                  "closed_positions": []
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/operations/": {
      "get": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Список операций и сделок",
        "parameters": [
          {
            "name": "portfolio",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug портфеля"
          },
          {
            "name": "security",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Тикер ценной бумаги"
          },
          {
            "name": "operation_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Тип операции (buy, sell, dividend, deposit, etc.)"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Operation"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "summary": "Создание операции в портфеле",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Operation"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/operations/{id}/": {
      "get": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Prognosis: Портфели и Сделки"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Операция удалена"
          }
        }
      }
    },
    "/api/v1/prognosis/prices/": {
      "get": {
        "tags": [
          "Prognosis: Котировки"
        ],
        "summary": "История котировок (OHLCV свечи)",
        "parameters": [
          {
            "name": "security",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Тикер бумаги"
          },
          {
            "name": "date_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PriceHistory"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/prices/bulk/": {
      "post": {
        "tags": [
          "Prognosis: Котировки"
        ],
        "summary": "Пакетная загрузка исторических свечей (OHLCV)",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceHistoryBulkUpsert"
              },
              "example": {
                "items": [
                  {
                    "code": "SBER",
                    "date": "2026-10-24",
                    "currency": "RUB",
                    "open_price": 280.5,
                    "high_price": 285.0,
                    "low_price": 279.0,
                    "close_price": 284.2,
                    "volume": 1250000,
                    "source": "MOEX"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Свечи успешно сохранены",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "created": 1,
                  "updated": 0,
                  "unresolved_codes": []
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/prices/sync/": {
      "post": {
        "tags": [
          "Prognosis: Котировки"
        ],
        "summary": "Запуск автоматического сбора котировок",
        "description": "Запускает цикл опроса провайдеров (MOEX / Yahoo / T-Invest / Twelve Data) по всем отслеживаемым бумагам.",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "market": {
                    "type": "string",
                    "enum": [
                      "all",
                      "rf",
                      "world"
                    ],
                    "default": "all"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Сбор котировок успешно завершен"
          },
          "429": {
            "description": "Источники находятся на кул-дауне"
          }
        }
      }
    },
    "/api/v1/prognosis/fx/": {
      "get": {
        "tags": [
          "Prognosis: Курсы валют"
        ],
        "summary": "История курсов валют",
        "parameters": [
          {
            "name": "base_currency",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Базовая валюта (USD, EUR, CNY)"
          },
          {
            "name": "quote_currency",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "RUB"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExchangeRate"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/fx/latest/": {
      "get": {
        "tags": [
          "Prognosis: Курсы валют"
        ],
        "summary": "Сводка актуальных курсов основных валют",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Словарь курсов к валюте отображения"
          }
        }
      }
    },
    "/api/v1/prognosis/fx/convert/": {
      "get": {
        "tags": [
          "Prognosis: Курсы валют"
        ],
        "summary": "Конвертер сумм по историческому или актуальному курсу",
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "number",
              "default": 100
            },
            "required": true
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "USD"
            },
            "required": true
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "RUB"
            }
          },
          {
            "name": "date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Дата курса (по умолчанию последний)"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "amount": 100,
                  "from_currency": "USD",
                  "to_currency": "RUB",
                  "rate": 96.5,
                  "converted_amount": 9650.0,
                  "source": "CBR"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/fx/sync/": {
      "post": {
        "tags": [
          "Prognosis: Курсы валют"
        ],
        "summary": "Запуск обновления и бэкфилла курсов валют",
        "description": "Синхронизирует курсы валют из ЦБ РФ (с фоллбэком на T-Invest API).",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currencies": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "USD",
                      "EUR",
                      "CNY"
                    ]
                  },
                  "date_from": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-09-01"
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date",
                    "example": "2026-10-24"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Синхронизация завершена"
          }
        }
      }
    },
    "/api/v1/prognosis/countries/": {
      "get": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Справочник стран",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Country"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/industries/": {
      "get": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Справочник отраслей и секторов экономики",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Industry"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/dividends/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Реестр дивидендов",
        "parameters": [
          {
            "name": "security",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Тикер ценной бумаги"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "forecast",
                "recommended",
                "approved",
                "paid",
                "cancelled"
              ]
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Dividend"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/target-prices/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "История целевых цен (Trg Prc)",
        "parameters": [
          {
            "name": "security",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Тикер ценной бумаги"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TargetPrice"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/identifiers/": {
      "get": {
        "tags": [
          "Prognosis: Компании и Бумаги"
        ],
        "summary": "Биржевые и внешние идентификаторы компаний и бумаг",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Площадка (MOEX, SPB, NYSE, TINKOFF_FIGI, YAHOO, ISIN)"
          },
          {
            "name": "value",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Код / тикер / ID"
          },
          {
            "name": "company",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug компании"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CompanyIdentifier"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/metrics/": {
      "get": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Словарь отраслевых метрик бизнеса",
        "parameters": [
          {
            "name": "industry",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "ID индустрии (фильтрация по метрикам компаний данной индустрии)"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Поиск по названию метрики"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BusinessMetric"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Создание или получение отраслевой метрики (без дублирования при совпадении названия)",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessMetric"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Найдена существующая метрика",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessMetric"
                }
              }
            }
          },
          "201": {
            "description": "Создана новая метрика",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessMetric"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/threats/": {
      "get": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Словарь специфичных угроз и рисков бизнесу",
        "parameters": [
          {
            "name": "industry",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "ID индустрии (фильтрация по угрозам компаний данной индустрии)"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Поиск по названию угрозы"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BusinessThreat"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Создание или получение угрозы бизнесу (без дублирования при совпадении названия)",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessThreat"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Найдена существующая угроза",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessThreat"
                }
              }
            }
          },
          "201": {
            "description": "Создана новая угроза",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessThreat"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/event-classes/": {
      "get": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Словарь классов событий",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Поиск по названию класса события"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EventClass"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: Справочники"
        ],
        "summary": "Создание или получение класса события",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventClass"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Найден существующий класс события",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventClass"
                }
              }
            }
          },
          "201": {
            "description": "Создан новый класс события",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventClass"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/events/": {
      "get": {
        "tags": [
          "Prognosis: События"
        ],
        "summary": "Список событий (отсортированный строго по убыванию даты)",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug или ID компании (включая релевантные события индустрии и страны)"
          },
          {
            "name": "industry",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "ID индустрии"
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "ID страны"
          },
          {
            "name": "event_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "intention",
                "start",
                "middle",
                "completion"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Поиск по заголовку, описанию или классу"
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Event"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Prognosis: События"
        ],
        "summary": "Создание нового события",
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prognosis/events/{id}/": {
      "get": {
        "tags": [
          "Prognosis: События"
        ],
        "summary": "Карточка события со всеми причастными компаниями, индустриями и странами",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Prognosis: События"
        ],
        "summary": "Обновление события",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Prognosis: События"
        ],
        "summary": "Удаление события",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "TokenAuth": []
          },
          {
            "ProjectKeyAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Событие удалено"
          }
        }
      }
    }
  }
}