Update gainers losers series to use Kucoin futures instead of Binance Spot - #1144
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2f44c32b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from alembic import op | ||
|
|
||
| revision: str = "e6f7a8b9c0d1" | ||
| down_revision: str | Sequence[str] | None = "d4e5f6a7b8c9" |
There was a problem hiding this comment.
Base the migration on the existing Alembic head
Revision 615975c99625 already has d4e5f6a7b8c9 as its parent, so assigning the same parent here creates two Alembic heads. The repository's Makefile migration target and ApiDb.run_migrations() both execute alembic upgrade head, which rejects a graph with multiple heads and prevents deployment migrations from completing; chain this revision after 615975c99625 or add a merge revision.
Useful? React with 👍 / 👎.
| fiat = AutotradeCrud(session=self._external_session).get_fiat() | ||
|
|
||
| ticker_data = binance_api.ticker_24() | ||
| kucoin_futures_api = KucoinFutures( |
There was a problem hiding this comment.
Import the KuCoin futures client before constructing it
When the hourly cron invokes ingest(), this expression raises NameError because the module still imports only BinanceApi and never defines KucoinFutures. Consequently no KuCoin snapshots can be ingested; replace the stale import with the specific KucoinFutures import used here.
AGENTS.md reference: AGENTS.md:L26-L28
Useful? React with 👍 / 👎.
| with get_db_session(self._external_session) as session: | ||
| distinct_timestamps = session.exec( | ||
| select(TopGainersLosersSeriesTable.recorded_at) | ||
| .where(TopGainersLosersSeriesTable.source == source) |
There was a problem hiding this comment.
Define the source used by query_series
Every call to the public /charts/gainers-losers-series endpoint now evaluates an undefined local named source, so query_series() raises NameError before executing either query and the route returns an error even when snapshots exist. Make the desired source an explicit parameter/default or consistently reference self.SOURCE.
AGENTS.md reference: AGENTS.md:L20-L24
Useful? React with 👍 / 👎.
c2f44c3 to
c75a9de
Compare
c75a9de to
f4c3ee8
Compare
No description provided.