7926858da02bd4db873a9e8ca727beb838faad9d,QUANTAXIS/QAFetch/QAbinance.py,,QA_fetch_binance_symbols,#,22

Before Change


    try:
        req = requests.get(url, timeout=TIMEOUT)
    except ConnectTimeout:
        raise ConnectTimeout(ILOVECHINA)
    body = json.loads(req.content)
    return body["symbols"]

After Change


    url = urljoin(Binance_base_url, "/api/v1/exchangeInfo")
    retries = 1
    datas = list()
    while (retries != 0):
        try:
            req = requests.get(url, timeout=TIMEOUT)
            retries = 0
        except (ConnectTimeout, ConnectionError, SSLError, ReadTimeout):
            retries += 1
            if (retries % 6 == 0):
                print(ILOVECHINA)
            print("Retry /api/v1/exchangeInfo //{}".format(retries - 1))
            time.sleep(0.5)

        if (retries == 0):
            // 成功获取才处理数据,否则继续尝试连接
            body = json.loads(req.content)
            if len(body["symbols"]) == 0:
                return []
            for symbol in body["symbols"]:
                // 只导入上架交易对
                if (symbol["status"] == "TRADING"):
                    datas.append(symbol)

    return datas


def QA_fetch_binance_kline(symbol, start_time, end_time, frequency):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 7926858da02bd4db873a9e8ca727beb838faad9d
Time: 2020-02-25
Author: 11652964@qq.com
File Name: QUANTAXIS/QAFetch/QAbinance.py
Class Name:
Method Name: QA_fetch_binance_symbols


Project Name: dask/distributed
Commit Name: 6e0c0a6b90b1d3c3f686f0c968e9cf3d0c354413
Time: 2019-05-22
Author: mrocklin@gmail.com
File Name: distributed/nanny.py
Class Name: Nanny
Method Name: close


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 7926858da02bd4db873a9e8ca727beb838faad9d
Time: 2020-02-25
Author: 11652964@qq.com
File Name: QUANTAXIS/QAFetch/QABitmex.py
Class Name:
Method Name: QA_fetch_bitmex_symbols