Class MarketPriceOrchestrator
java.lang.Object
com.bluebell.greenhouse.planter.orchestrators.market.price.MarketPriceOrchestrator
- All Implemented Interfaces:
GenericOrchestrator
@Service
@Transactional
public class MarketPriceOrchestrator
extends Object
implements GenericOrchestrator
Owns the unit of work for the
MarketPrice endpoints.- Version:
- 3.0.6
- Author:
- Stephen Prizio
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a newMarketPrice.voiddeleteMarketPrice(String uid) Deletes theMarketPricematching the given uid.generateMarketPriceReport(String symbolAliasUid, MarketTimeInterval priceInterval, LocalDateTime startDate, LocalDateTime endDate, String dateTimeFormat) Generates the downloadable market price report for a symbol alias.voidimportMarketPrices(String symbolAliasUid, InputStream inputStream, String fileName, MarketTimeInterval priceInterval, String dateTimeFormat, ZoneId zoneId) Imports market prices for a symbol alias.refreshFirstRateData(String actor) Queues the FirstRateData refresh job and returns the identity of the queued attempt.booleanSaves MT4 market data.searchMarketPrices(MarketPriceSearchRequest searchRequest) Obtains a page ofMarketPrices matching the given search request.updateMarketPrice(String uid, CreateUpdateMarketPriceDTO data) Updates theMarketPricematching the given uid.
-
Constructor Details
-
MarketPriceOrchestrator
public MarketPriceOrchestrator()
-
-
Method Details
-
searchMarketPrices
@Transactional(readOnly=true) public PaginatedMarketPriceDTO searchMarketPrices(MarketPriceSearchRequest searchRequest) Obtains a page ofMarketPrices matching the given search request.- Parameters:
searchRequest- paged market price search request- Returns:
PaginatedMarketPriceDTO
-
generateMarketPriceReport
@Transactional(readOnly=true) public File generateMarketPriceReport(String symbolAliasUid, MarketTimeInterval priceInterval, LocalDateTime startDate, LocalDateTime endDate, String dateTimeFormat) throws IOException Generates the downloadable market price report for a symbol alias.- Parameters:
symbolAliasUid- symbol alias uidpriceInterval- price interval codestartDate- report startendDate- report enddateTimeFormat- date-time format- Returns:
- generated
File - Throws:
IOException- when the report cannot be written
-
importMarketPrices
@Transactional(rollbackFor=IOException.class) public void importMarketPrices(String symbolAliasUid, InputStream inputStream, String fileName, MarketTimeInterval priceInterval, String dateTimeFormat, ZoneId zoneId) throws IOException Imports market prices for a symbol alias.Rolls back on
IOException: the importers persist their rows and then delete the temporary upload in afinallyblock, so a checked exception can reach this method after the writes. Spring rolls back only on unchecked exceptions by default, which would commit a half-imported file.- Parameters:
symbolAliasUid- symbol alias uidinputStream- uploaded file contentsfileName- uploaded file namepriceInterval- price intervaldateTimeFormat- date-time formatzoneId- resolvedZoneId- Throws:
IOException- when the upload cannot be read
-
createNewMarketPrice
Creates a newMarketPrice.- Parameters:
data-CreateUpdateMarketPriceDTO- Returns:
MarketPriceDTO
-
saveMT4MarketPriceData
Saves MT4 market data.- Parameters:
data-MT4MarketData- Returns:
- true when saved
-
updateMarketPrice
Updates theMarketPricematching the given uid.- Parameters:
uid- market price uiddata-CreateUpdateMarketPriceDTO- Returns:
MarketPriceDTO
-
deleteMarketPrice
Deletes theMarketPricematching the given uid.- Parameters:
uid- market price uid
-
refreshFirstRateData
@Transactional(propagation=NOT_SUPPORTED) public JobSubmissionDTO refreshFirstRateData(String actor) Queues the FirstRateData refresh job and returns the identity of the queued attempt.- Parameters:
actor- initiating actor- Returns:
- the committed submission
-