Interface AccountRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Account,Long>, org.springframework.data.jpa.repository.JpaRepository<Account, Long>, org.springframework.data.repository.ListCrudRepository<Account, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Account, Long>, org.springframework.data.repository.PagingAndSortingRepository<Account, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Account>, org.springframework.data.repository.Repository<Account, Long>
-
Method Summary
Modifier and TypeMethodDescriptionfindAccountByAccountNumberAndBrokerAndUserUsername(String accountNumber, Broker broker, String username) Obtains anAccountfor the given account number, broker, and owner username.findAccountsByAccountNumberIn(Collection<String> accountNumbers) Returns theAccounts matching the given account numbers.findAccountsByStrategy(Strategy strategy) findAccountsByStrategyAndUser(Strategy strategy, User user) findActiveByPortfolioNumberAndUserId(long portfolioNumber, Long userId) Returns the active accounts in an active portfolio owned by the given user.findOwnedByAccountNumber(String accountNumber, Long userId) Finds the account with the given number owned by the given user.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findAccountByAccountNumberAndBrokerAndUserUsername
-
findAccountsByAccountNumberIn
-
findAccountsByStrategy
-
findAccountsByStrategyAndUser
-
findOwnedByAccountNumber
@Query("SELECT a FROM Account a\nWHERE a.accountNumber = :accountNumber\n AND a.user.id = :userId\n AND a.portfolio.active = true\n") Optional<Account> findOwnedByAccountNumber(@Param("accountNumber") String accountNumber, @Param("userId") Long userId) Finds the account with the given number owned by the given user. -
findActiveByPortfolioNumberAndUserId
@Query("SELECT a FROM Account a\nWHERE a.portfolio.portfolioNumber = :portfolioNumber\n AND a.user.id = :userId\n AND a.portfolio.active = true\n AND a.active = true\n") List<Account> findActiveByPortfolioNumberAndUserId(@Param("portfolioNumber") long portfolioNumber, @Param("userId") Long userId) Returns the active accounts in an active portfolio owned by the given user.- Parameters:
portfolioNumber- portfolio numberuserId- owning user id, null matches nothing- Returns:
- matching active accounts
-
findAccountsWhereLastTimeTradedIsBeyondLookback
@Query("SELECT a FROM Account a WHERE a.lastTraded IS NOT NULL AND a.lastTraded < ?1") List<Account> findAccountsWhereLastTimeTradedIsBeyondLookback(LocalDateTime dateTime) - Parameters:
dateTime-LocalDateTime- Returns:
ListofAccount
-