Skip to content

Add of(...) convenience factory to StockQuotesRequest and OptionsQuotesRequest #17

Description

@MarketDataApp

Every request type in the SDK exposes a paired construction surface:

  • Foo.of(required...) — convenience factory, required args only, all optionals defaulted
  • Foo.builder(required...) — full builder for setting optionals

Two multi-symbol request types are missing the of(...) half of that pair — they only have builder(...):

The varargs sibling StockPricesRequest already has both (StockPricesRequest.java:20), so this is an accidental omission, not a deliberate design choice. A consumer wanting a no-options multi-symbol quote is forced into .builder(...).build() for no reason.

Proposed change

Add a matching convenience factory to both types, mirroring StockPricesRequest.of:

public static StockQuotesRequest of(String first, String... rest) {
    return builder(first, rest).build();
}
public static OptionsQuotesRequest of(String first, String... rest) {
    return builder(first, rest).build();
}

Why now

The API-section docs (MarketDataApp/documentation#154) are standardizing on convenience factories so the Java/Kotlin examples read in 1–3 lines. These two endpoints currently cannot use that pattern and are stuck showing StockQuotesRequest.builder("AAPL", "META", "MSFT").build(). Adding of(...) lets the docs go minimal:

client.stocks().quotes(StockQuotesRequest.of("AAPL", "META", "MSFT")).values().forEach(System.out::println);

Acceptance

  • StockQuotesRequest.of(String first, String... rest) added
  • OptionsQuotesRequest.of(String first, String... rest) added
  • Unit tests cover the new factories (parity with StockPricesRequest test coverage)
  • No other request type is missing its of(...) pair (sweep to confirm this is the last gap)

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions