Exemplo n.º 1
0
def getZscore(conn,cur_date,stock_index,cur_diff,duration):
    cur = conn.cursor()
    scores = []
    sql = "select one_day_change from t_enriched_bloomberg_prices where post_date<? and name = ? order by post_date desc limit ?"
    cur.execute(sql,(cur_date,stock_index,duration))
    rows = cur.fetchall()
    for row in rows:
        scores.append(row[0])
    zscore = calculator.calZscore(scores, cur_diff)
    return zscore
Exemplo n.º 2
0
def getZscore(curDate,stockIndex,curDiff,duration):
    con = common.getDBConnection()
    cur = con.cursor()
    scores = []
    sql = "select one_day_change from t_daily_stockindices where date<? and stock_index = ? order by date desc limit ?"
    cur.execute(sql,(curDate,stockIndex,duration))
    rows = cur.fetchall()
    for row in rows:
        scores.append(row[0])
    zscore = calculator.calZscore(scores, curDiff)
    return zscore           
Exemplo n.º 3
0
def getZscore(curDate,stockIndex,curDiff,duration):
    global con
    global cur
    scores = []
    sql = "select one_day_difference from t_daily_stockindex where date<? and stock_index = ? order by date desc limit ?"
    cur.execute(sql,(curDate,stockIndex,duration))
    rows = cur.fetchall()
    for row in rows:
        scores.append(row[0])
    zscore = calculator.calZscore(scores, curDiff)
    return zscore
Exemplo n.º 4
0
import json
import numpy
import nltk
import sys
from Util import calculator
import sqlite3 as lite


news = open('D:/filterBloombergArray.json')
jsonNews = json.load(news,encoding='ISO-8859-1')

print calculator.calZscore([1,1,1,1,1],1)

clusterDis = json.load(open("d:/embers/financemodel/clusterDistribution.json"))
print clusterDis

result = open("d:/embers/financemodel/TestPredict.txt")
lines = result.readlines()
for line in lines:
#    print line
    tokens = [token.replace("\t","") for token in line.strip().split("\t")]
    date = tokens[1]
    pClusster = tokens[4]
    print date,pClusster


con = None
try:
    con = lite.connect("d:/sqlite/embers.db")
    cur = con.cursor()
    cur.execute('select sqlite_version()')
Exemplo n.º 5
0
import json
import numpy
import nltk
import sys
from Util import calculator
import sqlite3 as lite

news = open('D:/filterBloombergArray.json')
jsonNews = json.load(news, encoding='ISO-8859-1')

print calculator.calZscore([1, 1, 1, 1, 1], 1)

clusterDis = json.load(open("d:/embers/financemodel/clusterDistribution.json"))
print clusterDis

result = open("d:/embers/financemodel/TestPredict.txt")
lines = result.readlines()
for line in lines:
    #    print line
    tokens = [token.replace("\t", "") for token in line.strip().split("\t")]
    date = tokens[1]
    pClusster = tokens[4]
    print date, pClusster

con = None
try:
    con = lite.connect("d:/sqlite/embers.db")
    cur = con.cursor()
    cur.execute('select sqlite_version()')
    data = cur.fetchone()
    print "Sqlite Version: %s" % data