예제 #1
0
def get_dominant_future(dt, underlying_symbol):
    """获取某一期货品种策略当前日期的主力合约代码"""
    dt = convert_dt(dt)
    check_string(underlying_symbol)
    store = get_dominant_future_store()
    calendar_store = get_calendar_store()
    current_trade_date = calendar_store.get_current_trade_date(
        get_security_store().get_security('AU9999.XSGE'), dt)
    return store.get_dominant_code(current_trade_date, underlying_symbol)
예제 #2
0
def get_dominant_future(underlying_symbol, dt=None):
    if dt and convert_date(dt) != _get_today():
        dt = dt
    else:
        calendar_store = get_calendar_store()
        dt = calendar_store.get_previous_trade_date(
            get_security_store().get_security('AU9999.XSGE'), _get_today())
    return jqdata.apis.get_dominant_future(dt, underlying_symbol)
    pass
예제 #3
0
def get_future_contracts(dt, underlying_symbol):
    """期货可交易合约列表"""
    dt = convert_dt(dt)
    check_string(underlying_symbol)
    underlying_symbol = underlying_symbol.upper()
    store = get_security_store()
    calendar_store = get_calendar_store()
    current_trade_date = calendar_store.get_current_trade_date(
        get_security_store().get_security('AU9999.XSGE'), dt)
    futures = store.get_all_securities(['futures'], current_trade_date)
    all_code = list(futures.index)
    all_code.sort()
    code = []
    for n in all_code:
        if '9999' not in n and '8888' not in n:
            res = re.findall(r"(.*)[0-9]{4}\.[a-zA-Z]+$", n)
            if len(res) == 1 and underlying_symbol == res[0].upper():
                code.append(n.upper())
    return code
예제 #4
0
 def __init__(self):
     self.cal_store = get_calendar_store()
     self.sec_store = get_security_store()
     self.idx_store = get_index_store()
     self.idst_store = IndustryStore_Sqlite()
     self.extended_store = ExtendedDataGetter()
예제 #5
0
def get_security_info(code):
    if isinstance(code, Security):
        return code
    check_string(code)
    store = get_security_store()
    return store.get_security(code)
예제 #6
0
def get_all_securities(types=[], date=None):
    if is_str(types):
        types = [types]
    store = get_security_store()
    return store.get_all_securities(types, date)
예제 #7
0
def security_by_code(code):
    from jqdata.stores.security_store import get_security_store
    return get_security_store().get_security(code)