Skip to content

feat: Add autorate calculators with Manul API support#90

Closed
dapi wants to merge 1 commit intomasterfrom
chore/89-adapt-autorate-calculators-manul
Closed

feat: Add autorate calculators with Manul API support#90
dapi wants to merge 1 commit intomasterfrom
chore/89-adapt-autorate-calculators-manul

Conversation

@dapi
Copy link
Copy Markdown

@dapi dapi commented Jan 20, 2026

Summary

Адаптация PR #71 для текущего master с поддержкой Manul API.

  • Добавлены калькуляторы AutorateCalculators::Legacy и PositionAware с паттерном Strategy
  • Использует Manul API вместо BestChange::Service для внешних курсов
  • Использует ActiveJob (perform_later) вместо Sidekiq (perform_async)
  • Добавлена колонка calculator_type в exchange_rates для выбора алгоритма
  • Добавлены конфиг-опции our_exchanger_id и anomaly_threshold_percent

Архитектура

AutorateCalculators::Base (абстрактный)
├── Legacy      - старое поведение (по умолчанию)
└── PositionAware - новое, с учётом позиций выше

Что решает PositionAware

Текущий алгоритм автокурса при попытке занять позицию в диапазоне (например, 5-10) перепрыгивает все позиции выше, вместо того чтобы остаться внутри целевого диапазона.

PositionAware калькулятор гарантирует, что обменник займёт позицию внутри диапазона position_from..position_to.

Supersedes #71
Closes #69

Test plan

  • Все 440 тестов проходят
  • Unit-тесты для Legacy калькулятора
  • Unit-тесты для PositionAware калькулятора
  • Протестировать на staging с реальными данными

🤖 Generated with Claude Code

Adapts PR #71 (position-aware autorate) for current master:
- Add AutorateCalculators::Legacy and PositionAware with Strategy pattern
- Use Manul API instead of BestChange::Service for external rates
- Use ActiveJob (perform_later) instead of Sidekiq (perform_async)
- Add calculator_type column to exchange_rates for selecting algorithm
- Add our_exchanger_id and anomaly_threshold_percent config options

The PositionAware calculator prevents "jumping over" positions above
the target range, with adaptive GAP and anomaly protection.

Closes #69

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dapi
Copy link
Copy Markdown
Author

dapi commented Jan 20, 2026

Закрыто в пользу PR #93, который корректно адаптировал боевой PositionAware калькулятор из PR #71 с сохранением истории коммитов и полного покрытия тестами.

@dapi dapi closed this Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Улучшить алгоритм автокурса: занимать позицию в диапазоне, а не перепрыгивать всех

1 participant