Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adam/remove candles main #2045

Merged
merged 2 commits into from
Aug 6, 2024
Merged

Adam/remove candles main #2045

merged 2 commits into from
Aug 6, 2024

Conversation

adamfraser
Copy link
Contributor

@adamfraser adamfraser commented Aug 6, 2024

Changelist

Remove all candles changes from Main

Summary by CodeRabbit

  • New Features

    • Simplified data model by removing orderbookMidPriceOpen and orderbookMidPriceClose from various components, including candle creation and updates.
  • Bug Fixes

    • Adjusted tests and related logic to reflect the removal of outdated properties, enhancing the accuracy of functionality.
  • Documentation

    • Updated API documentation and schemas to remove references to the eliminated properties, streamlining the expected responses.
  • Chores

    • Removed obsolete functions and test cases related to the removed properties, improving code maintainability.

@adamfraser adamfraser marked this pull request as ready for review August 6, 2024 20:04
Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent changes reflect a significant simplification of the data model concerning candle and order book mid-price structures. Key properties related to orderbookMidPriceOpen and orderbookMidPriceClose have been removed from various files, including data models, tests, and API documentation. This streamlining aims to enhance clarity and focus on essential attributes, potentially improving the application's performance and maintainability.

Changes

Files Change Summary
.../constants.ts, .../candle-table.test.ts, .../candle-model.ts, .../candle-types.ts, .../db-model-types.ts Removed orderbookMidPriceOpen and orderbookMidPriceClose from constants, test updates, model definitions, and TypeScript interfaces.
.../orderbook-levels-cache.test.ts, .../orderbook-levels-cache.ts Deleted tests and implementation for getOrderBookMidPrice, affecting mid-price calculations.
.../api-documentation.md, .../swagger.json Removed references to orderbookMidPriceOpen and orderbookMidPriceClose in API documentation and schema.
.../redis-helpers.ts, .../candles-generator.test.ts, .../candles-generator.ts Removed updatePriceLevel function and references to OrderSide and orderbookMidPrice in tests and generator logic.
.../athena-ddl-tables/candles.ts Updated to remove columns for orderbookMidPriceOpen and orderbookMidPriceClose.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Database

    Client->>API: Request Candle Data
    API->>Database: Fetch Candle Data (without Mid Prices)
    Database-->>API: Return Candle Data
    API-->>Client: Respond with Candle Data
Loading

🐰✨ In a garden bright and new,
The candles shine, a simpler view.
No more prices from the book,
Just pure data, take a look!
Hopping high with joy, we sing,
Simplified, it's a lovely thing!
🌼🥕


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6e93e00 and 79345d6.

Files selected for processing (13)
  • indexer/packages/postgres/tests/helpers/constants.ts (1 hunks)
  • indexer/packages/postgres/tests/stores/candle-table.test.ts (1 hunks)
  • indexer/packages/postgres/src/models/candle-model.ts (2 hunks)
  • indexer/packages/postgres/src/types/candle-types.ts (2 hunks)
  • indexer/packages/postgres/src/types/db-model-types.ts (1 hunks)
  • indexer/packages/redis/tests/caches/orderbook-levels-cache.test.ts (2 hunks)
  • indexer/packages/redis/src/caches/orderbook-levels-cache.ts (1 hunks)
  • indexer/services/comlink/public/api-documentation.md (4 hunks)
  • indexer/services/comlink/public/swagger.json (1 hunks)
  • indexer/services/ender/tests/helpers/redis-helpers.ts (2 hunks)
  • indexer/services/ender/tests/lib/candles-generator.test.ts (22 hunks)
  • indexer/services/ender/src/lib/candles-generator.ts (14 hunks)
  • indexer/services/roundtable/src/lib/athena-ddl-tables/candles.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • indexer/services/comlink/public/api-documentation.md
Additional comments not posted (18)
indexer/services/ender/__tests__/helpers/redis-helpers.ts (2)

Line range hint 8-15: LGTM!

The function expectNextFundingRate is correctly implemented.


Line range hint 17-24: LGTM!

The function expectStateFilledQuantums is correctly implemented.

indexer/packages/postgres/src/types/candle-types.ts (2)

Line range hint 3-13: LGTM!

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from CandleCreateObject simplifies the data model.


Line range hint 15-24: LGTM!

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from CandleUpdateObject simplifies the data model.

indexer/services/roundtable/src/lib/athena-ddl-tables/candles.ts (4)

Line range hint 8-18: LGTM!

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from RAW_TABLE_COLUMNS simplifies the table schema.


Line range hint 19-30: LGTM!

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from TABLE_COLUMNS simplifies the table schema.


Line range hint 32-39: LGTM!

The function generateRawTable is correctly implemented.


Line range hint 41-47: LGTM!

The function generateTable is correctly implemented.

indexer/packages/postgres/__tests__/stores/candle-table.test.ts (1)

70-73: LGTM! But verify the consistency of changes.

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from the updatedCandle object is consistent with the updated model. Ensure that these properties are not referenced elsewhere in the test cases.

To verify consistency, search for references to these properties in the test cases.

Verification successful

