feat(upbit): define new CCXT Pro watchOHLCV API#18
Conversation
There was a problem hiding this comment.
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
watchOHLCVmethod for subscribing to real-time OHLCV data. - Data Handling: Implements the
handleOHLCVmethod to parse incoming OHLCV messages from the Upbit exchange. - WebSocket Integration: Integrates the
watchOHLCVmethod into the WebSocket message handling system.
Changelog
- ts/src/pro/upbit.ts
- Imported the
OHLCVtype from../base/types.jsto define the return type for thewatchOHLCVmethod (line 6). - Enabled the
watchOHLCVmethod in thehasproperty (line 23). - Added the
watchOHLCVmethod to subscribe to OHLCV data via WebSocket (lines 207-222). - Implemented the
handleOHLCVmethod to parse and process incoming OHLCV messages (lines 353-372). - Registered the
handleOHLCVmethod to handlecandle.1smessages (lines 699).
- Imported the
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
-
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. ↩
There was a problem hiding this comment.
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
watchOHLCVmethod 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
handleOHLCVmethod lacks error handling. Ifthis.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
watchOHLCVAPI. 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.
ts/src/pro/upbit.ts
Outdated
| * @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'); |
There was a problem hiding this comment.
timeframe별로 분기처리를 추가하는게 추후에 분캔들, 월캔들 웹소켓 추가되었을 때 확장하기 용이하지 않을까요?
8bcb9e0 to
39d810f
Compare
- added checking timeframe logic.
39d810f to
44e8639
Compare
CCXT Pro 초캔들 추가의 건 입니다.