# Path: kquant_data/wind/utils.py
# def asDateTime(v, asDate=False):
#     """
#     万得中读出来的时间总多5ms，覆写这部分
#     w.asDateTime = asDateTime
#     w.start()
#     :param v:
#     :param asDate:
#     :return:
#     """
#     # return datetime(1899, 12, 30, 0, 0, 0, 0) + timedelta(v + 0.005 / 3600 / 24)
#     return datetime(1899, 12, 30, 0, 0, 0, 0) + timedelta(v)


import pandas as pd
from .utils import asDateTime
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""

w.tdays("2017-02-02", "2017-03-02", "")
w.tdays("2017-02-02", "2017-03-02", "Days=Weekdays")
w.tdays("2017-02-02", "2017-03-02", "Days=Alldays")
w.tdays("2017-02-02", "2017-03-02", "TradingCalendar=SHFE")
"""


def download_tdays(w, startdate, enddate, option=''):
    """
    下载交易日数据
    :param w:
    :param startdate:
    :param enddate:
    :param option:
    :return:
    """

# Path: kquant_data/wind/utils.py
# def asDateTime(v, asDate=False):
#     """
#     万得中读出来的时间总多5ms，覆写这部分
#     w.asDateTime = asDateTime
#     w.start()
#     :param v:
#     :param asDate:
#     :return:
#     """
#     # return datetime(1899, 12, 30, 0, 0, 0, 0) + timedelta(v + 0.005 / 3600 / 24)
#     return datetime(1899, 12, 30, 0, 0, 0, 0) + timedelta(v)


# Path: kquant_data/wind/tdays.py
import pandas as pd
from .utils import asDateTime

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""

w.tdays("2017-02-02", "2017-03-02", "")
w.tdays("2017-02-02", "2017-03-02", "Days=Weekdays")
w.tdays("2017-02-02", "2017-03-02", "Days=Alldays")
w.tdays("2017-02-02", "2017-03-02", "TradingCalendar=SHFE")
"""


def download_tdays(w, startdate, enddate, option=''):
    """
    下载交易日数据
    :param w:
    :param startdate:
    :param enddate:
    :param option:
    :return:
    """

    w.asDateTime = asDateTime