Class BaseFlux<T>
java.lang.Object
tech.cassandre.trading.bot.util.base.Base
tech.cassandre.trading.bot.util.base.batch.BaseFlux<T>
- Type Parameters:
T
- flux
- Direct Known Subclasses:
AccountFlux
,OrderFlux
,PositionFlux
,TickerFlux
,TradeFlux
Base flux.
update() method is called by schedulers, and it does two things: - Calls the getNewValues() method you implemented to retrieve new values from "outside" (for example: call the service to retrieve new tickers). - For each value retrieved previously, we call the saveValues() method you implemented to save all the data in the database. - Each value saved in database is then push to the flux to be consumed by strategies. note: you are not forced to implement getNewValues() or saveValues().
-
Field Summary
Modifier and TypeFieldDescriptionFlux.Flux sink.Fields inherited from class tech.cassandre.trading.bot.util.base.Base
ACCOUNT_MAPPER, CANDLE_MAPPER, CURRENCY_MAPPER, logger, ORDER_MAPPER, POSITION_MAPPER, STRATEGY_MAPPER, TICKER_MAPPER, TRADE_MAPPER, UTIL_MAPPER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Emit new value.void
emitValues
(Set<T> newValues) Emit new values.getFlux()
Getter for flux.Implements this method to return all the new values.protected reactor.core.publisher.FluxSink.OverflowStrategy
Set the default overflow strategy - override to change it.saveValues
(Set<T> newValue) Implements this method to save values coming from flux.final void
update()
Method executed when values have to be retrieved (usually called by schedulers).
-
Field Details
-
flux
Flux. -
fluxSink
Flux sink.
-
-
Constructor Details
-
BaseFlux
public BaseFlux()Constructor.
-
-
Method Details
-
getOverflowStrategy
protected reactor.core.publisher.FluxSink.OverflowStrategy getOverflowStrategy()Set the default overflow strategy - override to change it.- Returns:
- overflow strategy
-
getFlux
Getter for flux.- Returns:
- flux
-
update
public final void update()Method executed when values have to be retrieved (usually called by schedulers). -
emitValue
Emit new value.- Parameters:
newValue
- new value
-
emitValues
Emit new values.- Parameters:
newValues
- new values
-
getNewValues
Implements this method to return all the new values. Those values will be sent to the strategy.- Returns:
- list of new values
-
saveValues
Implements this method to save values coming from flux.- Parameters:
newValue
- new value- Returns:
- the value saved
-