Skip to content

Commit

Permalink
pushed server code to merge on local
Browse files Browse the repository at this point in the history
  • Loading branch information
limitless committed Apr 19, 2012
1 parent 1b236aa commit cb40c22
Show file tree
Hide file tree
Showing 6 changed files with 4,565,092 additions and 49 deletions.
15 changes: 3 additions & 12 deletions ai/ann/predict_company.py
Expand Up @@ -9,17 +9,8 @@ def write_to_file(filename, data, name):
f.write(
"""@RELATION %s
@ATTRIBUTE date DATE yyyy-MM-dd
@ATTRIBUTE volume NUMERIC
@ATTRIBUTE high_price NUMERIC
@ATTRIBUTE low_price NUMERIC
@ATTRIBUTE open_price NUMERIC
@ATTRIBUTE close_price NUMERIC
@ATTRIBUTE close_adjusted NUMERIC
@ATTRIBUTE price_change NUMERIC
@ATTRIBUTE short_ema NUMERIC
@ATTRIBUTE long_ema NUMERIC
@ATTRIBUTE macd NUMERIC
@ATTRIBUTE signal_line NUMERIC
@ATTRIBUTE histogram NUMERIC
@ATTRIBUTE target_price NUMERIC
Expand All @@ -36,9 +27,9 @@ def write_to_file(filename, data, name):

def get_company(symbol):
print 'Running ' + symbol + '...'
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='denny', db='limitless')
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='limitless')
cur = conn.cursor()
cur.execute('SELECT date, volume, high_price, low_price, open_price, close_price, close_adjusted, price_change, short_ema, long_ema, macd, signal_line, histogram FROM company_%(symbol)s ORDER BY date' %{'symbol': upper(symbol) })
cur.execute('SELECT date, short_ema, long_ema, histogram FROM company_%(symbol)s ORDER BY date DESC LIMIT 500' %{'symbol': upper(symbol) })

days = datetime.timedelta(22)
train_data = []
Expand Down Expand Up @@ -68,7 +59,7 @@ def get_company(symbol):
os.makedirs(path)


conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='denny', db='limitless')
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='limitless')
cur = conn.cursor()
cur.execute('SELECT symbol FROM companies WHERE avg_volume IS NOT NULL ORDER BY symbol')

Expand Down
3 changes: 2 additions & 1 deletion ai/bayes/create_ema_1day_to_10day.rb
Expand Up @@ -3,7 +3,8 @@
# if the difference is less than .50 then the data will be logged
require 'mysql'
require 'date'

$stdout = File.new('emaweekly.out', 'w')
$stdout.sync = true
#my = Mysql.new(hostname, username, password, databasename)
con = Mysql.new('localhost', 'root', '', 'limitless')
rs = con.query('show tables')
Expand Down

0 comments on commit cb40c22

Please sign in to comment.