Interface CassandreStrategyInterface
-
- All Known Implementing Classes:
BasicCassandreStrategy
,BasicTa4jCassandreStrategy
,GenericCassandreStrategy
public interface CassandreStrategyInterface
Cassandre's strategy interface. This interface defines how Cassandre interacts with a user strategy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accountsUpdates(Set<AccountDTO> accounts)
Method called by streams on accounts updates.Set<CurrencyPairDTO>
getRequestedCurrencyPairs()
Implements this method to tell the bot which currency pairs your strategy will receive.Optional<AccountDTO>
getTradeAccount()
Returns the trading account.Optional<AccountDTO>
getTradeAccount(Set<AccountDTO> accounts)
Implements this method to tell the bot which account from the accounts you own is the one you use for trading.void
initialize()
This method is called by Cassandre before flux are started.void
initializeAccounts(Map<String,AccountDTO> accounts)
Initialize strategy accounts with exchange accounts data.void
onAccountsUpdates(Map<String,AccountDTO> accounts)
Method called by Cassandre when there are accounts updates.void
onOrdersUpdates(Map<String,OrderDTO> orders)
Method called by Cassandre when there are orders updates.void
onPositionsStatusUpdates(Map<Long,PositionDTO> positions)
Method called by Cassandre when there are positions status updates.void
onPositionsUpdates(Map<Long,PositionDTO> positions)
Method called by Cassandre when there are positions updates.void
onTickersUpdates(Map<CurrencyPairDTO,TickerDTO> tickers)
Method called by Cassandre when there are tickers updates.void
onTradesUpdates(Map<String,TradeDTO> trades)
Method called by Cassandre when there are trades updates.void
ordersUpdates(Set<OrderDTO> orders)
Method called by streams on orders updates.void
positionsUpdates(Set<PositionDTO> positions)
Method called by streams on positions updates.void
setExchangeService(ExchangeService newExchangeService)
Setter for exchangeService.void
setImportedTickersRepository(ImportedTickersRepository newImportedTickersRepository)
Setter ImportedTickersRepository.void
setOrderRepository(OrderRepository newOrderRepository)
Setter order repository.void
setPositionFlux(PositionFlux newPositionFlux)
Setter position flux.void
setPositionRepository(PositionRepository newPositionRepository)
Setter positionRepository.void
setPositionService(PositionService newPositionService)
Setter for positionService.void
setStrategy(StrategyDTO newStrategyDTO)
Setter strategyDTO.void
setTradeRepository(TradeRepository newTradeRepository)
Setter trade repository.void
setTradeService(TradeService newTradeService)
Setter for tradeService.void
tickersUpdates(Set<TickerDTO> tickers)
Method called by streams on tickers updates.void
tradesUpdates(Set<TradeDTO> trades)
Method called by streams on trades updates.
-
-
-
Method Detail
-
setStrategy
void setStrategy(StrategyDTO newStrategyDTO)
Setter strategyDTO.- Parameters:
newStrategyDTO
- strategy DTO.
-
initializeAccounts
void initializeAccounts(Map<String,AccountDTO> accounts)
Initialize strategy accounts with exchange accounts data.- Parameters:
accounts
- accounts
-
setPositionFlux
void setPositionFlux(PositionFlux newPositionFlux)
Setter position flux.- Parameters:
newPositionFlux
- position flux
-
setOrderRepository
void setOrderRepository(OrderRepository newOrderRepository)
Setter order repository.- Parameters:
newOrderRepository
- order repository
-
setTradeRepository
void setTradeRepository(TradeRepository newTradeRepository)
Setter trade repository.- Parameters:
newTradeRepository
- trade repository.
-
setPositionRepository
void setPositionRepository(PositionRepository newPositionRepository)
Setter positionRepository.- Parameters:
newPositionRepository
- the positionRepository to set
-
setImportedTickersRepository
void setImportedTickersRepository(ImportedTickersRepository newImportedTickersRepository)
Setter ImportedTickersRepository.- Parameters:
newImportedTickersRepository
- ImportedTickers Repository
-
setExchangeService
void setExchangeService(ExchangeService newExchangeService)
Setter for exchangeService.- Parameters:
newExchangeService
- exchange service
-
setTradeService
void setTradeService(TradeService newTradeService)
Setter for tradeService.- Parameters:
newTradeService
- the tradeService to set
-
setPositionService
void setPositionService(PositionService newPositionService)
Setter for positionService.- Parameters:
newPositionService
- position service
-
accountsUpdates
void accountsUpdates(Set<AccountDTO> accounts)
Method called by streams on accounts updates.- Parameters:
accounts
- accounts updates
-
tickersUpdates
void tickersUpdates(Set<TickerDTO> tickers)
Method called by streams on tickers updates.- Parameters:
tickers
- tickers updates
-
ordersUpdates
void ordersUpdates(Set<OrderDTO> orders)
Method called by streams on orders updates.- Parameters:
orders
- orders updates
-
tradesUpdates
void tradesUpdates(Set<TradeDTO> trades)
Method called by streams on trades updates.- Parameters:
trades
- trades updates
-
positionsUpdates
void positionsUpdates(Set<PositionDTO> positions)
Method called by streams on positions updates.- Parameters:
positions
- positions updates
-
getRequestedCurrencyPairs
Set<CurrencyPairDTO> getRequestedCurrencyPairs()
Implements this method to tell the bot which currency pairs your strategy will receive.- Returns:
- the list of currency pairs tickers your want to receive in this strategy
-
getTradeAccount
Optional<AccountDTO> getTradeAccount(Set<AccountDTO> accounts)
Implements this method to tell the bot which account from the accounts you own is the one you use for trading.- Parameters:
accounts
- all your accounts- Returns:
- your trading account
-
getTradeAccount
Optional<AccountDTO> getTradeAccount()
Returns the trading account.- Returns:
- your trading account
-
initialize
void initialize()
This method is called by Cassandre before flux are started. For example, you can implement this method to prepare your historical data.
-
onAccountsUpdates
void onAccountsUpdates(Map<String,AccountDTO> accounts)
Method called by Cassandre when there are accounts updates.- Parameters:
accounts
- accounts updates
-
onTickersUpdates
void onTickersUpdates(Map<CurrencyPairDTO,TickerDTO> tickers)
Method called by Cassandre when there are tickers updates.- Parameters:
tickers
- tickers updates
-
onOrdersUpdates
void onOrdersUpdates(Map<String,OrderDTO> orders)
Method called by Cassandre when there are orders updates.- Parameters:
orders
- orders updates
-
onTradesUpdates
void onTradesUpdates(Map<String,TradeDTO> trades)
Method called by Cassandre when there are trades updates.- Parameters:
trades
- trades updates
-
onPositionsUpdates
void onPositionsUpdates(Map<Long,PositionDTO> positions)
Method called by Cassandre when there are positions updates.- Parameters:
positions
- positions updates
-
onPositionsStatusUpdates
void onPositionsStatusUpdates(Map<Long,PositionDTO> positions)
Method called by Cassandre when there are positions status updates.- Parameters:
positions
- positions status updates
-
-