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
createLongPosition(StrategyDTO strategy, CurrencyPairDTO currencyPair, BigDecimal amount, PositionRulesDTO rules)
Creates a long position with its associated rules.HashMap<CurrencyDTO,GainDTO>
getGains()
Return the gains made by all closed positions.Optional<PositionDTO>
getPositionById(long id)
Get position by id.Set<PositionDTO>
getPositions()
Get positions.void
orderUpdate(OrderDTO order)
Method called by streams at every order update.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
-
createLongPosition
PositionCreationResultDTO createLongPosition(StrategyDTO strategy, CurrencyPairDTO currencyPair, BigDecimal amount, PositionRulesDTO rules)
Creates a long position with its associated rules.- Parameters:
strategy
- strategycurrencyPair
- currency pairamount
- amountrules
- rules- Returns:
- position creation result
-
getPositions
Set<PositionDTO> getPositions()
Get positions.- Returns:
- position list
-
getPositionById
Optional<PositionDTO> getPositionById(long id)
Get position by id.- Parameters:
id
- id- Returns:
- position
-
orderUpdate
void orderUpdate(OrderDTO order)
Method called by streams at every order update.- Parameters:
order
- order
-
tradeUpdate
void tradeUpdate(TradeDTO trade)
Method called by streams on every trade update.- Parameters:
trade
- trade
-
tickerUpdate
void tickerUpdate(TickerDTO ticker)
Method called by streams at every ticker update.- Parameters:
ticker
- ticker
-
getGains
HashMap<CurrencyDTO,GainDTO> getGains()
Return the gains made by all closed positions.- Returns:
- gains by currency.
-
-