Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 778 | blopes | 1 | package br.com.kronus.core; |
| 2 | |||
| 3 | import java.time.LocalDateTime; |
||
| 4 | import java.util.Date; |
||
| 5 | |||
| 6 | public class Candle { |
||
| 7 | |||
| 8 | private Integer contador; |
||
| 9 | private LocalDateTime time; |
||
| 10 | private Date dia; |
||
| 11 | private Date hora; |
||
| 12 | private double abertura; |
||
| 13 | private double maxima; |
||
| 14 | private double minima; |
||
| 15 | private double fechamento; |
||
| 16 | private long volume; |
||
| 17 | private Timeframe timeframe; |
||
| 18 | |||
| 19 | public Candle(LocalDateTime time, double abertura, double maxima, double minima, |
||
| 20 | double fechamento, long volume, Timeframe timeframe) { |
||
| 21 | this.time = time; |
||
| 22 | this.abertura = abertura; |
||
| 23 | this.maxima = maxima; |
||
| 24 | this.minima = minima; |
||
| 25 | this.fechamento = fechamento; |
||
| 26 | this.volume = volume; |
||
| 27 | this.timeframe = timeframe; |
||
| 28 | } |
||
| 29 | |||
| 30 | public Candle(LocalDateTime time, double abertura, double maxima, double minima, double fechamento, Timeframe timeframe) { |
||
| 31 | this.time = time; |
||
| 32 | this.abertura = abertura; |
||
| 33 | this.maxima = maxima; |
||
| 34 | this.minima = minima; |
||
| 35 | this.fechamento = fechamento; |
||
| 36 | this.timeframe = timeframe; |
||
| 37 | } |
||
| 38 | |||
| 39 | public Integer getContador() { |
||
| 40 | return contador; |
||
| 41 | } |
||
| 42 | public void setContador(Integer contador) { |
||
| 43 | this.contador = contador; |
||
| 44 | } |
||
| 45 | |||
| 46 | public boolean isCandleComprador() { |
||
| 47 | return fechamento > abertura; |
||
| 48 | } |
||
| 49 | |||
| 50 | public boolean isCandleVendedor() { |
||
| 51 | return fechamento < abertura; |
||
| 52 | } |
||
| 53 | |||
| 54 | public double getCorpoAlto() { |
||
| 55 | return Math.max(abertura, fechamento); |
||
| 56 | } |
||
| 57 | |||
| 58 | public double getCorpoBaixo() { |
||
| 59 | return Math.min(abertura, fechamento); |
||
| 60 | } |
||
| 61 | |||
| 62 | public LocalDateTime getTime() { |
||
| 63 | return time; |
||
| 64 | } |
||
| 65 | |||
| 66 | public double getAbertura() { |
||
| 67 | return abertura; |
||
| 68 | } |
||
| 69 | |||
| 70 | public double getMaxima() { |
||
| 71 | return maxima; |
||
| 72 | } |
||
| 73 | |||
| 74 | public double getMinima() { |
||
| 75 | return minima; |
||
| 76 | } |
||
| 77 | |||
| 78 | public double getFechamento() { |
||
| 79 | return fechamento; |
||
| 80 | } |
||
| 81 | |||
| 82 | public long getVolume() { |
||
| 83 | return volume; |
||
| 84 | } |
||
| 85 | |||
| 86 | public Timeframe getTimeframe() { |
||
| 87 | return timeframe; |
||
| 88 | } |
||
| 89 | } |