Rev 763 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 763 | Rev 764 | ||
|---|---|---|---|
| Line 20... | Line 20... | ||
| 20 | 20 | ||
| 21 | import org.hibernate.annotations.ForeignKey; |
21 | import org.hibernate.annotations.ForeignKey; |
| 22 | 22 | ||
| 23 | import br.com.ec.core.interfaces.Alterar; |
23 | import br.com.ec.core.interfaces.Alterar; |
| 24 | import br.com.ec.core.interfaces.Cadastrar; |
24 | import br.com.ec.core.interfaces.Cadastrar; |
| - | 25 | import br.com.ec.core.util.DataUtils; |
|
| 25 | import br.com.ec.core.util.VerificadorUtil; |
26 | import br.com.ec.core.util.VerificadorUtil; |
| 26 | import br.com.kronus.core.Timeframe; |
27 | import br.com.kronus.core.Timeframe; |
| 27 | import br.com.sl.domain.dto.robo.CandleState; |
28 | import br.com.sl.domain.dto.robo.CandleState; |
| 28 | import br.com.sl.domain.model.tipos.TipoPeriodoCandle; |
29 | import br.com.sl.domain.model.tipos.TipoPeriodoCandle; |
| 29 | import br.com.sl.domain.util.BigDecimalUtils; |
30 | import br.com.sl.domain.util.BigDecimalUtils; |
| Line 33... | Line 34... | ||
| 33 | public class Candle implements Serializable { |
34 | public class Candle implements Serializable { |
| 34 | 35 | ||
| 35 | private static final long serialVersionUID = 1L; |
36 | private static final long serialVersionUID = 1L; |
| 36 | 37 | ||
| 37 | private Long sequencial; |
38 | private Long sequencial; |
| - | 39 | private Integer contadorCandle; |
|
| 38 | private Ativo ativo; |
40 | private Ativo ativo; |
| 39 | private Date dataHora; |
41 | private Date dataHora; |
| 40 | private BigDecimal abertura; |
42 | private BigDecimal abertura; |
| 41 | private BigDecimal maxima; |
43 | private BigDecimal maxima; |
| 42 | private BigDecimal minima; |
44 | private BigDecimal minima; |
| 43 | private BigDecimal fechamento; |
45 | private BigDecimal fechamento; |
| 44 | private BigDecimal volume; |
46 | private BigDecimal volume; |
| 45 | private String periodo; |
47 | private String periodo; |
| 46 | 48 | ||
| 47 | private String nomeAtivo; |
49 | private String nomeAtivo; |
| 48 | private Integer contadorCandle; |
- | |
| 49 | private LocalDateTime dataHoraTime; |
50 | private LocalDateTime dataHoraTime; |
| 50 | private Timeframe periodoTimeFramde; |
51 | private Timeframe periodoTimeFramde; |
| 51 | private Boolean candleAnalisado = false; |
52 | private Boolean candleAnalisado = false; |
| 52 | 53 | ||
| 53 | public Candle() {} |
54 | public Candle() {} |
| Line 60... | Line 61... | ||
| 60 | this.minima = situacaoCandle.getMinima(); |
61 | this.minima = situacaoCandle.getMinima(); |
| 61 | this.fechamento = situacaoCandle.getFechamento(); |
62 | this.fechamento = situacaoCandle.getFechamento(); |
| 62 | this.periodo = periodoCandle; |
63 | this.periodo = periodoCandle; |
| 63 | }
|
64 | }
|
| 64 | 65 | ||
| 65 | public Candle(String ativoDescricao, LocalDateTime time, BigDecimal abertura, BigDecimal topo, BigDecimal fundo, |
- | |
| - | 66 | public Candle(Integer contador, String ativoDescricao, LocalDateTime time, BigDecimal abertura, BigDecimal topo, BigDecimal fundo, |
|
| 66 | BigDecimal fechamento, String periodoCandle) { |
67 | BigDecimal fechamento, String periodoCandle) { |
| - | 68 | this.contadorCandle = contador; |
|
| 67 | this.nomeAtivo = ativoDescricao; |
69 | this.nomeAtivo = ativoDescricao; |
| 68 | this.dataHora = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); |
70 | this.dataHora = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); |
| 69 | this.abertura = abertura; |
71 | this.abertura = abertura; |
| 70 | this.maxima = topo; |
72 | this.maxima = topo; |
| 71 | this.minima = fundo; |
73 | this.minima = fundo; |
| Line 90... | Line 92... | ||
| 90 | public Ativo getAtivo() { |
92 | public Ativo getAtivo() { |
| 91 | return ativo; |
93 | return ativo; |
| 92 | }
|
94 | }
|
| 93 | public void setAtivo(Ativo ativo) { |
95 | public void setAtivo(Ativo ativo) { |
| 94 | this.ativo = ativo; |
96 | this.ativo = ativo; |
| - | 97 | }
|
|
| - | 98 | ||
| - | 99 | @NotNull(message = "Parâmetro obrigatório não preenchido: Contador", groups = {Cadastrar.class, Alterar.class}) |
|
| - | 100 | @Column(name="val_contador", nullable=false) |
|
| - | 101 | public Integer getContadorCandle() { |
|
| - | 102 | return contadorCandle; |
|
| - | 103 | }
|
|
| - | 104 | public void setContadorCandle(Integer contadorCandle) { |
|
| - | 105 | this.contadorCandle = contadorCandle; |
|
| 95 | }
|
106 | }
|
| 96 | 107 | ||
| 97 | @NotNull(message = "Parâmetro obrigatório não preenchido: Data e hora", groups = {Cadastrar.class, Alterar.class}) |
108 | @NotNull(message = "Parâmetro obrigatório não preenchido: Data e hora", groups = {Cadastrar.class, Alterar.class}) |
| 98 | @Column(name="dat_datahora", nullable=false) |
- | |
| - | 109 | @Column(name="dth_datahora", nullable=false) |
|
| 99 | public Date getDataHora() { |
110 | public Date getDataHora() { |
| 100 | return dataHora; |
111 | return dataHora; |
| 101 | }
|
112 | }
|
| 102 | public void setDataHora(Date dataHora) { |
113 | public void setDataHora(Date dataHora) { |
| 103 | this.dataHora = dataHora; |
114 | this.dataHora = dataHora; |
| - | 115 | }
|
|
| - | 116 | @Transient |
|
| - | 117 | public String getDataHoraFormatada() { |
|
| - | 118 | return VerificadorUtil.naoEstaNulo(getDataHora())? DataUtils.converterDataComHorarioParaString(getDataHora()) : ""; |
|
| - | 119 | }
|
|
| - | 120 | @Transient |
|
| - | 121 | public String getHoraFormatada() { |
|
| - | 122 | return VerificadorUtil.naoEstaNulo(getDataHora())? DataUtils.converterDataParaStringNoFormato(getDataHora(), "HH:mm:ss") : ""; |
|
| 104 | }
|
123 | }
|
| 105 | 124 | ||
| 106 | @NotNull(message = "Parâmetro obrigatório não preenchido: Preço de abertura", groups = {Cadastrar.class, Alterar.class}) |
125 | @NotNull(message = "Parâmetro obrigatório não preenchido: Preço de abertura", groups = {Cadastrar.class, Alterar.class}) |
| 107 | @Column(name="val_abertura", nullable=false) |
126 | @Column(name="val_abertura", nullable=false) |
| 108 | public BigDecimal getAbertura() { |
127 | public BigDecimal getAbertura() { |
| Line 180... | Line 199... | ||
| 180 | public String getNomeAtivo() { |
199 | public String getNomeAtivo() { |
| 181 | return nomeAtivo; |
200 | return nomeAtivo; |
| 182 | }
|
201 | }
|
| 183 | public void setNomeAtivo(String nomeAtivo) { |
202 | public void setNomeAtivo(String nomeAtivo) { |
| 184 | this.nomeAtivo = nomeAtivo; |
203 | this.nomeAtivo = nomeAtivo; |
| 185 | }
|
- | |
| 186 | - | ||
| 187 | @Transient |
- | |
| 188 | public Integer getContadorCandle() { |
- | |
| 189 | return contadorCandle; |
- | |
| 190 | }
|
- | |
| 191 | public void setContadorCandle(Integer contadorCandle) { |
- | |
| 192 | this.contadorCandle = contadorCandle; |
- | |
| 193 | }
|
204 | }
|
| 194 | 205 | ||
| 195 | @Transient |
206 | @Transient |
| 196 | public Boolean getCandleAnalisado() { |
207 | public Boolean getCandleAnalisado() { |
| 197 | return candleAnalisado; |
208 | return candleAnalisado; |