Skip to content

Add coin field to ChartCandleStick for proper candle filtering#931

Merged
gemcoder21 merged 1 commit intomainfrom
perpetual-candle-coin-field
Feb 7, 2026
Merged

Add coin field to ChartCandleStick for proper candle filtering#931
gemcoder21 merged 1 commit intomainfrom
perpetual-candle-coin-field

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Feb 6, 2026

When multiple perpetual screens are open, candle updates from one asset were incorrectly applied to another asset's chart. This adds the coin identifier to ChartCandleStick so consumers can validate which asset a candle belongs to.

@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 6, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/gem_hypercore/src/provider/websocket_mapper.rs  84% smaller
  crates/gem_hypercore/src/models/candlestick.rs  46% smaller
  crates/gem_hypercore/src/provider/perpetual_mapper.rs  12% smaller
  gemstone/src/models/perpetual.rs  1% smaller
  crates/gem_hypercore/src/models/websocket.rs  0% smaller
  crates/primitives/src/chart.rs  0% smaller

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where candlestick updates were being incorrectly applied across different perpetual asset charts. By introducing a coin identifier to the ChartCandleStick data structure, the system can now accurately filter and associate candle updates with their respective assets, preventing data corruption and ensuring correct chart displays, especially when multiple asset screens are active.

Highlights

  • Candlestick Struct Update: The Candlestick struct in gem_hypercore now includes a s: String field to represent the coin symbol, enabling better identification of financial assets.
  • ChartCandleStick Struct Update: The ChartCandleStick struct in primitives and GemChartCandleStick in gemstone now include a coin: String field, which will store the asset's symbol.
  • Mapping Integration: The conversion logic from Candlestick to ChartCandleStick has been updated to correctly map the new s field from Candlestick to the coin field in ChartCandleStick.
  • Test Enhancements: Existing tests in perpetual_mapper.rs and websocket_mapper.rs have been updated to include and assert the presence and correctness of the coin field, ensuring proper data handling and preventing regressions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • crates/gem_hypercore/src/models/candlestick.rs
    • Added pub s: String (symbol/coin) to the Candlestick struct.
    • Modified the From<Candlestick> for ChartCandleStick implementation to include mapping candlestick.s to ChartCandleStick.coin.
  • crates/gem_hypercore/src/provider/perpetual_mapper.rs
    • Updated test Candlestick instances to include the s field with "BTC".
    • Added assertions for first_candle.coin and second_candle.coin in the test.
  • crates/gem_hypercore/src/provider/websocket_mapper.rs
    • Added an assertion for candle.coin in the test, expecting "ETH".
  • crates/primitives/src/chart.rs
    • Added pub coin: String to the ChartCandleStick struct.
  • gemstone/src/models/perpetual.rs
    • Added pub coin: String to the GemChartCandleStick struct.
Activity
  • The pull request was opened by DRadmir with a clear description of the problem and the proposed solution.
  • No further review comments or activity have been recorded in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the issue of incorrect candle updates by introducing a coin identifier to the Candlestick and ChartCandleStick structs. The changes are well-implemented across the relevant crates (gem_hypercore, primitives, gemstone) and include appropriate updates to test cases to ensure the new field is correctly populated and asserted. The solution is clear, concise, and directly resolves the problem described in the pull request body.

#[typeshare(swift = "Equatable, Sendable")]
#[serde(rename_all = "camelCase")]
pub struct ChartCandleStick {
pub coin: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

create separate model for internal and coin, that has candle to ChartCandleStick

- Remove coin and interval from ChartCandleStick (pure OHLCV data)
- Add ChartCandleUpdate containing coin, interval, and candle
- Update websocket message to use ChartCandleUpdate
- Add From<&Candlestick> for ChartCandleStick for reusability

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@DRadmir DRadmir force-pushed the perpetual-candle-coin-field branch from 0a8b169 to 16712fe Compare February 7, 2026 07:00
@gemcoder21 gemcoder21 merged commit 493d53e into main Feb 7, 2026
6 checks passed
@gemcoder21 gemcoder21 deleted the perpetual-candle-coin-field branch February 7, 2026 19:00
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.

2 participants