Interface CassandreStrategyInterface
- All Known Implementing Classes:
BasicCassandreStrategy
,CassandreStrategy
,CassandreStrategyImplementation
These are the classes used by Cassandre to manage a position.
- CassandreStrategyInterface list the methods a strategy type must implement to be able to interact with the Cassandre framework.
- CassandreStrategyConfiguration contains the configuration of the strategy.
- CassandreStrategyDependencies contains all the dependencies required by a strategy and provided by the Cassandre framework.
- CassandreStrategyImplementation is the default implementation of CassandreStrategyInterface, this code manages the interaction between Cassandre framework and a strategy.
- CassandreStrategy (class) is the class that every strategy used by user (BasicCassandreStrategy
must extend. It contains methods to access data and manage orders, trades, positions.
There are the classes used by the developer.
- CassandreStrategy (interface) is the annotation allowing you Cassandre to recognize a user strategy.
- BasicCassandreStrategy - User inherits this class this one to make a basic strategy.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accountsUpdates
(Set<AccountDTO> accounts) Method called by streams on accounts updates.Get strategy configuration.getLastPriceForCurrencyPair
(CurrencyPairDTO currencyPair) Returns the last price received for a currency pair.Implements this method to tell the bot which currency pairs your strategy will receive.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.default void
This method is called by Cassandre before flux are started.void
initializeAccounts
(Map<String, AccountDTO> accounts) Initialize strategy accounts with exchange accounts data retrieved at Cassandre startup.default void
onAccountsUpdates
(Map<String, AccountDTO> accounts) Method called by Cassandre when there are accounts updates.default void
onOrdersUpdates
(Map<String, OrderDTO> orders) Method called by Cassandre when there are orders updates.default void
onPositionsStatusUpdates
(Map<Long, PositionDTO> positions) Method called by Cassandre when there are positions status updates.default void
onPositionsUpdates
(Map<Long, PositionDTO> positions) Method called by Cassandre when there are positions updates.default void
onTickersUpdates
(Map<CurrencyPairDTO, TickerDTO> tickers) Method called by Cassandre when there are tickers updates.default 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
setConfiguration
(CassandreStrategyConfiguration cassandreStrategyConfiguration) Set strategy configuration.void
setDependencies
(CassandreStrategyDependencies cassandreStrategyDependencies) Set strategy dependencies.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 Details
-
setConfiguration
Set strategy configuration.- Parameters:
cassandreStrategyConfiguration
- cassandre strategy configuration
-
getConfiguration
CassandreStrategyConfiguration getConfiguration()Get strategy configuration.- Returns:
- cassandre strategy configuration
-
setDependencies
Set strategy dependencies.- Parameters:
cassandreStrategyDependencies
- cassandre strategy dependencies
-
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
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
-
initializeAccounts
Initialize strategy accounts with exchange accounts data retrieved at Cassandre startup.- Parameters:
accounts
- accounts
-
initialize
default void initialize()This method is called by Cassandre before flux are started. For example, you can implement this method to integrate your historical data. -
accountsUpdates
Method called by streams on accounts updates.- Parameters:
accounts
- accounts updates
-
tickersUpdates
Method called by streams on tickers updates.- Parameters:
tickers
- tickers updates
-
ordersUpdates
Method called by streams on orders updates.- Parameters:
orders
- orders updates
-
tradesUpdates
Method called by streams on trades updates.- Parameters:
trades
- trades updates
-
positionsUpdates
Method called by streams on positions updates.- Parameters:
positions
- positions updates
-
onAccountsUpdates
Method called by Cassandre when there are accounts updates.- Parameters:
accounts
- accounts updates
-
onTickersUpdates
Method called by Cassandre when there are tickers updates.- Parameters:
tickers
- tickers updates
-
onOrdersUpdates
Method called by Cassandre when there are orders updates.- Parameters:
orders
- orders updates
-
onTradesUpdates
Method called by Cassandre when there are trades updates.- Parameters:
trades
- trades updates
-
onPositionsUpdates
Method called by Cassandre when there are positions updates.- Parameters:
positions
- positions updates
-
onPositionsStatusUpdates
Method called by Cassandre when there are positions status updates.- Parameters:
positions
- positions status updates
-
getLastPriceForCurrencyPair
Returns the last price received for a currency pair.- Parameters:
currencyPair
- currency pair- Returns:
- last price
-