Package com.longbridge.portfolio
Class PortfolioContext
- java.lang.Object
-
- com.longbridge.portfolio.PortfolioContext
-
- All Implemented Interfaces:
AutoCloseable
public class PortfolioContext extends Object implements AutoCloseable
Portfolio analytics context — exchange rates, P&L analysis.
-
-
Constructor Summary
Constructors Constructor Description PortfolioContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static PortfolioContextcreate(Config config)CompletableFuture<ExchangeRates>getExchangeRate()Get exchange rates for supported currencies.CompletableFuture<ProfitAnalysis>getProfitAnalysis(ProfitAnalysisOptions opts)Get portfolio P&L analysis (summary and per-security breakdown).CompletableFuture<ProfitAnalysisByMarket>getProfitAnalysisByMarket(ProfitAnalysisByMarketOptions opts)Get paginated P&L analysis filtered by market.CompletableFuture<ProfitAnalysisDetail>getProfitAnalysisDetail(ProfitAnalysisDetailOptions opts)Get P&L detail for a specific security.CompletableFuture<ProfitAnalysisFlowsResponse>getProfitAnalysisFlows(ProfitAnalysisFlowsOptions opts)Get paginated profit-analysis flow records for a security.
-
-
-
Method Detail
-
create
public static PortfolioContext create(Config config)
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getExchangeRate
public CompletableFuture<ExchangeRates> getExchangeRate() throws OpenApiException
Get exchange rates for supported currencies.- Returns:
- A Future resolving to the current exchange rates
- Throws:
OpenApiException- If an error occurs
-
getProfitAnalysis
public CompletableFuture<ProfitAnalysis> getProfitAnalysis(ProfitAnalysisOptions opts) throws OpenApiException
Get portfolio P&L analysis (summary and per-security breakdown).- Parameters:
opts- Date range options (start, end)- Returns:
- A Future resolving to the profit/loss analysis
- Throws:
OpenApiException- If an error occurs
-
getProfitAnalysisDetail
public CompletableFuture<ProfitAnalysisDetail> getProfitAnalysisDetail(ProfitAnalysisDetailOptions opts) throws OpenApiException
Get P&L detail for a specific security.- Parameters:
opts- Query options (symbol, start date, end date)- Returns:
- A Future resolving to the security-level profit/loss detail
- Throws:
OpenApiException- If an error occurs
-
getProfitAnalysisByMarket
public CompletableFuture<ProfitAnalysisByMarket> getProfitAnalysisByMarket(ProfitAnalysisByMarketOptions opts) throws OpenApiException
Get paginated P&L analysis filtered by market.- Parameters:
opts- Query options (market, start, end, currency, page, size)- Returns:
- A Future resolving to the paginated market-level analysis
- Throws:
OpenApiException- If an error occurs
-
getProfitAnalysisFlows
public CompletableFuture<ProfitAnalysisFlowsResponse> getProfitAnalysisFlows(ProfitAnalysisFlowsOptions opts) throws OpenApiException
Get paginated profit-analysis flow records for a security.- Parameters:
opts- Query options (symbol, page, size, includeOutsideRth, start, end)- Returns:
- A Future resolving to the flow records and pagination flag
- Throws:
OpenApiException- If an error occurs
-
-