LGTM!

The removal of orderbookMidPriceOpen and orderbookMidPriceClose from the updatedCandle object is consistent with the updated model. These properties are not referenced elsewhere in the test cases.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the properties `orderbookMidPriceOpen` and `orderbookMidPriceClose` are not referenced elsewhere in the test cases.

# Test: Search for references to the properties. Expect: No occurrences.
rg --type python 'orderbookMidPriceOpen'
rg --type python 'orderbookMidPriceClose'

Length of output: 144


Script:

#!/bin/bash
# Description: Verify that the properties `orderbookMidPriceOpen` and `orderbookMidPriceClose` are not referenced elsewhere in the test cases.

# Test: Search for references to the properties. Expect: No occurrences.
rg 'orderbookMidPriceOpen'
rg 'orderbookMidPriceClose'

Length of output: 54

indexer/services/ender/src/lib/candles-generator.ts (2)

179-181: Verify correctness of function calls after parameter removal.

The removal of the orderbookMidPrice parameter simplifies the function call. Ensure that all calls to createUpdateOrPassPostgresCandle are correct and that the removed parameter does not affect the functionality.

Verification successful

Verified: Function calls are correct after parameter removal.

The removal of the orderbookMidPrice parameter from the createUpdateOrPassPostgresCandle function is consistent across its definition and all calls. There are no issues with the functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `createUpdateOrPassPostgresCandle` are correct.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'createUpdateOrPassPostgresCandle'

Length of output: 1131


Line range hint 203-268:
Verify correctness of method after parameter removal.

The removal of the orderbookMidPrice parameter and its related logic simplifies the method. Ensure that the method functions correctly without the removed parameter and logic.

Verification successful

Verify correctness of method after parameter removal.

The removal of the orderbookMidPrice parameter and its related logic simplifies the createUpdateOrPassPostgresCandle method. The search results confirm that there are no remaining references to orderbookMidPrice in the codebase, indicating that the method functions correctly without the removed parameter and logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `createUpdateOrPassPostgresCandle` method after parameter removal.

# Test: Search for the method implementation. Expect: No references to `orderbookMidPrice`.
rg --type ts -A 20 $'createUpdateOrPassPostgresCandle'

Length of output: 3496


Script:

#!/bin/bash
# Description: Verify the complete removal of `orderbookMidPrice` from the codebase.

# Search for any references to `orderbookMidPrice` in the entire codebase.
rg --type ts 'orderbookMidPrice'

Length of output: 32

indexer/packages/redis/src/caches/orderbook-levels-cache.ts (1)

Line range hint 1-100:
Verify correctness of codebase after function removal.

The removal of the getOrderBookMidPrice function indicates a significant change in functionality. Ensure that no other parts of the codebase rely on this function.

Verification successful

No issues found with the removal of the getOrderBookMidPrice function.

The getOrderBookMidPrice function is not used anywhere else in the codebase, so its removal does not impact other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the codebase after removing the `getOrderBookMidPrice` function.

# Test: Search for the function usage. Expect: No occurrences of `getOrderBookMidPrice`.
rg --type ts -A 5 $'getOrderBookMidPrice'

Length of output: 40


Script:

#!/bin/bash
# Description: Verify the correctness of the codebase after removing the `getOrderBookMidPrice` function.

# Test: Search for the function definition. Expect: No occurrences of `getOrderBookMidPrice`.
rg 'function getOrderBookMidPrice' --type ts

# Test: Search for the function usage. Expect: No occurrences of `getOrderBookMidPrice`.
rg 'getOrderBookMidPrice' --type ts

Length of output: 82

indexer/services/ender/__tests__/lib/candles-generator.test.ts (3)

Line range hint 1-30:
Verify correctness of file after import removal.

The removal of the updatePriceLevel import simplifies the file. Ensure that no other parts of the file rely on this import.

Verification successful

Removal of updatePriceLevel import is correct.

The updatePriceLevel import has been removed from the indexer/services/ender/__tests__/lib/candles-generator.test.ts file, and it is not used within this file. Therefore, the removal is correct and does not impact the file.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the file after removing the `updatePriceLevel` import.

# Test: Search for the import usage. Expect: No occurrences of `updatePriceLevel`.
rg --type ts -A 5 $'updatePriceLevel'

Length of output: 60025


Line range hint 1-30:
Verify correctness of file after import removal.

The removal of the OrderSide import simplifies the file. Ensure that no other parts of the file rely on this import.

Verification successful

Removal of OrderSide import is correct.

The removal of the OrderSide import from indexer/services/ender/__tests__/lib/candles-generator.test.ts does not affect the file as there are no references to OrderSide within it.

  • No occurrences of OrderSide were found in the specific file under review.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the file after removing the `OrderSide` import.

# Test: Search for the import usage. Expect: No occurrences of `OrderSide`.
rg --type ts -A 5 $'OrderSide'

Length of output: 184739


Line range hint 251-337:
Verify correctness of test cases after reference removal.

The removal of references to orderbookMidPriceClose and orderbookMidPriceOpen simplifies the test cases. Ensure that the tests still cover the necessary functionality.

