def get_current_tick(security):
    """
    获取最新的 tick 数据

    :param security 标的代码
    :return:
    """
    client = JQDataClient.instance()
    if not client or not client.get_http_token():
        raise Exception("Please run jqdatasdk.auth first")

    if isinstance(security, six.string_types):
        security = [security]
    elif isinstance(security, Security):
        security = [str(security)]

    resp = _request_http_current_tick(security)
    if not resp or resp.text == "":
        return None
    content = resp.text
    if content[:5] == 'error':
        if "token无效" in content or "token过期" in content:
            client.set_http_token()
            resp = _request_http_current_tick(security)  # 重试一次
            if not resp or resp.text == "":
                return None
            content = resp.text
            if content[:5] == 'error':
                raise Exception(content)
        else:
            raise Exception(content)

    stock_tick_fields = [
        'datetime', 'current', 'high', 'low', 'volume', 'money',
        'a1_p', 'a1_v', 'a2_p', 'a2_v', 'a3_p', 'a3_v', 'a4_p', 'a4_v', 'a5_p', 'a5_v',
        'b1_p', 'b1_v', 'b2_p', 'b2_v', 'b3_p', 'b3_v', 'b4_p', 'b4_v', 'b5_p', 'b5_v',
    ]
    option_tick_fields = [
        'datetime', 'current', 'high', 'low', 'volume', 'money', 'position',
        'a1_v', 'a2_v', 'a3_v', 'a4_v', 'a5_v', 'a1_p', 'a2_p', 'a3_p', 'a4_p', 'a5_p',
        'b1_v', 'b2_v', 'b3_v', 'b4_v', 'b5_v', 'b1_p', 'b2_p', 'b3_p', 'b4_p', 'b5_p'
    ]
    future_tick_fields = [
        'datetime', 'current', 'high', 'low', 'volume', 'money', 'position',
        'a1_p', 'a1_v', 'b1_p', 'b1_v'
    ]
    index_tick_fields = ['datetime', 'current', 'high', 'low', 'volume', 'money']

    # content[0] 返回数据第一个字符为标的类型
    # "0":"stock", "1":"future", "2":"fund", "3":"index", "4":"option"
    tick_fields_list = [
        stock_tick_fields,
        future_tick_fields,
        stock_tick_fields,
        index_tick_fields,
        option_tick_fields,
    ]
    tick_fields = tick_fields_list[int(content[0])]

    str2time = lambda x: datetime.datetime.strptime(x, '%Y%m%d%H%M%S.%f') if x else pd.NaT
    data = StringIO(content)
    data.seek(1)  # 跳过第一个字符，从第二个开始取数据
    df = pd.read_csv(data, index_col=0, converters={"datetime": str2time})
    df = df[tick_fields]
    if len(security) <= 1:
        df.index = [0]
    return df
获取最新的 tick 数据

:param security 标的代码
:return:
jqdatasdk/api.py