Class GenericCassandreStrategy

    • Constructor Detail

      • GenericCassandreStrategy

        public GenericCassandreStrategy()
    • Method Detail

      • getAccounts

        public final Map<String,​AccountDTO> getAccounts()
        Getter accounts.
        Returns:
        accounts
      • getOrders

        public final Map<String,​OrderDTO> getOrders()
        Getter orders.
        Returns:
        orders
      • getTrades

        public final Map<String,​TradeDTO> getTrades()
        Getter trades.
        Returns:
        trades
      • getPositions

        public final Map<Long,​PositionDTO> getPositions()
        Getter positions.
        Returns:
        positions
      • getPreviousPositions

        public final Map<Long,​PositionStatusDTO> getPreviousPositions()
        Getter previousPositions.
        Returns:
        previousPositions
      • getEstimatedBuyingCost

        public final Optional<CurrencyAmountDTO> getEstimatedBuyingCost​(CurrencyPairDTO currencyPair,
                                                                        BigDecimal amount)
        Returns the cost of buying an amount of a currency pair.
        Parameters:
        currencyPair - currency pair
        amount - amount
        Returns:
        cost
      • canBuy

        public final boolean canBuy​(CurrencyPairDTO currencyPair,
                                    BigDecimal amount)
        Returns true if we have enough assets to buy.
        Parameters:
        currencyPair - currency pair
        amount - amount
        Returns:
        true if we there is enough assets to buy
      • canBuy

        public final boolean canBuy​(CurrencyPairDTO currencyPair,
                                    BigDecimal amount,
                                    BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to buy.
        Parameters:
        currencyPair - currency pair
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after buying
        Returns:
        true if we there is enough assets to buy
      • canBuy

        public final boolean canBuy​(AccountDTO account,
                                    CurrencyPairDTO currencyPair,
                                    BigDecimal amount)
        Returns true if we have enough assets to buy.
        Parameters:
        account - account
        currencyPair - currency pair
        amount - amount
        Returns:
        true if we there is enough assets to buy
      • canBuy

        public final boolean canBuy​(AccountDTO account,
                                    CurrencyPairDTO currencyPair,
                                    BigDecimal amount,
                                    BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to buy and if minimumBalanceAfter is left on the account after.
        Parameters:
        account - account
        currencyPair - currency pair
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after buying
        Returns:
        true if we there is enough assets to buy
      • canSell

        public final boolean canSell​(CurrencyDTO currency,
                                     BigDecimal amount)
        Returns true if we have enough assets to sell.
        Parameters:
        currency - currency
        amount - amount
        Returns:
        true if we there is enough assets to sell
      • canSell

        public final boolean canSell​(CurrencyDTO currency,
                                     BigDecimal amount,
                                     BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to sell.
        Parameters:
        currency - currency
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after selling
        Returns:
        true if we there is enough assets to sell
      • canSell

        public final boolean canSell​(AccountDTO account,
                                     CurrencyDTO currency,
                                     BigDecimal amount)
        Returns true if we have enough assets to sell.
        Parameters:
        account - account
        currency - currency pair
        amount - amount
        Returns:
        true if we there is enough assets to sell
      • canSell

        public final boolean canSell​(AccountDTO account,
                                     CurrencyDTO currency,
                                     BigDecimal amount,
                                     BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to sell and if minimumBalanceAfter is left on the account after.
        Parameters:
        account - account
        currency - currency
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after selling
        Returns:
        true if we there is enough assets to sell