Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/main/java/dev/sorn/fmp4j/clients/FmpBulkClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_PERIOD;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_YEAR;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpBalanceSheetStatement;
Expand Down Expand Up @@ -37,20 +40,20 @@ public synchronized FmpCompanies[] companies(FmpPart part) {
}

public synchronized FmpBalanceSheetStatement[] balanceSheetStatements(FmpYear year, FmpPeriod period) {
fmpBulkBalanceSheetService.param("year", year);
fmpBulkBalanceSheetService.param("period", period);
fmpBulkBalanceSheetService.param(PARAM_YEAR, year);
fmpBulkBalanceSheetService.param(PARAM_PERIOD, period);
return fmpBulkBalanceSheetService.download();
}

public synchronized FmpCashFlowStatement[] cashFlowStatements(FmpYear year, FmpPeriod period) {
fmpBulkCashFlowService.param("year", year);
fmpBulkCashFlowService.param("period", period);
fmpBulkCashFlowService.param(PARAM_YEAR, year);
fmpBulkCashFlowService.param(PARAM_PERIOD, period);
return fmpBulkCashFlowService.download();
}

public synchronized FmpCashFlowStatementGrowth[] cashFlowStatementGrowth(FmpYear year, FmpPeriod period) {
fmpBulkCashFlowStatementGrowthService.param("year", year);
fmpBulkCashFlowStatementGrowthService.param("period", period);
fmpBulkCashFlowStatementGrowthService.param(PARAM_YEAR, year);
fmpBulkCashFlowStatementGrowthService.param(PARAM_PERIOD, period);
return fmpBulkCashFlowStatementGrowthService.download();
}
}
22 changes: 13 additions & 9 deletions src/main/java/dev/sorn/fmp4j/clients/FmpCalendarClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_FROM;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_TO;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpDividend;
Expand Down Expand Up @@ -55,7 +59,7 @@ public synchronized FmpDividendsCalendar[] dividends() {
}

public synchronized FmpDividend[] dividends(FmpSymbol symbol) {
fmpDividendService.param("symbol", symbol);
fmpDividendService.param(PARAM_SYMBOL, symbol);
return fmpDividendService.download();
}

Expand All @@ -64,25 +68,25 @@ public synchronized FmpEarningsCalendar[] earnings() {
}

public synchronized FmpEarning[] earnings(FmpSymbol symbol) {
fmpEarningsService.param("symbol", symbol);
fmpEarningsService.param(PARAM_SYMBOL, symbol);
return fmpEarningsService.download();
}

public synchronized FmpIposCalendar[] ipos(Optional<LocalDate> from, Optional<LocalDate> to) {
fmpIposCalendarService.param("from", from);
fmpIposCalendarService.param("to", to);
fmpIposCalendarService.param(PARAM_FROM, from);
fmpIposCalendarService.param(PARAM_TO, to);
return fmpIposCalendarService.download();
}

public synchronized FmpIposDisclosure[] disclosures(Optional<LocalDate> from, Optional<LocalDate> to) {
fmpIposDisclosureService.param("from", from);
fmpIposDisclosureService.param("to", to);
fmpIposDisclosureService.param(PARAM_FROM, from);
fmpIposDisclosureService.param(PARAM_TO, to);
return fmpIposDisclosureService.download();
}

public synchronized FmpIposProspectus[] prospectus(Optional<LocalDate> from, Optional<LocalDate> to) {
fmpIposProspectusService.param("from", from);
fmpIposProspectusService.param("to", to);
fmpIposProspectusService.param(PARAM_FROM, from);
fmpIposProspectusService.param(PARAM_TO, to);
return fmpIposProspectusService.download();
}

Expand All @@ -91,7 +95,7 @@ public synchronized FmpSplitsCalendar[] splits() {
}

