package com.copy.trade.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum DirectionEnum{
    BUY(0,"BUY","做多"),
    SELL(1,"SELL","做空")
    ;
    private Integer direction;
    private String directionStr;
    private String des;

    DirectionEnum(Integer direction, String directionStr, String des) {
        this.direction = direction;
        this.directionStr = directionStr;
        this.des = des;
    }
    public static DirectionEnum getByDirectionStr(String directionStr){
        return  Arrays.asList(values()).stream()
                .filter(directionEnum -> directionEnum.getDirectionStr().equals(directionStr))
                .findFirst().orElse(null);
    }

}