Class SymbolService
java.lang.Object
com.bluebell.greenhouse.radicle.services.AbstractGenericEntityService<Symbol, SymbolRepository>
com.bluebell.greenhouse.radicle.services.symbol.SymbolService
@Service
@Transactional(readOnly=true)
public class SymbolService
extends AbstractGenericEntityService<Symbol, SymbolRepository>
Service-layer for symbols and equities.
- Version:
- 3.0.6
- Author:
- Stephen Prizio
-
Constructor Summary
ConstructorsConstructorDescriptionSymbolService(ExchangeService exchangeService, MarketNewsSentimentService marketNewsSentimentService, MarketPriceRepository marketPriceRepository, PositionRepository positionRepository, SymbolAliasRepository symbolAliasRepository, SymbolAliasService symbolAliasService, SymbolRepository symbolRepository, SymbolSentimentLookupService symbolSentimentLookupService, WatchlistItemService watchlistItemService) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionbooleanassignToSymbol(SymbolAlias toReassign, Symbol existingSymbol) Assigns aSymbolAliasto an existingSymbol.Creates a newSymbolwith the given data.booleandeleteSymbol(Symbol symbol) Deletes the givenSymbol.findExactSymbol(String symbolString, boolean insertUnresolved) Returns aSymbolfor the given symbol string using exact ticker, name, or alias matches only.findSymbol(String symbolString, boolean insertUnresolved) Returns aSymbolfor the given symbol string.findSymbol(String symbolString, String exchangeMic, SymbolType type, boolean insertUnresolved) Returns aSymbolfor the given partial symbol identity.findSymbolByTicker(String ticker, String exchangeMic) Returns the singleSymbolfor the given ticker and exchange MIC, regardless of type.findSymbolByTicker(String ticker, String exchangeMic, SymbolType type) Returns aSymbolfor the given composite symbol identity.findSymbolByUid(String uid) Returns aSymbolfor the given uid.findSymbolsByName(String name) findSymbolsByRevision(SymbolRevision revision) Returns aListof symbols eligible for news lookup.getSymbolSentiment(String ticker, LocalDate start, LocalDate end) Returns EOD-backed sentiment points for the given symbol ticker.getSymbolSentimentSummary(String ticker, LocalDate start, LocalDate end) Returns aggregated EOD-backed sentiment for the given symbol ticker.getTradedSymbolsForAccount(Account account) Obtains a set of equities traded on an account.insertUnresolvedSymbol(String nameOrTicker) Inserts a new symbol into the database with aSymbolRevisionof pending approval.insertUnresolvedSymbol(String nameOrTicker, String exchangeMic, SymbolType type) Inserts a new unresolved symbol into the database with aSymbolRevisionof pending approval.booleanreassignSymbolAsSymbolAlias(Symbol toReassign, Symbol existingSymbol, DataSource dataSource) org.springframework.data.domain.Page<Symbol> searchSymbols(SymbolFilter filter, int page, int pageSize, org.springframework.data.domain.Sort sort) Returns a paginatedPageofSymbols matching the given filter.org.springframework.data.domain.Page<Symbol> searchSymbols(Boolean active, SymbolRevision revision, SymbolType type, String search, int page, int pageSize, org.springframework.data.domain.Sort sort) updateSymbol(Symbol symbol, CreateUpdateSymbolDTO data) Updates an existingSymbol.Methods inherited from class AbstractGenericEntityService
refreshEntity, resolveEntity, resolveEntity, resolveEntity
-
Constructor Details
-
SymbolService
public SymbolService(ExchangeService exchangeService, MarketNewsSentimentService marketNewsSentimentService, MarketPriceRepository marketPriceRepository, PositionRepository positionRepository, SymbolAliasRepository symbolAliasRepository, SymbolAliasService symbolAliasService, SymbolRepository symbolRepository, SymbolSentimentLookupService symbolSentimentLookupService, WatchlistItemService watchlistItemService) Creates the service.- Parameters:
exchangeService-ExchangeServicemarketNewsSentimentService-MarketNewsSentimentServicemarketPriceRepository-MarketPriceRepositorypositionRepository-PositionRepositorysymbolAliasRepository-SymbolAliasRepositorysymbolAliasService-SymbolAliasServicesymbolRepository-SymbolRepositorysymbolSentimentLookupService-SymbolSentimentLookupServicewatchlistItemService-WatchlistItemService
-
-
Method Details
-
findSymbolsByName
-
findSymbolByTicker
Returns aSymbolfor the given composite symbol identity.- Parameters:
ticker- symbol tickerexchangeMic- exchange MICtype-SymbolType- Returns:
- optional
Symbol
-
findSymbolByUid
-
findSymbolByTicker
-
findSymbol
Returns aSymbolfor the given symbol string. Performs a lookup using tickers, names andSymbolAliass and attempts to return the closest matching symbol for the given string.- Parameters:
symbolString- search stringinsertUnresolved- if true, insert an unresolved symbol into the database- Returns:
Symbol
-
findExactSymbol
-
findSymbol
@Transactional public Symbol findSymbol(String symbolString, String exchangeMic, SymbolType type, boolean insertUnresolved) Returns aSymbolfor the given partial symbol identity. When exchange MIC or type are omitted, the search broadens across those dimensions and only returns a result when exactly one symbol matches.- Parameters:
symbolString- search stringexchangeMic- optional exchange MICtype- optionalSymbolTypeinsertUnresolved- if true, insert an unresolved symbol into the database- Returns:
Symbol
-
getTradedSymbolsForAccount
-
findSymbolsByRevision
- Parameters:
revision-SymbolRevision- Returns:
ListofSymbols
-
insertUnresolvedSymbol
Inserts a new symbol into the database with aSymbolRevisionof pending approval.- Parameters:
nameOrTicker- symbol name/ticker- Returns:
Symbolpending review
-
insertUnresolvedSymbol
@Transactional public Symbol insertUnresolvedSymbol(String nameOrTicker, String exchangeMic, SymbolType type) Inserts a new unresolved symbol into the database with aSymbolRevisionof pending approval.- Parameters:
nameOrTicker- symbol name/tickerexchangeMic- optional exchange MICtype- optionalSymbolType- Returns:
Symbolpending review
-
searchSymbols
public org.springframework.data.domain.Page<Symbol> searchSymbols(Boolean active, SymbolRevision revision, SymbolType type, String search, int page, int pageSize, org.springframework.data.domain.Sort sort) - Parameters:
active- is symbol activerevision-SymbolRevisiontype-SymbolTypesearch- symbol searchpage- current pagepageSize- pageSizesort-Sort- Returns:
PageofSymbol
-
searchSymbols
public org.springframework.data.domain.Page<Symbol> searchSymbols(SymbolFilter filter, int page, int pageSize, org.springframework.data.domain.Sort sort) Returns a paginatedPageofSymbols matching the given filter.- Parameters:
filter-SymbolFilterpage- current pagepageSize- page sizesort-Sort- Returns:
PageofSymbol
-
getNewsLookupEligibleSymbols
Returns aListof symbols eligible for news lookup.- Returns:
ListofNewsLookupSymbolDTO
-
getSymbolSentiment
public List<SymbolSentimentPointDTO> getSymbolSentiment(String ticker, LocalDate start, LocalDate end) Returns EOD-backed sentiment points for the given symbol ticker.- Parameters:
ticker- symbol tickerstart- optional start dateend- optional end date- Returns:
ListofSymbolSentimentPointDTO
-
getSymbolSentimentSummary
public SymbolSentimentPointDTO getSymbolSentimentSummary(String ticker, LocalDate start, LocalDate end) Returns aggregated EOD-backed sentiment for the given symbol ticker.- Parameters:
ticker- symbol tickerstart- optional start dateend- optional end date- Returns:
SymbolSentimentPointDTO
-
createNewSymbol
Creates a newSymbolwith the given data.- Parameters:
data-CreateUpdateSymbolDTO- Returns:
- new
Symbol
-
updateSymbol
Updates an existingSymbol.- Parameters:
symbol-Symboldata-CreateUpdateSymbolDTO- Returns:
- updated
Symbol
-
deleteSymbol
-
reassignSymbolAsSymbolAlias
@Transactional public boolean reassignSymbolAsSymbolAlias(Symbol toReassign, Symbol existingSymbol, DataSource dataSource) - Parameters:
toReassign-SymbolexistingSymbol-SymboldataSource-DataSource- Returns:
- true if successful
-
assignToSymbol
Assigns aSymbolAliasto an existingSymbol.- Parameters:
toReassign-SymbolAliasexistingSymbol-Symbol- Returns:
- true if successful
-