public synchronized FmpSplit[] splits(FmpSymbol symbol) {
fmpSplitService.param("symbol", symbol);
fmpSplitService.param(PARAM_SYMBOL, symbol);
return fmpSplitService.download();
}
}
51 changes: 27 additions & 24 deletions src/main/java/dev/sorn/fmp4j/clients/FmpChartClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import static dev.sorn.fmp4j.types.FmpInterval.ONE_HOUR;
import static dev.sorn.fmp4j.types.FmpInterval.ONE_MINUTE;
import static dev.sorn.fmp4j.types.FmpInterval.THIRTY_MINUTE;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_FROM;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_TO;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
Expand Down Expand Up @@ -48,57 +51,57 @@ public FmpChartClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {

public synchronized FmpHistoricalPriceEodLight[] historicalPriceEodLight(
FmpSymbol symbol, Optional<LocalDate> from, Optional<LocalDate> to) {
fmpHistoricalPriceEodLightService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalPriceEodLightService.param("from", date));
to.ifPresent(date -> fmpHistoricalPriceEodLightService.param("to", date));
fmpHistoricalPriceEodLightService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalPriceEodLightService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalPriceEodLightService.param(PARAM_TO, date));
return fmpHistoricalPriceEodLightService.download();
}

public synchronized FmpHistoricalPriceEodFull[] historicalPriceEodFull(
FmpSymbol symbol, Optional<LocalDate> from, Optional<LocalDate> to) {
fmpHistoricalPriceEodFullService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalPriceEodFullService.param("from", date));
to.ifPresent(date -> fmpHistoricalPriceEodFullService.param("to", date));
fmpHistoricalPriceEodFullService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalPriceEodFullService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalPriceEodFullService.param(PARAM_TO, date));
return fmpHistoricalPriceEodFullService.download();
}

