// 判断涨跌颜色
export const isRise = (num: number | string) => {
    let newNum = num + '';
    if (newNum[0] == '-') {
        return '#D95E71'
    }
    return '#0E9D6D'
}
// 是否需要加+
export const isPlus = (num: number | string) => {
    let newNum = num + '';
    if (newNum[0] != '-' && newNum[0] != '+') {
        return '+' + newNum;
    }
    return newNum;
}

// 方向的颜色
export const getDirectionColor = (direction: string) => {
    if (direction == 'LONG') {
        return '#0E9D6D'
    }
    return '#D95E71'
}

// 成功失败的颜色
export const getSuccessColor = (status: string) => {
    if (status == '200') {
        return '#0E9D6D'
    }
    return '#D95E71'
}

// 成功失败的文字
export const getSuccessText = (status: any) => {
    if (!status) {
        return 'Null'
    }
    if (status.code === '200') {
        return '成功'
    } else if (!status.code) {
        return 'null'
    } else {
        return '失败'
    }
}

// 买入卖出颜色
export const getBuySellColor = (direction: string) => {
    if (direction == 'SELL' || direction == '2') {
        return '#D95E71'
    } else if (direction == 'BUY' || direction == '1') {
        return '#0E9D6D';
    }
    return 'blue';
}

// 买入卖出文字
export const getBuySellText = (direction: string) => {
    if (direction == 'SELL') {
        return '卖出'
    } else if (direction == 'BUY') {
        return '买入';
    }
    return direction;
}

// status对应的颜色
export const getStatusColor = (status: number) => {
    let greenStatus = [1, 2, 3];
    if (greenStatus.includes(status)) {
        return '#0E9D6D'
    } else {
        return '#D95E71'
    }
}

// 开多开空文字
export const getOpenText = (direction: string) => {
    if (direction == 'LONG') {
        return '开多'
    } else {
        return '开空'
    }
}
