org.joone.io
Class YahooFinanceInputSynapse

java.lang.Object
  extended by org.joone.engine.Synapse
      extended by org.joone.io.StreamInputSynapse
          extended by org.joone.io.YahooFinanceInputSynapse
All Implemented Interfaces:
java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable, InputSynapse, PlugInListener

public class YahooFinanceInputSynapse
extends StreamInputSynapse

The YahooFinanceInputSynapse provides support for financial data input from financial markets. The synapse contacts YahooFinance services and downloads historical data for the chosen symbol and date range. Finally the data is presented to the network in reverse date order i.e oldest first.

This synapse provides the following info ..

Open as column 1

High as column 2

Low as column 3

Close as column 4.

Volume as column 5.

Adj.Close as column 6.

For the particular stock symbol.


Developer Notes :

This YahooFinanceInputSynapse uses the following format to extract stock financial information from the Yahoo Network

.

http://table.finance.yahoo.com/table.csv?a=8&b=1&c=2002&d=11&e=3&f=2002&s=tsco.l&y=0&g=d&ignore=.csv


a = From Month 0 - 11

b = From Day 1-31

c = From Year XXXX

d = To Month 0-11

e = To Day 1-31

f = To Year XXXX

s = Symbol

y = [record] from record to + 200 records

g=[d] or[m] or [y] - daily or monthly or yearly

ignore = .csv

See Also:
Serialized Form

Field Summary
(package private)  java.util.Calendar CalendarEnd
           
(package private)  java.util.Calendar CalendarStart
           
(package private)  java.lang.String[] ColumnNames
           
(package private)  java.text.DateFormat date_formater
           
(package private)  java.lang.String DateEnd
           
(package private)  java.lang.String DateStart
           
(package private)  java.lang.String[] freq_conv
           
(package private)  java.lang.String[] frequency
           
(package private)  java.lang.String[] months
           
(package private)  java.lang.String Period
           
(package private) static long serialVersionUID
           
(package private)  java.lang.String Symbol
           
 
Fields inherited from class org.joone.io.StreamInputSynapse
cols, currentRow, EOF, InputVector, plugInListeners, tokens
 
Fields inherited from class org.joone.engine.Synapse
array, b_pattern, bitems, bouts, count, enabled, fwdLock, inps, items, learnable, m_batch, m_pattern, myLearner, outs, revLock
 
Constructor Summary
YahooFinanceInputSynapse()
          Constructor for the YahooFinanceInputSynapse object
 
Method Summary
 java.util.TreeSet check()
          Check that there are no errors or problems with the properties of this YahooFinanceInputSynapse.
 java.lang.String getDateEnd()
          Deprecated. Use getEndDate instead
 java.lang.String getDateStart()
          Deprecated. Use getStartDate instead
 java.util.Date getEndDate()
           
 java.lang.String getPeriod()
          Gets the period for data retrieval.
 java.util.Date getStartDate()
           
 java.util.Vector[] getStockData()
          Gets the stock data retrieived by this synapse.
 java.util.Vector getStockDates()
          Gets the dates associated with each row of data.
 java.lang.String getSymbol()
          Gets the name of the symbol
protected  void initInputStream()
          Connects to Yahoo FInancial Services and obtains the historical data for the specifed symbol and data range.
 void setDateEnd(java.lang.String newDateEnd)
          Gets the the data to which data is retrieved.
 void setDateStart(java.lang.String newDateStart)
          Deprecated. Use setStartDate instead
 void setEndDate(java.util.Date endDate)
           
 void setPeriod(java.lang.String newPeriod)
          Sets the period with which to retrieve data should be one of "Daily" or "Monthly" or "Yearly".
 void setStartDate(java.util.Date startDate)
           
 void setSymbol(java.lang.String newSymbol)
          Deprecated. Use setEndDate instead
 