public synchronized FmpHistoricalChart[] historical(
FmpSymbol symbol, FmpInterval interval, Optional<LocalDate> from, Optional<LocalDate> to) {
return switch (interval) {
case ONE_MINUTE -> {
fmpHistoricalChartService1MinService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService1MinService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService1MinService.param("to", date));
fmpHistoricalChartService1MinService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService1MinService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService1MinService.param(PARAM_TO, date));
yield fmpHistoricalChartService1MinService.download();
}
case FIVE_MINUTE -> {
fmpHistoricalChartService5MinService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService5MinService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService5MinService.param("to", date));
fmpHistoricalChartService5MinService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService5MinService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService5MinService.param(PARAM_TO, date));
yield fmpHistoricalChartService5MinService.download();
}
case FIFTEEN_MINUTE -> {
fmpHistoricalChartService15MinService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService15MinService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService15MinService.param("to", date));
fmpHistoricalChartService15MinService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService15MinService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService15MinService.param(PARAM_TO, date));
yield fmpHistoricalChartService15MinService.download();
}
case THIRTY_MINUTE -> {
fmpHistoricalChartService30MinService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService30MinService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService30MinService.param("to", date));
fmpHistoricalChartService30MinService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService30MinService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService30MinService.param(PARAM_TO, date));
yield fmpHistoricalChartService30MinService.download();
}
case ONE_HOUR -> {
fmpHistoricalChartService1HourService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService1HourService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService1HourService.param("to", date));
fmpHistoricalChartService1HourService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService1HourService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService1HourService.param(PARAM_TO, date));
yield fmpHistoricalChartService1HourService.download();
}
case FOUR_HOUR -> {
fmpHistoricalChartService4HourService.param("symbol", symbol);
from.ifPresent(date -> fmpHistoricalChartService4HourService.param("from", date));
to.ifPresent(date -> fmpHistoricalChartService4HourService.param("to", date));
fmpHistoricalChartService4HourService.param(PARAM_SYMBOL, symbol);
from.ifPresent(date -> fmpHistoricalChartService4HourService.param(PARAM_FROM, date));
to.ifPresent(date -> fmpHistoricalChartService4HourService.param(PARAM_TO, date));
yield fmpHistoricalChartService4HourService.download();
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/dev/sorn/fmp4j/clients/FmpCompanyClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpCompany;
Expand All @@ -17,7 +19,7 @@ public FmpCompanyClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {
}

public synchronized FmpCompany[] bySymbol(FmpSymbol symbol) {
fmpCompanyService.param("symbol", symbol);
fmpCompanyService.param(PARAM_SYMBOL, symbol);
return fmpCompanyService.download();
}
}
19 changes: 12 additions & 7 deletions src/main/java/dev/sorn/fmp4j/clients/FmpEarningsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import static dev.sorn.fmp4j.types.FmpLimit.limit;
import static dev.sorn.fmp4j.types.FmpPage.page;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_LIMIT;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_PAGE;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_QUARTER;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_YEAR;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
Expand Down Expand Up @@ -40,21 +45,21 @@ public FmpEarningsClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {

public synchronized FmpEarningsCallTranscript[] transcripts(
FmpSymbol symbol, FmpYear year, FmpQuarter quarter, Optional<FmpLimit> limit) {
fmpEarningsCallTranscriptService.param("symbol", symbol);
fmpEarningsCallTranscriptService.param("year", year);
fmpEarningsCallTranscriptService.param("quarter", quarter);
limit.ifPresent(l -> fmpEarningsCallTranscriptService.param("limit", l));
fmpEarningsCallTranscriptService.param(PARAM_SYMBOL, symbol);
fmpEarningsCallTranscriptService.param(PARAM_YEAR, year);
fmpEarningsCallTranscriptService.param(PARAM_QUARTER, quarter);
limit.ifPresent(l -> fmpEarningsCallTranscriptService.param(PARAM_LIMIT, l));
return fmpEarningsCallTranscriptService.download();
}

public synchronized FmpEarningsCallTranscriptDate[] dates(FmpSymbol symbol) {
fmpEarningsCallTranscriptDatesService.param("symbol", symbol);
fmpEarningsCallTranscriptDatesService.param(PARAM_SYMBOL, symbol);
return fmpEarningsCallTranscriptDatesService.download();
}

public synchronized FmpEarningsCallTranscriptLatest[] latest(Optional<FmpLimit> limit, Optional<FmpPage> page) {
fmpEarningsCallTranscriptLatestService.param("limit", limit.orElse(limit(100)));
fmpEarningsCallTranscriptLatestService.param("page", page.orElse(page(0)));
fmpEarningsCallTranscriptLatestService.param(PARAM_LIMIT, limit.orElse(limit(100)));
fmpEarningsCallTranscriptLatestService.param(PARAM_PAGE, page.orElse(page(0)));
return fmpEarningsCallTranscriptLatestService.download();
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/dev/sorn/fmp4j/clients/FmpEconomicsClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_FROM;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_TO;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpTreasuryRate;
Expand All @@ -15,8 +18,8 @@ public FmpEconomicsClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {
}

public synchronized FmpTreasuryRate[] treasuryRates(LocalDate from, LocalDate to) {
fmpTreasuryRatesService.param("from", from);
fmpTreasuryRatesService.param("to", to);
fmpTreasuryRatesService.param(PARAM_FROM, from);
fmpTreasuryRatesService.param(PARAM_TO, to);
return fmpTreasuryRatesService.download();
}
}
12 changes: 7 additions & 5 deletions src/main/java/dev/sorn/fmp4j/clients/FmpEtfClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpEtfAssetExposure;
Expand Down Expand Up @@ -32,27 +34,27 @@ public FmpEtfClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {
}

public synchronized FmpEtfAssetExposure[] assetExposure(FmpSymbol symbol) {
etfAssetExposureService.param("symbol", symbol);
etfAssetExposureService.param(PARAM_SYMBOL, symbol);
return etfAssetExposureService.download();
}

public synchronized FmpEtfCountryWeighting[] countryWeightings(FmpSymbol symbol) {
etfCountryWeightingService.param("symbol", symbol);
etfCountryWeightingService.param(PARAM_SYMBOL, symbol);
return etfCountryWeightingService.download();
}

public synchronized FmpEtfHolding[] holdings(FmpSymbol symbol) {
etfHoldingService.param("symbol", symbol);
etfHoldingService.param(PARAM_SYMBOL, symbol);
return etfHoldingService.download();
}

public synchronized FmpEtfInfo[] info(FmpSymbol symbol) {
etfInfoService.param("symbol", symbol);
etfInfoService.param(PARAM_SYMBOL, symbol);
return etfInfoService.download();
}

public synchronized FmpEtfSectorWeighting[] sectorWeightings(FmpSymbol symbol) {
etfSectorWeightingService.param("symbol", symbol);
etfSectorWeightingService.param(PARAM_SYMBOL, symbol);
return etfSectorWeightingService.download();
}
}
15 changes: 10 additions & 5 deletions src/main/java/dev/sorn/fmp4j/clients/FmpNewsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import static dev.sorn.fmp4j.types.FmpLimit.limit;
import static dev.sorn.fmp4j.types.FmpPage.page;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_FROM;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_LIMIT;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_PAGE;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOLS;
import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_TO;
import static java.util.Optional.empty;

