Observable emits trade objects. How to make operation on each emission into one result object?
Trade(tradeType: String, profit: BigDecimal) Result(totalProfit: BigDecimal)
Example:
trades
.scan(result: Result, currentTrade: Trade){
result.totalProfit += currentTrade.profit
}
.subscribe(
printLn(it.totalProfit)
)
Do you have something like this in mind? Please provide a full example next time.