Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 778 | blopes | 1 | package br.com.kronus.app; |
| 2 | |||
| 3 | import br.com.kronus.core.Candle; |
||
| 4 | import br.com.kronus.core.SinalDeTrade; |
||
| 5 | import br.com.kronus.core.Timeframe; |
||
| 6 | import br.com.kronus.fibo.FibonacciService; |
||
| 7 | import br.com.kronus.strategy.EstrategiaGatilhoTipo2; |
||
| 8 | import br.com.kronus.strategy.Strategy; |
||
| 9 | |||
| 10 | import java.time.LocalDateTime; |
||
| 11 | import java.util.ArrayList; |
||
| 12 | import java.util.List; |
||
| 13 | |||
| 14 | public class MainKronus { |
||
| 15 | |||
| 16 | public static void main(String[] args) { |
||
| 17 | List<Candle> candles = gerarCandlesExemplo(); |
||
| 18 | |||
| 19 | FibonacciService fiboService = new FibonacciService(); |
||
| 20 | Strategy strategy = new EstrategiaGatilhoTipo2(fiboService); |
||
| 21 | |||
| 22 | List<SinalDeTrade> sinais = strategy.gerarSinais(candles); |
||
| 23 | |||
| 24 | System.out.println("SINAIS GERADOS:"); |
||
| 25 | for (SinalDeTrade s : sinais) { |
||
| 26 | System.out.println(s.getDirecao() + |
||
| 27 | " | Entrada: " + s.getPrecoEntrada() + |
||
| 28 | " | Stop: " + s.getStopLoss() + |
||
| 29 | " | Alvo: " + s.getAlvo() + |
||
| 30 | " | Hora: " + s.getTime()); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | private static List<Candle> gerarCandlesExemplo() { |
||
| 35 | List<Candle> lista = new ArrayList<>(); |
||
| 36 | LocalDateTime t = LocalDateTime.now().minusMinutes(30); |
||
| 37 | |||
| 38 | for (int i = 0; i < 20; i++) { |
||
| 39 | double open = 100 + i; |
||
| 40 | double close = 100 + i + (i % 2 == 0 ? 2 : -1); |
||
| 41 | double high = Math.max(open, close) + 1; |
||
| 42 | double low = Math.min(open, close) - 1; |
||
| 43 | |||
| 44 | lista.add(new Candle( |
||
| 45 | t.plusMinutes(i), |
||
| 46 | open, |
||
| 47 | high, |
||
| 48 | low, |
||
| 49 | close, |
||
| 50 | 1000L + i * 10, |
||
| 51 | Timeframe.M5 |
||
| 52 | )); |
||
| 53 | } |
||
| 54 | return lista; |
||
| 55 | } |
||
| 56 | } |