Skip to content

feat(upbit): define new CCXT Pro watchOHLCV API#18

Open
LambdaBen wants to merge 2 commits intomasterfrom
feature/pr-upbit-watchOHLCV
Open

feat(upbit): define new CCXT Pro watchOHLCV API#18
LambdaBen wants to merge 2 commits intomasterfrom
feature/pr-upbit-watchOHLCV

Conversation

@LambdaBen
Copy link
Collaborator

CCXT Pro 초캔들 추가의 건 입니다.

  1. return 타입 설정을 위한 OHLCV 타입 import
  2. watchOHLCV false -> true
  3. watchOHLCV 메서드 추가
  4. OHLCV 메시지 파싱 및 반환을 위한 handleOHLCV 메서드 추가
  5. message를 method에 따라 handling하는 handleMessage 메서드에 초캔들 추가

Copy link

@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.

Hello @LambdaBen, 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!

Summary of Changes

This pull request adds the watchOHLCV method to the Upbit Pro exchange, enabling users to receive real-time OHLCV (Open, High, Low, Close, Volume) data for specific symbols. The changes include importing the OHLCV type, enabling the watchOHLCV capability, adding the watchOHLCV method, creating a handleOHLCV method to parse and return OHLCV messages, and integrating the new method into the message handling logic.

Highlights

  • New Feature: Introduces the watchOHLCV method for subscribing to real-time OHLCV data.
  • Data Handling: Implements the handleOHLCV method to parse incoming OHLCV messages from the Upbit exchange.
  • WebSocket Integration: Integrates the watchOHLCV method into the WebSocket message handling system.

Changelog

  • ts/src/pro/upbit.ts
    • Imported the OHLCV type from ../base/types.js to define the return type for the watchOHLCV method (line 6).
    • Enabled the watchOHLCV method in the has property (line 23).
    • Added the watchOHLCV method to subscribe to OHLCV data via WebSocket (lines 207-222).
    • Implemented the handleOHLCV method to parse and process incoming OHLCV messages (lines 353-372).
    • Registered the handleOHLCV method to handle candle.1s messages (lines 699).
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Candles dance on the screen,
Data flows, a vibrant scene,
Upbit's heart beats fast,
OHLCV shadows cast,
Insights bloom, sharp and keen.

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

@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 introduces the watchOHLCV API to the Upbit exchange, enabling real-time monitoring of OHLCV data. The changes include necessary type imports, method additions, and message handling logic. Overall, the implementation seems well-structured and addresses the objective of adding real-time OHLCV data support.

Summary of Findings

  • Timeframe Support: The watchOHLCV method currently only supports 1s candles. It should be clarified in the code or documentation that other timeframes are not supported, or ideally, support for other timeframes should be added.
  • Error Handling: The handleOHLCV method lacks error handling. If this.parseOHLCV (message) fails or returns null, it could lead to unhandled exceptions. Error handling should be added to ensure robustness.
  • Missing Unit Tests: There are no unit tests for the new watchOHLCV API. Unit tests should be added to ensure the API functions correctly and to prevent regressions.

Merge Readiness

The pull request introduces a valuable feature by adding the watchOHLCV API. However, the lack of comprehensive error handling and unit tests raises concerns about its reliability and maintainability. I recommend addressing the identified issues before merging. I am unable to approve this pull request, and other reviewers should review and approve this code before merging.

* @returns {OHLCV[]} a list of [OHLCV structures]{@link https://docs.ccxt.com/#/?id=ohlcv-structure}
*/
async watchOHLCV (symbol: string, timeframe = '1m', since: Int = undefined, limit: Int = undefined, params = {}): Promise<OHLCV[]> {
return await this.watchPublic (symbol, 'candle.1s');
Copy link
Collaborator

Choose a reason for hiding this comment

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

timeframe별로 분기처리를 추가하는게 추후에 분캔들, 월캔들 웹소켓 추가되었을 때 확장하기 용이하지 않을까요?

@LambdaBen LambdaBen force-pushed the feature/pr-upbit-watchOHLCV branch from 8bcb9e0 to 39d810f Compare April 23, 2025 08:35
- added checking timeframe logic.
@LambdaBen LambdaBen force-pushed the feature/pr-upbit-watchOHLCV branch from 39d810f to 44e8639 Compare April 23, 2025 08:49
Copy link
Collaborator

@baileySoobinPark baileySoobinPark left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants