package com.market.enums;

import java.util.Arrays;

/**
 * 币安现货 WS 事件类型
 */
public enum BinanceEventType {

    KLINE("kline"),
    TRADE("trade"),
    TICKER_24H("24hrTicker");

    private final String code;

    BinanceEventType(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public static BinanceEventType fromCode(String code) {
        return Arrays.stream(values())
                .filter(value -> value.code.equals(code))
                .findFirst()
                .orElse(null);
    }
}
