1. 为上层提供一些可以让用户选择的参数,如股票代码,时间参数,预测股票价格类型(开盘收盘最高最低)
include("predict.jl")
#example
#stockCode ="000001"
#startDateTime ="2012-03-01"
#endDateTime ="2013-03-01"
#predictName = "close"
#predict(stockCode,startDateTime,endDateTime,predictName)
#example
stockCode ="000002"
startDateTime ="2012-03-01"
endDateTime ="2013-12-01"
predictName = "close"
result=predict(stockCode,startDateTime,endDateTime,predictName)
println("---------------------------------------")
println("Predict Result ----->" * string(result))
using DataFrames
using ODBC
using MATLAB
function predict(stockCode::String, startDateTime::String, endDateTime::String, predictName::String)
co = ODBC.connect("stock",usr="stock",pwd="root")
count = query("select count(*) from day_quotes t where stockcode = " * stockCode * " and datetime >= to_date('"* startDateTime *"','yyyy-MM-dd') and datetime <= to_date('"* endDateTime *"','yyyy-MM-dd')")
dataFrame=query("select " * predictName * " from day_quotes t where stockcode = " * stockCode * " and datetime >= to_date('"* startDateTime *"','yyyy-MM-dd') and datetime <= to_date('"* endDateTime *"','yyyy-MM-dd')",co,"",',', int(count[1][1]))
mx = float(dataFrame[1])
result = mxcall(:esmoothSerie,2,mx,0.6)
return result[1]
end