Example #1
0
def show_save_moviedetail(id_indb, details):
    if not details:
        print('No movie details')
        return

    print('-------------------------------------')
    print('id:' + details[0])
    print('en_title:' + details[1])
    print('cn_title:' + details[2])
    print('year:' + details[3])
    print('img Link:' + details[4])
    print('link:' + details[5])
    print('-------------------------------------')
    dbutil.insert(id_indb, details)
Example #2
0
import dbutil

print('start')
while True:
    menu = input('Input menu: i,s,sa,q')
    if menu == 'q':
        print('bye')
        break
    if menu == 'i':
        datas = input('Input information..')
        datas = datas.split(' ')
        dbutil.insert(id=datas[0].strip(),
                      pwd=datas[1].strip(),
                      name=datas[2].strip(),
                      age=int(datas[3].strip()))

    if menu == 'sa':
        users = dbutil.selectall()
        #list안에 List
        #for n in range(len(users)):
        # print(users[n]);

        for user in users:
            print('User info: %s %s %s %d' %
                  (user[0], user[1], user[2], user[3]))

    if menu == 's':
        id = input('input user id..')
        user = dbutil.select(id=id)
        print('User Info %s %s %s %d ' % (user[0], user[1], user[2], user[3]))
Example #3
0
def insertDaily(conn, df):
    """	插入每日因子残差数据表
	"""
    metadata = MetaData()
    residtb = Table(
        'FactorDailyResidual',
        metadata,
        Column('TradingDay', DateTime(), nullable=False),
        Column('SecuCode', String(10), nullable=False),
        Column('ClosePrice', Numeric(16, 4)),
        Column('OpenPrice', Numeric(16, 4)),
        Column('HighPrice', Numeric(16, 4)),
        Column('LowPrice', Numeric(16, 4)),
        Column('ExeClosePrice', Numeric(16, 4)),
        Column('ExeOpenPrice', Numeric(16, 4)),
        Column('ExeHighPrice', Numeric(16, 4)),
        Column('ExeLowPrice', Numeric(16, 4)),
        Column('NonRestrictedShares', Numeric(16, 0)),
        Column('AFloats', Numeric(16, 0)),
        Column('TotalShares', Numeric(16, 0)),
        Column('TurnoverVolume', Numeric(20, 0)),
        Column('NonRestrictedCap', Numeric(36, 4)),
        Column('AFloatsCap', Numeric(36, 4)),
        Column('TotalCap', Numeric(36, 4)),
        Column('SecuAbbr', String(50)),
        Column('IndustrySecuCode_I', String(10)),
        Column('PE', Numeric(38, 6)),
        Column('PB', Numeric(38, 6)),
        Column('PS', Numeric(38, 6)),
        Column('PCF', Numeric(38, 6)),
        Column('DividendYield', Numeric(16, 6)),
        Column('DividendRatio', Numeric(16, 6)),
        Column('TTMIncome', Numeric(36, 4)),
        Column('GP_Margin', Numeric(16, 4)),
        Column('NP_Margin', Numeric(16, 4)),
        Column('ROA', Numeric(16, 4)),
        Column('ROE', Numeric(16, 4)),
        Column('AssetsTurnover', Numeric(16, 4)),
        Column('EquityTurnover', Numeric(16, 4)),
        Column('Cash_to_Assets', Numeric(16, 4)),
        Column('Liability_to_Assets', Numeric(16, 4)),
        Column('EquityMultiplier', Numeric(16, 4)),
        Column('CurrentRatio', Numeric(16, 4)),
        Column('Income_Growth_YOY_Comparable', Numeric(16, 4)),
        Column('NPPC_Growth_YOY_Comparable', Numeric(16, 4)),
        Column('GP_Margin_Comparable', Numeric(16, 4)),
        Column('GP_Margin_Growth_YOY_Comparable', Numeric(16, 4)),
        Column('NP_Margin_Comparable', Numeric(16, 4)),
        Column('NP_Margin_Growth_YOY_Comparable', Numeric(16, 4)),
        Column('Income_Growth_Pre_Comparable', Numeric(16, 4)),
        Column('NPPC_Growth_Pre_Comparable', Numeric(16, 4)),
        Column('GP_Margin_Growth_Pre_Comparable', Numeric(16, 4)),
        Column('NP_Margin_Growth_Pre_Comparable', Numeric(16, 4)),
        Column('NPPC_Growth_Pre_Season', Numeric(16, 4)),
        Column('NPPC_Growth_YOY_Season', Numeric(16, 4)),
        Column('NPLNRP_Growth_Pre_Season', Numeric(32, 14)),
        Column('NPLNRP_Growth_YOY_Season', Numeric(32, 15)),
        Column('Income_Growth_Pre_Season', Numeric(16, 4)),
        Column('Income_Growth_YOY_Season', Numeric(16, 4)),
        Column('Income_Growth_Qtr_Comparable', Numeric(16, 4)),
        Column('NPPC_Growth_Qtr_Comparable', Numeric(16, 4)),
        Column('GP_Margin_Qtr', Numeric(16, 4)),
        Column('GP_Margin_Growth_Qtr_Comparable', Numeric(16, 4)),
        Column('IPS_Qtr', Numeric(32, 21)),
        Column('EPS_Qtr', Numeric(32, 21)),
        Column('ROE_Qtr', Numeric(16, 4)),
        Column('Income_Growth_Pre', Numeric(16, 4)),
        Column('NPPC_Growth_Pre', Numeric(16, 4)),
        Column('NPLNRP_Growth_Pre', Numeric(32, 13)),
        Column('GP_Margin_Growth_Pre', Numeric(16, 4)),
        Column('NP_Margin_Growth_Pre', Numeric(16, 4)),
        Column('Income_Growth_YOY', Numeric(16, 4)),
        Column('NPPC_Growth_YOY', Numeric(16, 4)),
        Column('NPLNRP_Growth_YOY', Numeric(32, 13)),
        Column('GP_Margin_Growth_YOY', Numeric(16, 4)),
        Column('NP_Margin_Growth_YOY', Numeric(16, 4)),
        Column('IPS', Numeric(32, 21)),
        Column('EPS', Numeric(32, 21)),
        Column('CFPS', Numeric(32, 21)),
        Column('Pre_IPS', Numeric(32, 21)),
        Column('Pre_EPS', Numeric(32, 21)),
        Column('Pre_CFPS', Numeric(32, 21)),
        Column('YOY_IPS', Numeric(32, 21)),
        Column('YOY_EPS', Numeric(32, 21)),
        Column('YOY_CFPS', Numeric(32, 21)),
        Column('rPE', Numeric(32, 10)),
        Column('rPB', Numeric(32, 10)),
        Column('rPS', Numeric(32, 10)),
        Column('rPCF', Numeric(32, 10)),
        Column('SettlePrice', Numeric(16, 10)),
        Column('IndusInnerCode', Integer()),
        Column('IndusCreatePrice', Numeric(16, 10)),
        Column('IndusSettlePrice', Numeric(16, 10)),
        Column('ExecutivesProp', Numeric(16, 10)),
        Column('InstitutionNum', Integer()),
        Column('InstitutionProp', Numeric(16, 10)),
        Column('RegionScore', Integer()),
        Column('ExeClosePrice_CreateDate_Wind', Numeric(16, 4)),
        Column('ExeClosePrice_SettleDate_Wind', Numeric(16, 4)),
        Column('Momentum20Day', Numeric(20, 4)),
        Column('Momentum40Day', Numeric(20, 4)),
        Column('Momentum60Day', Numeric(20, 4)),
        Column('Momentum120Day', Numeric(20, 4)),
        Column('Momentum180Day', Numeric(20, 4)),
        Column('Momentum240Day', Numeric(20, 4)),
        Column('PriceDiff', Numeric(20, 4)),
        Column('DayDiff', Integer()),
        Column('TurnoverRatio', Numeric(20, 4)),
        Column('AvgTurnoverPrice', Numeric(20, 4)),
        Column('AvgTurnoverPriceFactor', Numeric(20, 4)),
        Column('AvgTurnoverRatio5Day', Numeric(20, 5)),
        Column('AvgTurnoverRatio10Day', Numeric(20, 5)),
        Column('AvgTurnoverRatio20Day', Numeric(20, 5)),
        Column('AvgTurnoverRatio40Day', Numeric(20, 5)),
        Column('AvgTurnoverRatio60Day', Numeric(20, 5)),
        Column('AvgTurnoverRatio120Day', Numeric(20, 5)),
        Column('E_EPS', Numeric(16, 4)),
        Column('E_growth', Numeric(16, 4)),
        Column('FreeFloat_Total', Numeric(16, 4)),
        Column('EPS_CFPS', Numeric(32, 21)),
    )

    dbutil.insert(conn, residtb, df)