Methods inherited from class org.joone.io.StreamInputSynapse
addPlugIn, addPlugInListener, backward, dataChanged, fireDataChanged, forward, fwdGet, fwdGet, getAdvancedColumnSelector, getAllPlugInListeners, getCurrentRow, getDecimalPoint, getFirstCol, getFirstRow, getInputPatterns, getInputVector, getLastCol, getLastRow, getMaxBufSize, getPlugIn, getStream, getTokens, gotoFirstLine, gotoLine, handleExceptionWithError, handleExceptionWithWarn, InspectableTitle, Inspections, isBuffered, isEOF, isStepCounter, numColumns, readAll, readObjectBase, removeAllPlugIns, removePlugInListener, reset, resetInput, restart, revPut, setAdvancedColumnSelector, setArrays, setBuffered, setColList, setDecimalPoint, setDimensions, setEOF, setFirstCol, setFirstRow, setInputPatterns, setLastCol, setLastRow, setMaxBufSize, setPlugin, setPlugIn, setStepCounter, setTokens, writeObjectBase, zeroPattern
 
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdPattern_consume, fwdPattern_produce, fwdPut, getCount, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getSynapseNameSafely, getWeights, init, initLearner, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, revGet, revPattern_consume, revPattern_produce, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setMonitor, setName, setOutputDimension, setOutputFull, setWeights, warnLogger, warnLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

months

java.lang.String[] months

frequency

java.lang.String[] frequency

freq_conv

java.lang.String[] freq_conv

Symbol

java.lang.String Symbol

date_formater

java.text.DateFormat date_formater

CalendarStart

java.util.Calendar CalendarStart

CalendarEnd

java.util.Calendar CalendarEnd

DateStart

java.lang.String DateStart

DateEnd

java.lang.String DateEnd

Period

java.lang.String Period

ColumnNames

java.lang.String[] ColumnNames

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

YahooFinanceInputSynapse

public YahooFinanceInputSynapse()
Constructor for the YahooFinanceInputSynapse object

Method Detail

getSymbol

public java.lang.String getSymbol()
Gets the name of the symbol

Returns:
The Symbol name

getDateStart

public java.lang.String getDateStart()
Deprecated. Use getStartDate instead

Gets year to start data retrieval from.

Returns:
The year to start from

getDateEnd

public java.lang.String getDateEnd()
Deprecated. Use getEndDate instead

Gets year to end data retrieval from

Returns:
The year to end on

getPeriod

public java.lang.String getPeriod()
Gets the period for data retrieval.

Returns:
The month to end on

getStockDates

public java.util.Vector getStockDates()
Gets the dates associated with each row of data.


getStockData

public java.util.Vector[] getStockData()

Gets the stock data retrieived by this synapse. Returns the data in a Vector array of length 5.

In column 0 Open data.

In column 1 High

In column 2 Low

In column 3 Close

In column 4 Volume

In column 5 Adj.Close


setSymbol

public void setSymbol(java.lang.String newSymbol)
Deprecated. Use setEndDate instead

Sets the name of the database jdbc driver.

Parameters:
newSymbol - The new stock symbol to retrieve the data with.

setDateStart

public void setDateStart(java.lang.String newDateStart)
Deprecated. Use setStartDate instead

Gets the the data from which data is retrieved.

Parameters:
newDataStart - The data from which data is retrieved.

setDateEnd

public void setDateEnd(java.lang.String newDateEnd)
Gets the the data to which data is retrieved.

Parameters:
newDateEnd - The date to which data is retrieved.

setPeriod

public void setPeriod(java.lang.String newPeriod)
Sets the period with which to retrieve data should be one of "Daily" or "Monthly" or "Yearly".

Parameters:
newPeriod - The period with which data is retieved.

initInputStream

protected void initInputStream()
                        throws JooneRuntimeException
Connects to Yahoo FInancial Services and obtains the historical data for the specifed symbol and data range.

Specified by:
initInputStream in class StreamInputSynapse
Throws:
JooneRuntimeException

check

public java.util.TreeSet check()
Check that there are no errors or problems with the properties of this YahooFinanceInputSynapse.

Specified by:
check in interface NeuralElement
Overrides:
check in class StreamInputSynapse
Returns:
The TreeSet of errors / problems if any.
See Also:
Synapse

getStartDate

public java.util.Date getStartDate()

setStartDate

public void setStartDate(java.util.Date startDate)

getEndDate

public java.util.Date getEndDate()

setEndDate

public void setEndDate(java.util.Date endDate)


Submit Feedback to pmarrone@users.sourceforge.net