DRRK/alembic/versions/f1c4a7e9b352_operation_instrument.py
Raykov-MS c1c73e96f5 Add funding rates, positions, business calendar and xlsx export
- 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
2026-10-29 11:20:15 +03:00

37 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""инструмент из файла QUIK в операции
Revision ID: f1c4a7e9b352
Revises: e7b2c9d4a813
Create Date: 2026-10-27 00:00:00
operation.instrument — «Инструмент сокр.» из файла как есть, с меткой
покупки («МТС 2Р-18_1», D17, Q24).
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
from app.core.config import settings
# revision identifiers, used by Alembic.
revision: str = "f1c4a7e9b352"
down_revision: Union[str, None] = "e7b2c9d4a813"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
_schema = settings.DATABASE_SCHEMA or None
def upgrade() -> None:
"""Upgrade schema."""
with op.batch_alter_table("operation", schema=_schema) as batch:
batch.add_column(sa.Column("instrument", sa.String(255), nullable=True))
def downgrade() -> None:
"""Downgrade schema."""
with op.batch_alter_table("operation", schema=_schema) as batch:
batch.drop_column("instrument")