Subversion Repositories Integrator Subversion

Rev

Blame | Last modification | View Log | Download | RSS feed

package br.com.kronus.core;

import java.time.LocalDateTime;

public class Candle {

    private LocalDateTime time;
    private double abertura;
    private double maxima;
    private double minima;
    private double fechamento;
    private long volume;
    private Timeframe timeframe;

    public Candle(LocalDateTime time, double abertura, double maxima, double minima,
                  double fechamento, long volume, Timeframe timeframe) {
        this.time = time;
        this.abertura = abertura;
        this.maxima = maxima;
        this.minima = minima;
        this.fechamento = fechamento;
        this.volume = volume;
        this.timeframe = timeframe;
    }

    public boolean isCandleComprador() {
        return fechamento > abertura;
    }

    public boolean isCandleVendedor() {
        return fechamento < abertura;
    }

    public double getCorpoAlto() {
        return Math.max(abertura, fechamento);
    }

    public double getCorpoBaixo() {
        return Math.min(abertura, fechamento);
    }

    public LocalDateTime getTime() {
        return time;
    }

    public double getAbertura() {
        return abertura;
    }

    public double getMaxima() {
        return maxima;
    }

    public double getMinima() {
        return minima;
    }

    public double getFechamento() {
        return fechamento;
    }

    public long getVolume() {
        return volume;
    }

    public Timeframe getTimeframe() {
        return timeframe;
    }
}