- funding_rate table and "Фондирование" page: rate from date, history, rate on date (D27)
- positions by issue: BUY - SELL per portfolio, "Остатки" page (D29)
- quotes are loaded only for securities with an open position (D10)
- business calendar from xmlcalendar.ru: yearly file upload, report date
and update job use previous working day (D30)
- xlsx download for positions, quotes and funding rate history
- manual operation type as radio buttons
- QUIK instruments with purchase marks ("МТС 2Р-18_1") match the issue,
file name kept in operation.instrument (D17)
- migrations d3a6f8b1c254, e7b2c9d4a813, f1c4a7e9b352
- project.md: decisions and questions after customer meetings
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
from __future__ import annotations
|
||
|
||
from datetime import date
|
||
from decimal import Decimal
|
||
|
||
from sqlalchemy import BigInteger, Date, ForeignKey, UniqueConstraint
|
||
from sqlalchemy.orm import Mapped, mapped_column
|
||
|
||
from app.core.config import settings
|
||
from app.db.base import Base
|
||
from app.db.types import AuditMixin, IdMixin, Percent, qualified
|
||
|
||
|
||
class FundingRate(IdMixin, AuditMixin, Base):
|
||
"""Ставка фондирования портфеля в валюте, % годовых, с даты effective_from
|
||
до следующей записи (D27)."""
|
||
|
||
__tablename__ = "funding_rate"
|
||
__table_args__ = (
|
||
UniqueConstraint(
|
||
"portfolio_id",
|
||
"currency_id",
|
||
"effective_from",
|
||
name="uq_funding_rate_portfolio_currency_date",
|
||
),
|
||
{"schema": settings.DATABASE_SCHEMA} if settings.DATABASE_SCHEMA else {},
|
||
)
|
||
|
||
portfolio_id: Mapped[int] = mapped_column(
|
||
BigInteger, ForeignKey(qualified("portfolio.id")), nullable=False
|
||
)
|
||
currency_id: Mapped[int] = mapped_column(
|
||
BigInteger, ForeignKey(qualified("currency.id")), nullable=False
|
||
)
|
||
effective_from: Mapped[date] = mapped_column(Date, nullable=False)
|
||
rate: Mapped[Decimal] = mapped_column(Percent, nullable=False)
|