Ejemplo n.º 1
0
    def __getMyDBSession(self):

        TargetDayLog().getLog().info("获取数据库连接会话")
        mySqlDB = MySqlDBConnection()
        mySqlDBSession = mySqlDB.getMysqlDBSession()
        TargetDayLog().getLog().info("已获取数据库连接会话")

        return mySqlDBSession
Ejemplo n.º 2
0
    def __getMyDBSession(self):

        KLineMonthLog().getLog().info("获取数据库连接会话")
        mySqlDB = MySqlDBConnection()
        mySqlDBSession = mySqlDB.getMysqlDBSession()
        KLineMonthLog().getLog().info("已获取数据库连接会话")

        return mySqlDBSession
Ejemplo n.º 3
0
    def __getMyDBSession(self):

        StockBasicLog().getLog().info("获取数据库连接会话")
        mySqlDB = MySqlDBConnection()
        mySqlDBSession = mySqlDB.getMysqlDBSession()
        StockBasicLog().getLog().info("已获取数据库连接会话")

        return mySqlDBSession
Ejemplo n.º 4
0
    def __getMyDBSession(self):

        AlgorithmLog().getLog().info("获取数据库连接会话")
        mySqlDB = MySqlDBConnection()
        mySqlDBSession = mySqlDB.getMysqlDBSession()
        AlgorithmLog().getLog().info("已获取数据库连接会话")

        return mySqlDBSession
Ejemplo n.º 5
0
 def __getMyDBSession( self ):
     
     ReinstatedLog().getLog().info( "获取数据库连接会话" )
     mySqlDB = MySqlDBConnection()
     mySqlDBSession = mySqlDB.getMysqlDBSession()
     ReinstatedLog().getLog().info( "已获取数据库连接会话" )
     
     return mySqlDBSession
Ejemplo n.º 6
0
 def __getMyDBSession( self ):
     
     MarketIndexDayTargetLog().getLog().info( "获取数据库连接会话" )
     mySqlDB = MySqlDBConnection()
     mySqlDBSession = mySqlDB.getMysqlDBSession()
     MarketIndexDayTargetLog().getLog().info( "已获取数据库连接会话" )
     
     return mySqlDBSession
Ejemplo n.º 7
0
def getAllStock():
    mysqlDBSession = MySqlDBConnection().getMysqlDBSession()
    result = mysqlDBSession.execute( text( "select ts_code, name from stock_basic" ) )
    
    datas = []
    for res in result:
        datas.append( { "tsCode": res[ 0 ], "name": res[ 1 ] } )
        
    result.close()
    mysqlDBSession.close()
    
    return datas
Ejemplo n.º 8
0
    def getIndexDatas(self, SQL):

        StatisticsLog().getLog().info("开始获取指数基础数据")

        mySqlDBSession = MySqlDBConnection().getMysqlDBSession()
        result = mySqlDBSession.execute(text(SQL))

        datas = []
        for row in result:
            datas.append([row[0], row[1], row[2], row[3], row[4]])

        result.close()
        mySqlDBSession.close()

        StatisticsLog().getLog().info("获取指数数据完毕")

        return datas
Ejemplo n.º 9
0
    def getStockDatas(self, SQL, tsCode):

        StatisticsLog().getLog().info("开始获取股票基础数据")

        mySqlDBSession = MySqlDBConnection().getMysqlDBSession()
        result = mySqlDBSession.execute(text(SQL), {"tsCode": tsCode})

        datas = []
        for row in result:
            datas.append([row[0], row[1], row[2], row[3], row[4]])

        result.close()
        mySqlDBSession.close()

        StatisticsLog().getLog().info("获取股票基础数据完毕")

        return datas
Ejemplo n.º 10
0
def getAllSZSEIndex():
    mysqlDBSession = MySqlDBConnection().getMysqlDBSession()
    result = mysqlDBSession.execute( text( "select trade_date, `open`, high, low, `close`, `vol` from index_line_day_szse where ts_code=:tsCode order by trade_date" ) )
    
    datas = []
    index = 0
    for row in result:
        tradeDate = row[ 0 ]
        open1 = row[ 1 ]    # 不知为啥,open会有警告,所以改成open1
        high = row[ 2 ]
        low = row[ 3 ]
        close = row[ 4 ]
        volume = row[ 5 ]

        datas.insert( index, [ tradeDate, open1, close, low, high, volume ] )
        index += 1
        
    result.close()
    mysqlDBSession.close()
    
    return datas
Ejemplo n.º 11
0
    def getAllNameChangeDatas(self):

        StatisticsLog().getLog().info("开始加载股票曾用名数据")

        mySqlDBSession = MySqlDBConnection().getMysqlDBSession()
        #         result = mySqlDBSession.execute( text( "select ts_code, name, start_date, end_date, change_reason from name_change where ts_code='600539.SH' order by ts_code, start_date asc" ) )
        result = mySqlDBSession.execute(
            text(
                "select ts_code, name, start_date, end_date, change_reason from name_change order by ts_code, start_date asc"
            ))

        datas = []
        for row in result:
            datas.append([row[0], row[1], row[2], row[3], row[4]])

        result.close()
        mySqlDBSession.close()

        StatisticsLog().getLog().info("股票曾用名数据加载完毕")

        return datas
Ejemplo n.º 12
0
    def getTsCodes(self):

        StatisticsLog().getLog().info("开始获取股票基础数据")

        mySqlDBSession = MySqlDBConnection().getMysqlDBSession()
        result = mySqlDBSession.execute(
            text("select ts_code from stock_basic"))
        mySqlDBSession.close()

        datas = []
        for row in result:
            datas.append(row[0])

        result.close()
        mySqlDBSession.close()

        StatisticsLog().getLog().info("获取股票基础数据完毕")

        return datas