package com.market.model.binance;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 币安 K 线推送消息
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class KlineMessage implements Serializable {

    @JsonProperty("e")
    private String eventType;

    @JsonProperty("E")
    private Long eventTime;

    @JsonProperty("s")
    private String symbol;

    @JsonProperty("k")
    private Kline kline;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Kline implements Serializable {
        @JsonProperty("t")
        private Long startTime;
        @JsonProperty("T")
        private Long endTime;
        @JsonProperty("s")
        private String symbol;
        @JsonProperty("i")
        private String interval;
        @JsonProperty("o")
        private String open;
        @JsonProperty("c")
        private String close;
        @JsonProperty("h")
        private String high;
        @JsonProperty("l")
        private String low;
        @JsonProperty("v")
        private String volume;
        @JsonProperty("q")
        private String quoteAssetVolume;
        @JsonProperty("x")
        private Boolean isClosed;
    }
}
