Rev 765 | Rev 770 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 765 | Rev 767 | ||
|---|---|---|---|
| Line 18... | Line 18... | ||
| 18 | import br.com.ec.web.exception.VerificadorLancamentoException; |
18 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 19 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
19 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 20 | import br.com.ec.web.generic.AbstractBean; |
20 | import br.com.ec.web.generic.AbstractBean; |
| 21 | import br.com.ec.web.message.LancadorMensagem; |
21 | import br.com.ec.web.message.LancadorMensagem; |
| 22 | import br.com.kronus.core.PadraoGatilho; |
22 | import br.com.kronus.core.PadraoGatilho; |
| - | 23 | import br.com.kronus.strategy.ResultadoEstrategiaGatilho3; |
|
| 23 | import br.com.sl.domain.dto.RoboDTO; |
24 | import br.com.sl.domain.dto.RoboDTO; |
| 24 | import br.com.sl.domain.dto.robo.AlertaPadraoService; |
25 | import br.com.sl.domain.dto.robo.AlertaPadraoService; |
| - | 26 | import br.com.sl.domain.dto.robo.SinalTradeGatilho3; |
|
| - | 27 | import br.com.sl.domain.model.tipos.TipoFonteDadosProfit; |
|
| 25 | import br.com.sl.domain.service.RoboOperadorService; |
28 | import br.com.sl.domain.service.RoboOperadorService; |
| 26 | 29 | ||
| 27 | @Named |
30 | @Named |
| 28 | @Scope("view") |
31 | @Scope("view") |
| 29 | public class RoboBean extends AbstractBean<RoboDTO> implements Serializable { |
32 | public class RoboBean extends AbstractBean<RoboDTO> implements Serializable { |
| 30 | 33 | ||
| 31 | private RoboOperadorService roboOperadorService; |
34 | private RoboOperadorService roboOperadorService; |
| - | 35 | ||
| - | 36 | // private TipoFonteDadosProfit tipoFonteSelecionada = TipoFonteDadosProfit.HISTORICO;
|
|
| 32 | 37 | ||
| 33 | private List<PadraoGatilho> padroesEmAberto; |
38 | private List<PadraoGatilho> padroesEmAberto; |
| 34 | private Integer contadorUltimoCandle; |
39 | private Integer contadorUltimoCandle; |
| 35 | 40 | ||
| 36 | private List<PadraoGatilho> padroes; |
41 | private List<PadraoGatilho> padroes; |
| 37 | private List<PadraoGatilho> padroesComG3; // completos (G3 != null) |
42 | private List<PadraoGatilho> padroesComG3; // completos (G3 != null) |
| 38 | private List<PadraoGatilho> padroesAteG2; // parciais (G2 != null && G3 == null) |
43 | private List<PadraoGatilho> padroesAteG2; // parciais (G2 != null && G3 == null) |
| - | 44 | ||
| - | 45 | private List<SinalTradeGatilho3> sinaisTradeGatilho3; |
|
| - | 46 | private List<ResultadoEstrategiaGatilho3> resultados; |
|
| 39 | 47 | ||
| 40 | @Inject |
48 | @Inject |
| 41 | public RoboBean(RoboOperadorService roboOperadorService) { |
49 | public RoboBean(RoboOperadorService roboOperadorService) { |
| 42 | this.roboOperadorService = roboOperadorService; |
50 | this.roboOperadorService = roboOperadorService; |
| 43 | }
|
51 | }
|
| Line 52... | Line 60... | ||
| 52 | public void limparEntidade() { |
60 | public void limparEntidade() { |
| 53 | setEntidade(new RoboDTO()); |
61 | setEntidade(new RoboDTO()); |
| 54 | setPadroes(new ArrayList<PadraoGatilho>()); |
62 | setPadroes(new ArrayList<PadraoGatilho>()); |
| 55 | setPadroesComG3(new ArrayList<PadraoGatilho>()); |
63 | setPadroesComG3(new ArrayList<PadraoGatilho>()); |
| 56 | setPadroesAteG2(new ArrayList<PadraoGatilho>()); |
64 | setPadroesAteG2(new ArrayList<PadraoGatilho>()); |
| - | 65 | setSinaisTradeGatilho3(new ArrayList<SinalTradeGatilho3>()); |
|
| - | 66 | setResultados(new ArrayList<ResultadoEstrategiaGatilho3>()); |
|
| 57 | }
|
67 | }
|
| 58 | 68 | ||
| 59 | @Override |
69 | @Override |
| 60 | public GenericService<RoboDTO> getService() { |
70 | public GenericService<RoboDTO> getService() { |
| 61 | return roboOperadorService; |
71 | return roboOperadorService; |
| Line 74... | Line 84... | ||
| 74 | public List<PadraoGatilho> getPadroes() { |
84 | public List<PadraoGatilho> getPadroes() { |
| 75 | return padroes; |
85 | return padroes; |
| 76 | }
|
86 | }
|
| 77 | public void setPadroes(List<PadraoGatilho> padroes) { |
87 | public void setPadroes(List<PadraoGatilho> padroes) { |
| 78 | this.padroes = padroes; |
88 | this.padroes = padroes; |
| - | 89 | }
|
|
| - | 90 | ||
| - | 91 | public List<SinalTradeGatilho3> getSinaisTradeGatilho3() { |
|
| - | 92 | return sinaisTradeGatilho3; |
|
| - | 93 | }
|
|
| - | 94 | public void setSinaisTradeGatilho3(List<SinalTradeGatilho3> sinaisTradeGatilho3) { |
|
| - | 95 | this.sinaisTradeGatilho3 = sinaisTradeGatilho3; |
|
| - | 96 | }
|
|
| - | 97 | ||
| - | 98 | public List<ResultadoEstrategiaGatilho3> getResultados() { |
|
| - | 99 | return resultados; |
|
| - | 100 | }
|
|
| - | 101 | public void setResultados(List<ResultadoEstrategiaGatilho3> resultados) { |
|
| - | 102 | this.resultados = resultados; |
|
| 79 | }
|
103 | }
|
| 80 | 104 | ||
| 81 | public List<PadraoGatilho> getPadroesComG3() { |
105 | public List<PadraoGatilho> getPadroesComG3() { |
| 82 | return padroesComG3; |
106 | return padroesComG3; |
| 83 | }
|
107 | }
|
| Line 94... | Line 118... | ||
| 94 | 118 | ||
| 95 | public void iniciar() { |
119 | public void iniciar() { |
| 96 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
120 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 97 | public void execute() { |
121 | public void execute() { |
| 98 | // ANALISAR POR HISTÓRICO
|
122 | // ANALISAR POR HISTÓRICO
|
| 99 | getEntidade().setAnalisarPorHistoricoArquivo(true); |
- | |
| - | 123 | getEntidade().setAnalisarPorHistoricoArquivo(false); |
|
| 100 | 124 | ||
| 101 | roboOperadorService.iniciarOperacao(getEntidade().getAnalisarPorHistoricoArquivo()); |
125 | roboOperadorService.iniciarOperacao(getEntidade().getAnalisarPorHistoricoArquivo()); |
| 102 | setEntidade(roboOperadorService.statusRobo()); |
126 | setEntidade(roboOperadorService.statusRobo()); |
| 103 | LancadorMensagem.lancarSucesso("ROBÔ INICIADO COM SUCESSO!"); |
127 | LancadorMensagem.lancarSucesso("ROBÔ INICIADO COM SUCESSO!"); |
| 104 | }
|
128 | }
|
| Line 140... | Line 164... | ||
| 140 | AlertaPadraoService.novoAlerta("NOVO PADRÃO IDENTIFICADO!"); |
164 | AlertaPadraoService.novoAlerta("NOVO PADRÃO IDENTIFICADO!"); |
| 141 | PrimeFaces.current().executeScript("playAlertaAgressivo();"); |
165 | PrimeFaces.current().executeScript("playAlertaAgressivo();"); |
| 142 | }
|
166 | }
|
| 143 | setPadroes(getEntidade().getPadroes()); |
167 | setPadroes(getEntidade().getPadroes()); |
| 144 | preencherOutrosPadroes(); |
168 | preencherOutrosPadroes(); |
| - | 169 | setSinaisTradeGatilho3(getEntidade().getSinaisTradeGatilho3()); |
|
| - | 170 | setResultados(getEntidade().getResultados()); |
|
| 145 | }
|
171 | }
|
| 146 | verificarNovosPadroes(); |
172 | verificarNovosPadroes(); |
| 147 | }
|
173 | }
|
| 148 | 174 | ||
| 149 | public void verificarNovosPadroes() { |
175 | public void verificarNovosPadroes() { |