Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.joone.io
Class YahooFinanceInputSynapse  view YahooFinanceInputSynapse download YahooFinanceInputSynapse.java

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

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


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
           
private static org.joone.log.ILogger log
          The object used when logging debug,errors,warnings and info.
(package private)  java.lang.String[] months
           
(package private)  java.lang.String Period
           
(package private) static long serialVersionUID
           
private  java.util.Vector[] StockData
           
private  java.util.Vector StockDates
           
(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, notFirstTime, notFirstTimeB, outs, revLock
 
Constructor Summary
YahooFinanceInputSynapse()
          Constructor for the YahooFinanceInputSynapse object
 
Method Summary
private  int AddURLToMemory(java.net.URL Data)
          Adds data from a URL in CSV format to Memory
 java.util.TreeSet check()
          Check that there are no errors or problems with the properties of this YahooFinanceInputSynapse.
 java.lang.String getDateEnd()
          Gets year to end data retrieval from
 java.lang.String getDateStart()
          Gets year to start data retrieval from.
 java.lang.String getPeriod()
          Gets the period for data retrieval.
 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.
private  void readObject(java.io.ObjectInputStream in)
          Reads this YahooFinanceInputSynapse object into memory from the specified object stream.
 void setDateEnd(java.lang.String newDateEnd)
          Gets the the data to which data is retrieved.
 void setDateStart(java.lang.String newDateStart)
          Gets the the data from which data is retrieved.
 void setPeriod(java.lang.String newPeriod)
          Sets the period with which to retrieve data should be one of "Daily" or "Monthly" or "Yearly".
 void setSymbol(java.lang.String newSymbol)
          Sets the name of the database jdbc driver.
private  void writeObject(java.io.ObjectOutputStream out)
          Writes this YahooFInanceSynapseInput object to the ObjectOutputStream out.
 
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, InspectableTitle, Inspections, isBuffered, isEOF, isStepCounter, numColumns, readAll, readObjectBase, removeAllPlugIns, removePlugInListener, reset, resetInput, 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, fwdPut, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getWeights, init, initLearner, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, revGet, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setMonitor, setName, setOutputDimension, setOutputFull, setWeights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.joone.log.ILogger log
The object used when logging debug,errors,warnings and info.


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

StockData

private java.util.Vector[] StockData

StockDates

private java.util.Vector StockDates

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


getDateStart

public java.lang.String getDateStart()
Gets year to start data retrieval from.


getDateEnd

public java.lang.String getDateEnd()
Gets year to end data retrieval from


getPeriod

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


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


readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads this YahooFinanceInputSynapse object into memory from the specified object stream.


setSymbol

public void setSymbol(java.lang.String newSymbol)
Sets the name of the database jdbc driver.


setDateStart

public void setDateStart(java.lang.String newDateStart)
Gets the the data from which data is retrieved.


setDateEnd

public void setDateEnd(java.lang.String newDateEnd)
Gets the the data 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".


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes this YahooFInanceSynapseInput object to the ObjectOutputStream out.


initInputStream

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

Specified by:
initInputStream in class StreamInputSynapse

AddURLToMemory

private int AddURLToMemory(java.net.URL Data)
                    throws java.io.IOException
Adds data from a URL in CSV format to Memory


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 org.joone.engine.NeuralElement
Overrides:
check in class StreamInputSynapse