Skip to content

Update gainers losers series to use Kucoin futures instead of Binance Spot - #1144

Merged
carkod merged 1 commit into
masterfrom
fix-gainers-losers-series
Aug 29, 2026
Merged

Update gainers losers series to use Kucoin futures instead of Binance Spot#1144
carkod merged 1 commit into
masterfrom
fix-gainers-losers-series

Conversation

@carkod

@carkod carkod commented Aug 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@carkod
carkod force-pushed the fix-gainers-losers-series branch from c2f44c3 to c75a9de Compare August 25, 2026 21:26
@carkod
carkod force-pushed the fix-gainers-losers-series branch from c75a9de to f4c3ee8 Compare August 25, 2026 22:56
@carkod
carkod merged commit 7422b47 into master Aug 29, 2026
15 checks passed
@carkod
carkod deleted the fix-gainers-losers-series branch August 29, 2026 09:21
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