Skip to content

[BFP-1263] Introduce GET v1/account/fundingRateHistory#41

Merged
kevin-ip merged 2 commits intomainfrom
kevin/BFP-1263-introduce-funding-history-endpoint
Mar 27, 2025
Merged

[BFP-1263] Introduce GET v1/account/fundingRateHistory#41
kevin-ip merged 2 commits intomainfrom
kevin/BFP-1263-introduce-funding-history-endpoint

Conversation

@kevin-ip
Copy link
Copy Markdown
Contributor

@kevin-ip kevin-ip commented Mar 27, 2025

User description

GET /v1/account/fundingRateHistory?accountAddress=0x1234&page=1&limit=100

Response:

{
   data: [
   {
     payment_amount_e9: string
     symbol: string
     executed_at: integer
     computed_at: integer
   },
   ...
   ],
}

PR Type

Enhancement, Documentation, Tests


Description

  • Introduced a new API endpoint GET /v1/account/fundingRateHistory to fetch funding rate history.

    • Added query parameters for accountAddress, limit, and page.
    • Defined response structure with AccountFundingRateHistory and AccountFundingRateHistoryData.
  • Updated SDKs (TypeScript, Rust, Python) to support the new endpoint.

    • Added models and methods for AccountFundingRateHistory and AccountFundingRateHistoryData.
    • Integrated the new endpoint in API client classes.
  • Added comprehensive documentation for the new endpoint and models.

    • Updated OpenAPI specifications and generated documentation files.
  • Implemented unit tests for the new models in Python SDK.


Changes walkthrough 📝

Relevant files
Enhancement
9 files
api.ts
Add funding rate history API support in TypeScript SDK     
+140/-0 
account_data_api.rs
Add funding rate history API support in Rust SDK                 
+51/-0   
account_funding_rate_history.rs
Add `AccountFundingRateHistory` model in Rust SDK               
+27/-0   
account_funding_rate_history_data.rs
Add `AccountFundingRateHistoryData` model in Rust SDK       
+44/-0   
mod.rs
Register funding rate history models in Rust SDK                 
+4/-0     
__init__.py
Register funding rate history models in Python SDK             
+2/-0     
account_data_api.py
Add funding rate history API support in Python SDK             
+307/-0 
account_funding_rate_history.py
Add `AccountFundingRateHistory` model in Python SDK           
+95/-0   
account_funding_rate_history_data.py
Add `AccountFundingRateHistoryData` model in Python SDK   
+95/-0   
Tests
2 files
test_account_funding_rate_history.py
Add unit tests for `AccountFundingRateHistory` model         
+66/-0   
test_account_funding_rate_history_data.py
Add unit tests for `AccountFundingRateHistoryData` model 
+59/-0   
Documentation
9 files
FILES
Update OpenAPI generator files for funding rate history   
+4/-0     
AccountDataApi.md
Document funding rate history API in Python SDK                   
+85/-0   
AccountFundingRateHistory.md
Add documentation for `AccountFundingRateHistory` model   
+29/-0   
AccountFundingRateHistoryData.md
Add documentation for `AccountFundingRateHistoryData` model
+33/-0   
openapi_client_README.md
Update Python SDK README for funding rate history               
+3/-0     
account-data-api.yaml
Define funding rate history API in OpenAPI spec                   
+103/-0 
bluefin-api.yaml
Reference funding rate history API in main OpenAPI spec   
+2/-0     
FILES
Update OpenAPI generator files for Rust SDK                           
+4/-0     
AccountDataApi.md
Document funding rate history API in Rust SDK                       
+31/-0   
Additional files
4 files
__init__.py +2/-0     
README.md +3/-0     
AccountFundingRateHistory.md +11/-0   
AccountFundingRateHistoryData.md +15/-0   

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @kevin-ip kevin-ip requested a review from a team March 27, 2025 14:34
    @qodo-code-review
    Copy link
    Copy Markdown

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Test Implementation

    The test file for AccountFundingRateHistoryData has commented-out test implementation. The test methods are defined but not actually executed, which means there's no validation of the model functionality.

    # uncomment below to create an instance of `AccountFundingRateHistoryData`
    """
    model = AccountFundingRateHistoryData()
    if include_optional:
        return AccountFundingRateHistoryData(
            id = '9689322392',
            payment_amount_e9 = '1000000',
            symbol = '0x123456789abcdef',
            executed_at = 1569514978020,
            computed_at = 1569514978020
        )
    else:
        return AccountFundingRateHistoryData(
            id = '9689322392',
            payment_amount_e9 = '1000000',
            executed_at = 1569514978020,
            computed_at = 1569514978020,
    )
    """
    Field Documentation

    The 'symbol' field is documented as "Market address" which may be confusing since it's named 'symbol' but described as an address. Consider clarifying the documentation or renaming the field for consistency.

    payment_amount_e9: StrictStr = Field(description="Payment amount in e9 format.")
    symbol: StrictStr = Field(description="Market address.")
    executed_at: StrictInt = Field(description="Execution timestamp in milliseconds since Unix epoch.")

    @qodo-code-review
    Copy link
    Copy Markdown

    qodo-code-review Bot commented Mar 27, 2025

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Remove redundant variable assignments

    The function is unnecessarily creating new variables with a prefix for the
    parameters. This is redundant since there are no name collisions in the function
    scope. You can use the original parameters directly in the query building.

    rust/gen/bluefin_api/src/apis/account_data_api.rs [101-105]

     pub async fn get_account_funding_rate_history(configuration: &configuration::Configuration, account_address: Option<&str>, limit: Option<u32>, page: Option<u32>) -> Result<models::AccountFundingRateHistory, Error<GetAccountFundingRateHistoryError>> {
    -    // add a prefix to parameters to efficiently prevent name collisions
    -    let p_account_address = account_address;
    -    let p_limit = limit;
    -    let p_page = page;
    +    let uri_str = format!("{}/api/v1/account/fundingRateHistory", configuration.base_path);
    +    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
     
    +    if let Some(ref param_value) = account_address {
    +        req_builder = req_builder.query(&[("accountAddress", &param_value.to_string())]);
    +    }
    +    if let Some(ref param_value) = limit {
    +        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    +    }
    +    if let Some(ref param_value) = page {
    +        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    +    }
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 3

    __

    Why: The suggestion correctly identifies unnecessary variable assignments that add no value. The code creates prefixed variables (p_account_address, p_limit, p_page) that are simply aliases to the function parameters, but these variables don't prevent any name collisions since there are no conflicting names in the function scope. Removing them makes the code cleaner but has minimal impact on functionality.

    Low
    • Update

    @kevin-ip kevin-ip force-pushed the kevin/BFP-1263-introduce-funding-history-endpoint branch from bfc58ec to 3615c69 Compare March 27, 2025 17:10
    @kevin-ip kevin-ip merged commit a68fec8 into main Mar 27, 2025
    @kevin-ip kevin-ip deleted the kevin/BFP-1263-introduce-funding-history-endpoint branch March 27, 2025 17:16
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants