Skip to content

[chore]: Refactor getMarketNews in StockService #7

@0PrashantYadav0

Description

@0PrashantYadav0

Description

  • Detailed Description:
    The method getMarketNews redundantly checks if a symbol is provided, but the URL constructed is the same regardless of whether the symbol is empty. This redundancy adds unnecessary complexity.
  • How to Solve:
    1. Simplify the Method:
      Remove the conditional and always use the same URL format if no special handling is required:
      public String getMarketNews(String symbol) {
          return scheduleApiRequest(() -> {
              String url = String.format("https://finnhub.io/api/v1/news?category=general&token=%s", FINNHUB_API_KEY);
              return makeFinnhubApiRequest(url);
          });
      }
    2. Test for Consistency:
      Verify that the method behaves as expected and that the response remains unchanged.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions