Interface PositionService
-
- All Known Implementing Classes:
PositionServiceImplementation
public interface PositionService
Service allowing to create and retrieve positions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PositionCreationResultDTO
createPosition(CurrencyPairDTO currencyPair, BigDecimal amount, PositionRulesDTO rules)
Creates a position with its associated rules.HashMap<CurrencyDTO,GainDTO>
getGains()
Return the gains made by all positions.Optional<PositionDTO>
getPositionById(long id)
Get position by id.Set<PositionDTO>
getPositions()
Get positions.void
restorePosition(PositionDTO position)
Restore position.void
tickerUpdate(TickerDTO ticker)
Method called by streams at every ticker update.void
tradeUpdate(TradeDTO trade)
Method called by streams on every trade update.
-
-
-
Method Detail
-
getPositions
Set<PositionDTO> getPositions()
Get positions.- Returns:
- position list
-
getPositionById
Optional<PositionDTO> getPositionById(long id)
Get position by id.- Parameters:
id
- id- Returns:
- position
-
createPosition
PositionCreationResultDTO createPosition(CurrencyPairDTO currencyPair, BigDecimal amount, PositionRulesDTO rules)
Creates a position with its associated rules.- Parameters:
currencyPair
- currency pairamount
- amountrules
- rules- Returns:
- position creation result
-
tickerUpdate
void tickerUpdate(TickerDTO ticker)
Method called by streams at every ticker update.- Parameters:
ticker
- ticker
-
tradeUpdate
void tradeUpdate(TradeDTO trade)
Method called by streams on every trade update.- Parameters:
trade
- trade
-
getGains
HashMap<CurrencyDTO,GainDTO> getGains()
Return the gains made by all positions.- Returns:
- gains by currency.
-
restorePosition
void restorePosition(PositionDTO position)
Restore position.- Parameters:
position
- position
-
-