fa93a0d733bd88e236e2b5090c433088b729d113,QUANTAXIS/QAFetch/QATdx.py,,QA_fetch_get_stock_list,#Any#Any#Any#,698

Before Change


@retry(stop_max_attempt_number=3, wait_random_min=50, wait_random_max=100)
def QA_fetch_get_stock_list(type_="stock", ip=None, port=None):
    ip, port = get_mainmarket_ip(ip, port)
    if type_ in ["stock", "gp"]:
            res = pd.read_csv("http://data.yutiansut.com/stock_code.csv")
            return res.assign(code=res.code.apply(lambda x: QA_util_code_tostr(x)))
    api = TdxHq_API()
    with api.connect(ip, port):
        data = pd.concat(
            [pd.concat([api.to_df(api.get_security_list(j, i * 1000)).assign(
                sse="sz" if j == 0 else "sh").set_index(
                ["code", "sse"], drop=False) for i in
                range(int(api.get_security_count(j) / 1000) + 1)], axis=0, sort=False) for
                j
                in range(2)], axis=0, sort=False)
        // data.code = data.code.apply(int)
        sz = data.query("sse=="sz"")
        sh = data.query("sse=="sh"")

        sz = sz.assign(sec=sz.code.apply(for_sz))
        sh = sh.assign(sec=sh.code.apply(for_sh))

        if type_ in ["stock", "gp"]:
            res = pd.read_csv("http://data.yutiansut.com/stock_code.csv")
            return res.assign(code=res.code.apply(lambda x: QA_util_code_tostr(x)))
            // return pd.concat([sz, sh], sort=False).query(
            //     "sec=="stock_cn"").sort_index().assign(
            //     name=data["name"].apply(lambda x: str(x)[0:6]))

After Change


        if type_ in ["stock", "gp"]:
            // res = pd.read_csv("http://data.yutiansut.com/stock_code.csv")
            // return res.assign(code=res.code.apply(lambda x: QA_util_code_tostr(x)))
            return pd.concat([sz, sh], sort=False).query(
                "sec=="stock_cn"").sort_index().assign(
                name=data["name"].apply(lambda x: str(x)[0:6]))

        elif type_ in ["index", "zs"]:

            return pd.concat([sz, sh], sort=False).query(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: fa93a0d733bd88e236e2b5090c433088b729d113
Time: 2020-08-04
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAFetch/QATdx.py
Class Name:
Method Name: QA_fetch_get_stock_list


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 9d5565affe6314056373bf789868e8db714a3da8
Time: 2020-08-04
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAFetch/QATdx.py
Class Name:
Method Name: QA_fetch_get_stock_list


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: fa93a0d733bd88e236e2b5090c433088b729d113
Time: 2020-08-04
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAFetch/QATdx.py
Class Name:
Method Name: QA_fetch_get_stock_list


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 5b4d04de17457286fe4e5f3e0e8295db42d0f064
Time: 2020-04-05
Author: 11652964@qq.com
File Name: QUANTAXIS/QAFetch/QAQuery.py
Class Name:
Method Name: QA_fetch_index_min