Exemplo n.º 1
0
def execute(traingStart,traingEnd,estimationStart,estimationEnd,key_num,clu_num,days_back):
    "Clear the database data"
    print "Clear Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    data_clear()
    print "Clear End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Divide the Originial News File into Two Parts:Training part and Test Part"
    print "Divide News File Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    divide_archived_news(traingStart,traingEnd,estimationStart,estimationEnd)
    print "Divide News File End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Clustering the time serial Stock index value"
    print "Clustering Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ct.clusterSet(traingStart,traingEnd,clu_num)
    print "Clustering End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Computing the trends contribution and probability"
    print "Trend Contribution Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ctc.compute_trend_contribution(clu_num)
    print "Trend Contribution End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Creating the Vocabulary"
    print "Creating the Vocabulary Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    cv.create_vocabulary(key_num)
    print "Creating the Vocabulary End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Computing the Term Contribution"
    print "Computing the Term Contribution Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ctermc.compute_term_contribution(days_back)
    print "Computing the Term Contribution End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
Exemplo n.º 2
0
def execute(startDate, endDate):
    "Clear the database data"
    print "Clear Start Time: ", datetime.strftime(datetime.now(),
                                                  "%Y-%m-%d %H:%M:%S")
    data_clear()
    print "Clear End Time: ", datetime.strftime(datetime.now(),
                                                "%Y-%m-%d %H:%M:%S")

    "import archieved news data"
    print "import archieved Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    inp.import_news_to_database()
    print "import archieved End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")

    "import the historical stock index"
    print "import stock Index Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    ihs.execute()
    print "import stock Index End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")

    "Divide the Originial News File into Two Parts:Training part and Test Part"
    print "Divide News File Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    divide_archived_news(endDate)
    print "Divide News File End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")

    "Clustering the time serial Stock index value"
    print "Clustering Start Time: ", datetime.strftime(datetime.now(),
                                                       "%Y-%m-%d %H:%M:%S")
    ct.clusterSet(endDate)
    print "Clustering End Time: ", datetime.strftime(datetime.now(),
                                                     "%Y-%m-%d %H:%M:%S")

    "Computing the trends contribution and probability"
    print "Trend Contribution Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    ctc.compute_trend_contribution()
    print "Trend Contribution End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")

    "Creating the Vocabulary"
    print "Creating the Vocabulary Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    cv.create_vocabulary()
    print "Creating the Vocabulary End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")

    "Computing the Term Contribution"
    print "Computing the Term Contribution Start Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
    ctermc.compute_term_contribution()
    print "Computing the Term Contribution End Time: ", datetime.strftime(
        datetime.now(), "%Y-%m-%d %H:%M:%S")
Exemplo n.º 3
0
def execute(traingStart,traingEnd,estimationStart,estimationEnd):
    "Clear the database data"
    print "Clear Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    data_clear()
    print "Clear End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "import archieved news data"
    print "import archieved Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    inp.import_news_to_database()
    print "import archieved End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "import the historical stock index"
    print "import stock Index Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ihs.import_history()
    print "import stock Index End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Divide the Originial News File into Two Parts:Training part and Test Part"
    print "Divide News File Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    divide_archived_news(traingStart,traingEnd,estimationStart,estimationEnd)
    print "Divide News File End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Clustering the time serial Stock index value"
    print "Clustering Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ct.clusterSet(traingStart,traingEnd)
    print "Clustering End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Computing the trends contribution and probability"
    print "Trend Contribution Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ctc.compute_trend_contribution()
    print "Trend Contribution End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Creating the Vocabulary"
    print "Creating the Vocabulary Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    cv.create_vocabulary()
    print "Creating the Vocabulary End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "Computing the Term Contribution"
    print "Computing the Term Contribution Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    ctermc.compute_term_contribution()
    print "Computing the Term Contribution End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    
    "RawNewsProcess Start"
    print "RawNewsProcess Start Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
    get_uncompleted_mission()
    print "RawNewsProcess End Time: ",datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")