Interface SymbolRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Symbol,Long>, org.springframework.data.jpa.repository.JpaRepository<Symbol,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Symbol>, org.springframework.data.repository.ListCrudRepository<Symbol,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Symbol,Long>, org.springframework.data.repository.PagingAndSortingRepository<Symbol,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Symbol>, org.springframework.data.repository.Repository<Symbol,Long>

@Repository public interface SymbolRepository extends org.springframework.data.jpa.repository.JpaRepository<Symbol,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Symbol>
Data-access layer for Symbol.
Version:
3.0.6
Author:
Stephen Prizio
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    findSymbolByIdentity(String ticker, String exchangeMic, SymbolType type)
    Returns a Symbol for the given composite symbol identity.
    Returns a List of Symbols for the given name.
    Returns a List of Symbols for the given SymbolRevision.
    Returns a List of Symbols for the given ticker.
    Returns a List of Symbols for the given ticker and exchange MIC.
    int
    upsertSymbol(String name, String ticker, String description, String website, boolean active, String type, String revision, Long exchangeId)
    Inserts or updates an existing Symbol.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, update

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findSymbolsByName

      List<Symbol> findSymbolsByName(String name)
      Returns a List of Symbols for the given name.
      Parameters:
      name - name
      Returns:
      List of Symbols
    • findSymbolsByTicker

      @Query("SELECT s\nFROM Symbol s\nWHERE LOWER(s.ticker) = LOWER(:ticker)\n") List<Symbol> findSymbolsByTicker(@Param("ticker") String ticker)
      Returns a List of Symbols for the given ticker.
      Parameters:
      ticker - symbol id, ticker
      Returns:
      List of Symbols
    • findSymbolsByTickerAndExchangeMic

      @Query("SELECT s\nFROM Symbol s\nJOIN s.exchange e\nWHERE LOWER(s.ticker) = LOWER(:ticker)\n AND LOWER(e.mic) = LOWER(:exchangeMic)\n") List<Symbol> findSymbolsByTickerAndExchangeMic(@Param("ticker") String ticker, @Param("exchangeMic") String exchangeMic)
      Returns a List of Symbols for the given ticker and exchange MIC.
      Parameters:
      ticker - symbol ticker
      exchangeMic - exchange MIC
      Returns:
      List of Symbols
    • findSymbolByIdentity

      @Query("SELECT s\nFROM Symbol s\nJOIN s.exchange e\nWHERE LOWER(s.ticker) = LOWER(:ticker)\n AND LOWER(e.mic) = LOWER(:exchangeMic)\n AND s.type = :type\n") Optional<Symbol> findSymbolByIdentity(@Param("ticker") String ticker, @Param("exchangeMic") String exchangeMic, @Param("type") SymbolType type)
      Returns a Symbol for the given composite symbol identity.
      Parameters:
      ticker - symbol ticker
      exchangeMic - exchange MIC
      type - SymbolType
      Returns:
      optional Symbol
    • findSymbolsByRevision

      List<Symbol> findSymbolsByRevision(SymbolRevision revision)
      Returns a List of Symbols for the given SymbolRevision.
      Parameters:
      revision - SymbolRevision
      Returns:
      List of Symbols
    • upsertSymbol

      @Modifying(flushAutomatically=true) @Transactional @Query(value=" INSERT INTO symbols (\n name,\n ticker,\n description,\n website,\n active,\n type,\n revision,\n exchange_id\n )\n VALUES (\n :name,\n :ticker,\n :description,\n :website,\n :active,\n :type,\n :revision,\n :exchangeId\n )\n ON CONFLICT (ticker, exchange_id, type)\n DO UPDATE SET\n name = EXCLUDED.name,\n description = EXCLUDED.description,\n website = EXCLUDED.website,\n active = EXCLUDED.active,\n revision = EXCLUDED.revision,\n modified_at = GREATEST(\n symbols.created_at,\n clock_timestamp() AT TIME ZONE 'UTC'\n )\n WHERE\n symbols.name IS DISTINCT FROM EXCLUDED.name\n OR symbols.description IS DISTINCT FROM EXCLUDED.description\n OR symbols.website IS DISTINCT FROM EXCLUDED.website\n OR symbols.active IS DISTINCT FROM EXCLUDED.active\n OR symbols.revision IS DISTINCT FROM EXCLUDED.revision\n", nativeQuery=true) int upsertSymbol(@Param("name") String name, @Param("ticker") String ticker, @Param("description") String description, @Param("website") String website, @Param("active") boolean active, @Param("type") String type, @Param("revision") String revision, @Param("exchangeId") Long exchangeId)
      Inserts or updates an existing Symbol.
      Parameters:
      name - symbol name
      ticker - symbol ticker
      description - description
      website - website
      active - active
      type - type
      revision - revision
      exchangeId - exchange id
      Returns:
      number of entries inserted or updated