Verification successful

Verify correctness of test cases after reference removal.

The removal of references to orderbookMidPriceClose and orderbookMidPriceOpen simplifies the test cases. The remaining test cases cover various scenarios such as creating candles with no open positions, creating first candles with open interest, and updating existing candles, ensuring comprehensive test coverage.

  • it('successfully creates candles with no open positions', async () => { ...
  • it('successfully creates first candles with open interest', async () => { ...
  • it('successfully updates existing candles', async () => { ...
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the test cases after removing references to `orderbookMidPriceClose` and `orderbookMidPriceOpen`.

# Test: Search for the references in the test file. Expect: No occurrences of `orderbookMidPriceClose` and `orderbookMidPriceOpen`.
rg --type ts -A 5 $'orderbookMidPriceClose'
rg --type ts -A 5 $'orderbookMidPriceOpen'

Length of output: 84


Script:

#!/bin/bash
# Description: List all the test cases in the file to verify their coverage and correctness.

# List all test descriptions in the file to ensure comprehensive test coverage.
rg --type ts 'it\(' --context 3 indexer/services/ender/__tests__/lib/candles-generator.test.ts

Length of output: 1362

indexer/packages/redis/__tests__/caches/orderbook-levels-cache.test.ts (1)

Line range hint 1-1:
Verify the removal of the getOrderBookMidPrice tests.

The removal of the describe('getMidPrice', ...) block significantly reduces the test coverage. Ensure that this functionality is no longer required or has been moved to another location.

Verification successful

Verification complete: The getOrderBookMidPrice function is no longer present in the codebase.

The removal of the describe('getMidPrice', ...) block is justified as the corresponding functionality has been removed from the codebase.

  • No occurrences of the getOrderBookMidPrice function were found in the JavaScript/TypeScript files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the `getOrderBookMidPrice` function is still present in the codebase.

# Test: Search for the function definition. Expect: No occurrences of the function definition.
rg --type python 'def getOrderBookMidPrice'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify if the `getOrderBookMidPrice` function is still present in the codebase.

# Test: Search for the function definition in TypeScript files. Expect: No occurrences of the function definition.
rg --type typescript 'function getOrderBookMidPrice'

Length of output: 89


Script:

#!/bin/bash
# Description: Verify if the `getOrderBookMidPrice` function is still present in the codebase.

# Test: Search for the function definition in JavaScript/TypeScript files. Expect: No occurrences of the function definition.
rg 'function getOrderBookMidPrice' --type js --type ts

Length of output: 56

indexer/packages/postgres/__tests__/helpers/constants.ts (1)

Line range hint 1-1:
Verify the removal of orderbookMidPriceOpen and orderbookMidPriceClose properties.

The removal of these properties simplifies the data model. Ensure that these properties are no longer required or have been moved to another location.

Verification successful

The removal of orderbookMidPriceOpen and orderbookMidPriceClose properties has been verified.

The properties are no longer referenced in the codebase, confirming that their removal simplifies the data model without affecting other parts of the code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the `orderbookMidPriceOpen` and `orderbookMidPriceClose` properties are still referenced in the codebase.

# Test: Search for references to the removed properties. Expect: No occurrences of the properties.
rg --type python 'orderbookMidPriceOpen|orderbookMidPriceClose'

Length of output: 96


Script:

#!/bin/bash
# Description: Verify if the `orderbookMidPriceOpen` and `orderbookMidPriceClose` properties are still referenced in the codebase.

# Test: Search for references to the removed properties. Expect: No occurrences of the properties.
rg 'orderbookMidPriceOpen|orderbookMidPriceClose'

Length of output: 51

indexer/services/comlink/public/swagger.json (1)

Line range hint 1-1:
Verify the removal of orderbookMidPriceOpen and orderbookMidPriceClose properties.

Ensure that all references to these properties are removed from the schema and that their removal does not affect the required properties list.

Verification successful

The properties orderbookMidPriceOpen and orderbookMidPriceClose have been successfully removed from the codebase.

No occurrences of these properties were found in any file types, confirming their complete removal.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of `orderbookMidPriceOpen` and `orderbookMidPriceClose` properties.

# Test: Search for the removed properties. Expect: No occurrences of the removed properties.
rg --type json 'orderbookMidPriceOpen|orderbookMidPriceClose'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the removal of `orderbookMidPriceOpen` and `orderbookMidPriceClose` properties.

# Test: Search for the removed properties in all JSON files. Expect: No occurrences of the removed properties.
rg 'orderbookMidPriceOpen|orderbookMidPriceClose' --type json

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the removal of `orderbookMidPriceOpen` and `orderbookMidPriceClose` properties.

# Test: Search for the removed properties in all file types. Expect: No occurrences of the removed properties.
rg 'orderbookMidPriceOpen|orderbookMidPriceClose'

Length of output: 51

@adamfraser adamfraser merged commit bc140d4 into main Aug 6, 2024
11 checks passed
@adamfraser adamfraser deleted the adam/remove-candles-main branch August 6, 2024 20:28
@coderabbitai coderabbitai bot mentioned this pull request Dec 12, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants