package link.at17.mid.tushare.data.models;

import java.time.LocalDateTime;
import link.at17.mid.tushare.system.util.LocalDateTimeUtils;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 个股持仓
 * @author Barry
 *
 */
@Data
@Accessors(chain=true)
public class Hold {
    
    private int holds = 0;
    private int canSell = 0;
    private LocalDateTime date;
    private StockInfo stockInfo;
    private Double cost;
    
    public int getCanSell(LocalDateTime currentDate) {
        if (!LocalDateTimeUtils.isSameDay(currentDate, date) && currentDate.compareTo(date) == 1) {
            return holds;
        }
        else return canSell;
    }
}