import dev.sorn.fmp4j.cfg.FmpConfig;
Expand Down Expand Up @@ -75,11 +80,11 @@ protected synchronized FmpNews[] news(
Optional<LocalDate> to,
Optional<FmpPage> page,
Optional<FmpLimit> limit) {
service.param("symbols", symbols);
from.ifPresent(date -> service.param("from", date));
to.ifPresent(date -> service.param("to", date));
service.param("page", page.orElse(page(0)));
service.param("limit", limit.orElse(limit(100)));
service.param(PARAM_SYMBOLS, symbols);
from.ifPresent(date -> service.param(PARAM_FROM, date));
to.ifPresent(date -> service.param(PARAM_TO, date));
service.param(PARAM_PAGE, page.orElse(page(0)));
service.param(PARAM_LIMIT, limit.orElse(limit(100)));
return service.download();
}
}
8 changes: 5 additions & 3 deletions src/main/java/dev/sorn/fmp4j/clients/FmpQuoteClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOL;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpFullQuote;
Expand All @@ -23,17 +25,17 @@ public FmpQuoteClient(FmpConfig fmpConfig, FmpHttpClient fmpHttpClient) {
}

public synchronized FmpFullQuote[] full(FmpSymbol symbol) {
quoteService.param("symbol", symbol);
quoteService.param(PARAM_SYMBOL, symbol);
return quoteService.download();
}

public synchronized FmpPartialQuote[] partial(FmpSymbol symbol) {
shortQuoteService.param("symbol", symbol);
shortQuoteService.param(PARAM_SYMBOL, symbol);
return shortQuoteService.download();
}

public synchronized FmpStockPriceChange[] priceChange(FmpSymbol symbol) {
stockPriceChangeService.param("symbol", symbol);
stockPriceChangeService.param(PARAM_SYMBOL, symbol);
return stockPriceChangeService.download();
}
}
4 changes: 3 additions & 1 deletion src/main/java/dev/sorn/fmp4j/clients/FmpSearchClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.sorn.fmp4j.clients;

import static dev.sorn.fmp4j.utils.FmpParameters.PARAM_SYMBOLS;

import dev.sorn.fmp4j.cfg.FmpConfig;
import dev.sorn.fmp4j.http.FmpHttpClient;
import dev.sorn.fmp4j.models.FmpSearchByCik;
Expand Down Expand Up @@ -65,7 +67,7 @@ public synchronized FmpSearchBySymbol[] bySymbol(FmpSymbol query) {
}

public synchronized FmpSearchPressRelease[] pressReleases(FmpSymbol symbol) {
fmpSearchPressReleasesService.param("symbols", symbol);
fmpSearchPressReleasesService.param(PARAM_SYMBOLS, symbol);
return fmpSearchPressReleasesService.download();
}
}
Loading
Loading