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 Details

    • MarketPriceOrchestrator

      public MarketPriceOrchestrator()
  • Method Details

    • searchMarketPrices

      @Transactional(readOnly=true) public PaginatedMarketPriceDTO searchMarketPrices(MarketPriceSearchRequest searchRequest)
      Obtains a page of MarketPrices 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 uid
      priceInterval - price interval code
      startDate - report start
      endDate - report end
      dateTimeFormat - 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 a finally block, 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 uid
      inputStream - uploaded file contents
      fileName - uploaded file name
      priceInterval - price interval
      dateTimeFormat - date-time format
      zoneId - resolved ZoneId
      Throws:
      IOException - when the upload cannot be read
    • createNewMarketPrice

      public MarketPriceDTO createNewMarketPrice(CreateUpdateMarketPriceDTO data)
      Creates a new MarketPrice.
      Parameters:
      data - CreateUpdateMarketPriceDTO
      Returns:
      MarketPriceDTO
    • saveMT4MarketPriceData

      public boolean saveMT4MarketPriceData(MT4MarketData data)
      Saves MT4 market data.
      Parameters:
      data - MT4MarketData
      Returns:
      true when saved
    • updateMarketPrice

      public MarketPriceDTO updateMarketPrice(String uid, CreateUpdateMarketPriceDTO data)
      Updates the MarketPrice matching the given uid.
      Parameters:
      uid - market price uid
      data - CreateUpdateMarketPriceDTO
      Returns:
      MarketPriceDTO
    • deleteMarketPrice

      public void deleteMarketPrice(String uid)
      Deletes the MarketPrice matching 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