Skip to content

Commit

Permalink
Before release verification - closes #525
Browse files Browse the repository at this point in the history
  • Loading branch information
straumat committed Apr 4, 2021
1 parent 7d9be8b commit af1a532
Show file tree
Hide file tree
Showing 23 changed files with 6 additions and 94 deletions.
2 changes: 0 additions & 2 deletions docs/src/why-cassandre/features-and-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* Extensively [tested](https://app.qase.io/public/report/5cf352e57e1683384446a8b54bd725acc13b87aa) and [documented](../learn/quickstart.md).

## Roadmap
* [4.1.1](https://github.com/cassandre-tech/cassandre-trading-bot/milestone/15).
* [Close open position](https://github.com/cassandre-tech/cassandre-trading-bot/issues/490)
* [4.2.0](https://github.com/cassandre-tech/cassandre-trading-bot/milestone/16)
* [Add multi strategies support](https://github.com/cassandre-tech/cassandre-trading-bot/issues/338)
* [4.2.1](https://github.com/cassandre-tech/cassandre-trading-bot/milestone/17)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Builder
@ToString
@AllArgsConstructor(access = PRIVATE)
@SuppressWarnings("checkstyle:VisibilityModifier")
@SuppressWarnings({"checkstyle:VisibilityModifier", "DuplicatedCode"})
public class PositionDTO {

/** Technical ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,20 @@ public interface PositionRepository extends CrudRepository<Position, Long> {
* Update stop gain rule.
* @param id position id
* @param value new value
* @return number of column affected.
*/
@Transactional
@Modifying
@Query("update Position p set p.stopGainPercentageRule = :value where p.id = :id")
int updateStopGainRule(@Param("id") Long id, @Param("value") Float value);
void updateStopGainRule(@Param("id") Long id, @Param("value") Float value);

/**
* Update stop gain rule.
* @param id position id
* @param value new value
* @return number of column affected.
*/
@Transactional
@Modifying
@Query("update Position p set p.stopLossPercentageRule = :value where p.id = :id")
int updateStopLossRule(@Param("id") Long id, @Param("value") Float value);
void updateStopLossRule(@Param("id") Long id, @Param("value") Float value);

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/**
* User service (dry mode implementation).
*/
@SuppressWarnings("DuplicatedCode")
public class UserServiceDryModeImplementation extends BaseService implements UserService {

/** User file prefix. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class DatabaseParameters {
@Setter
@ToString
@ConfigurationProperties(prefix = "cassandre.trading.bot.database.datasource")
public class Datasource {
public static class Datasource {

/** Backup enabled parameter. */
public static final String PARAMETER_DATABASE_DATASOURCE_DRIVER_CLASS_NAME = "cassandre.trading.bot.database.datasource.driver-class-name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class ExchangeParameters {
@Setter
@ToString
@ConfigurationProperties(prefix = "cassandre.trading.bot.exchange.modes")
public class Modes {
public static class Modes {

/** Set it to true to use the sandbox. */
@NotNull(message = "Sandbox parameter required, set it to true to use the sandbox")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.BTC;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.ETH;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.KCS;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.USDT;

@SpringBootTest
@ActiveProfiles("schedule-disabled")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import tech.cassandre.trading.bot.dto.util.CurrencyPairDTO;
import tech.cassandre.trading.bot.service.MarketService;

import java.time.ZonedDateTime;
import java.util.Optional;

import static java.math.BigDecimal.ZERO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ public void checkCreateBuyLimitOrder() {
assertEquals(cp, order1.get().getCurrencyPair());
assertEquals(0, order1.get().getAmount().getValue().compareTo(new BigDecimal("0.01")));
assertEquals(cp.getBaseCurrency(), order1.get().getAmount().getCurrency());
//assertTrue(order1.get().getAveragePrice().getValue().compareTo(ZERO) > 0);
//assertEquals(cp.getQuoteCurrency(), order1.get().getAveragePrice().getCurrency());
assertEquals(0, order1.get().getLimitPrice().getValue().compareTo(new BigDecimal("0.0001")));
assertEquals(cp.getQuoteCurrency(), order1.get().getLimitPrice().getCurrency());
assertNull(order1.get().getLeverage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyPairDTO;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.repository.PositionRepository;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.service.MarketService;
import tech.cassandre.trading.bot.service.TradeService;
Expand All @@ -40,9 +39,6 @@
@TestConfiguration
public class Issue426Mock extends BaseTest {

@Autowired
private PositionRepository positionRepository;

@Autowired
private OrderRepository orderRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.batch.TradeFlux;
import tech.cassandre.trading.bot.domain.Order;
import tech.cassandre.trading.bot.dto.trade.OrderDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.repository.PositionRepository;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
import tech.cassandre.trading.bot.test.util.junit.configuration.Property;
import tech.cassandre.trading.bot.test.util.strategies.TestableCassandreStrategy;

import java.time.ZoneId;
import java.time.ZonedDateTime;
Expand Down Expand Up @@ -47,27 +42,12 @@
@Import(Issue427Mock.class)
public class Issue427 extends BaseTest {

@Autowired
private TestableCassandreStrategy strategy;

@Autowired
private OrderRepository orderRepository;

@Autowired
private TradeRepository tradeRepository;

@Autowired
private PositionRepository positionRepository;

@Autowired
private TickerFlux tickerFlux;

@Autowired
private OrderFlux orderFlux;

@Autowired
private TradeFlux tradeFlux;

@Test
@DisplayName("Save local order before saving distant order")
public void checkSaveLocalOrderBeforeRemote() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyPairDTO;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.repository.PositionRepository;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.service.MarketService;
import tech.cassandre.trading.bot.service.TradeService;
Expand All @@ -36,9 +35,6 @@
@TestConfiguration
public class Issue427Mock extends BaseTest {

@Autowired
private PositionRepository positionRepository;

@Autowired
private OrderRepository orderRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.dto.position.PositionDTO;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
Expand All @@ -31,9 +30,6 @@ public class Issue483 extends BaseTest {
@Autowired
private TestableCassandreStrategy strategy;

@Autowired
private TickerFlux tickerFlux;

@Test
@DisplayName("Check onPositionStatusUpdate not called after restart")
public void checkGainsCalculation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD;
import static tech.cassandre.trading.bot.dto.position.PositionStatusDTO.CLOSED;
import static tech.cassandre.trading.bot.dto.position.PositionStatusDTO.CLOSING;
import static tech.cassandre.trading.bot.dto.position.PositionStatusDTO.OPENING;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.batch.TradeFlux;
import tech.cassandre.trading.bot.domain.Order;
Expand Down Expand Up @@ -62,9 +61,6 @@ public class LongPositionFluxTest extends BaseTest {
@Autowired
private TickerFlux tickerFlux;

@Autowired
private OrderFlux orderFlux;

@Autowired
private TradeFlux tradeFlux;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.dto.trade.OrderCreationResultDTO;
import tech.cassandre.trading.bot.dto.trade.OrderDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
Expand Down Expand Up @@ -59,9 +58,6 @@ public class OrderFluxTest extends BaseTest {
@Autowired
private OrderRepository orderRepository;

@Autowired
private OrderFlux orderFlux;

@Test
@CaseId(3)
@DisplayName("Check received data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.batch.TradeFlux;
import tech.cassandre.trading.bot.domain.Order;
Expand Down Expand Up @@ -62,9 +61,6 @@ public class ShortPositionFluxTest extends BaseTest {
@Autowired
private TickerFlux tickerFlux;

@Autowired
private OrderFlux orderFlux;

@Autowired
private TradeFlux tradeFlux;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import tech.cassandre.trading.bot.dto.market.TickerDTO;
import tech.cassandre.trading.bot.service.MarketService;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
import tech.cassandre.trading.bot.test.util.junit.configuration.Property;
Expand Down Expand Up @@ -40,9 +39,6 @@ public class TickerFluxTest extends BaseTest {
@Autowired
private TestableCassandreStrategy strategy;

@Autowired
private MarketService marketService;

@Autowired
private MarketDataService marketDataService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import tech.cassandre.trading.bot.dto.trade.TradeDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.service.TradeService;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
import tech.cassandre.trading.bot.test.util.junit.configuration.Property;
Expand Down Expand Up @@ -49,9 +48,6 @@ public class TradeFluxTest extends BaseTest {
@Autowired
private TradeRepository tradeRepository;

@Autowired
private TradeService tradeService;

@Autowired
private org.knowm.xchange.service.trade.TradeService xChangeTradeService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyDTO;
import tech.cassandre.trading.bot.service.PositionService;
import tech.cassandre.trading.bot.service.TradeService;
import tech.cassandre.trading.bot.service.UserService;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
Expand Down Expand Up @@ -57,9 +56,6 @@ public class UserServiceWithPositionsDryModeTest extends BaseTest {
@Autowired
private UserService userService;

@Autowired
private TradeService tradeService;

@Autowired
private PositionService positionService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
import tech.cassandre.trading.bot.dto.position.PositionDTO;
import tech.cassandre.trading.bot.dto.position.PositionRulesDTO;
import tech.cassandre.trading.bot.dto.trade.OrderDTO;
import tech.cassandre.trading.bot.dto.trade.OrderStatusDTO;
import tech.cassandre.trading.bot.dto.trade.TradeDTO;
import tech.cassandre.trading.bot.dto.util.CurrencyAmountDTO;
import tech.cassandre.trading.bot.dto.util.GainDTO;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.service.PositionService;
import tech.cassandre.trading.bot.test.util.junit.BaseTest;
import tech.cassandre.trading.bot.test.util.junit.configuration.Configuration;
Expand Down Expand Up @@ -70,9 +68,6 @@ public class PositionServiceTest extends BaseTest {
@Autowired
private TestableCassandreStrategy strategy;

@Autowired
private OrderRepository orderRepository;

@Autowired
private PositionService positionService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.batch.TradeFlux;
import tech.cassandre.trading.bot.repository.ExchangeAccountRepository;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.repository.PositionRepository;
import tech.cassandre.trading.bot.repository.StrategyRepository;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.service.MarketService;
import tech.cassandre.trading.bot.service.TradeService;
Expand All @@ -43,12 +41,6 @@
@TestConfiguration
public class RatesTestMock {

@Autowired
private ExchangeAccountRepository exchangeAccountRepository;

@Autowired
private StrategyRepository strategyRepository;

@Autowired
protected OrderRepository orderRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
import tech.cassandre.trading.bot.batch.OrderFlux;
import tech.cassandre.trading.bot.batch.TickerFlux;
import tech.cassandre.trading.bot.batch.TradeFlux;
import tech.cassandre.trading.bot.repository.ExchangeAccountRepository;
import tech.cassandre.trading.bot.repository.OrderRepository;
import tech.cassandre.trading.bot.repository.PositionRepository;
import tech.cassandre.trading.bot.repository.StrategyRepository;
import tech.cassandre.trading.bot.repository.TradeRepository;
import tech.cassandre.trading.bot.service.MarketService;
import tech.cassandre.trading.bot.service.TradeService;
Expand Down Expand Up @@ -47,12 +45,6 @@ public class BaseMock extends BaseTest {
/** Service rate. */
public static final int SERVICE_RATE = 900;

@Autowired
private ExchangeAccountRepository exchangeAccountRepository;

@Autowired
private StrategyRepository strategyRepository;

@Autowired
protected OrderRepository orderRepository;

Expand Down

0 comments on commit af1a532

Please sign in to comment.