|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mov.analyser.gp.Individual
public class Individual
A trading individual evovled by the GP. The Individual contains a buy rule and a sell rule that will have been evolved by the GP.
GeneticProgramme
,
Mutator
Constructor Summary | |
---|---|
Individual(Expression buyRule,
Expression sellRule)
Create a new individual with the given buy and sell rules. |
|
Individual(Mutator buyRuleMutator,
Mutator sellRuleMutator)
Randomly generate an individual using the two mutators. |
|
Individual(java.util.Random random,
Mutator buyRuleMutator,
Mutator sellRuleMutator,
Individual father,
Individual mother)
Create a new individual by "breeding" or combining the two parent individuals. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object object)
Compare the individuals' final values. |
boolean |
equals(java.lang.Object object)
Test the invidiuals' final values for equality. |
Expression |
getBuyRule()
Get the buy rule. |
Portfolio |
getPortfolio()
Get the final portfolio. |
Expression |
getSellRule()
Get the sell rule. |
int |
getTotalEquationSize()
Return the combined number of nodes of both the buy and sell rules. |
Money |
getValue()
Get the final value of the individual after paper trading. |
int |
hashCode()
Calculate a hash code for the individual. |
boolean |
isValid(int min,
int max)
Check that the given buy and sell rules are valid. |
Money |
paperTrade(GPQuoteBundle quoteBundle,
OrderCache orderCache,
TradingDate startDate,
TradingDate endDate,
Money initialCapital,
Money stockValue,
int numberStocks,
Money tradeCost,
java.lang.String tradeValueBuy,
java.lang.String tradeValueSell)
Paper trade with the individual's buy and sell rules. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Individual(Expression buyRule, Expression sellRule)
buyRule
- the buy indicatorsellRule
- the sell indicatorpublic Individual(Mutator buyRuleMutator, Mutator sellRuleMutator)
buyRuleMutator
- mutator used for creating buy rulesellRuleMutator
- mutator used for creating sell rulepublic Individual(java.util.Random random, Mutator buyRuleMutator, Mutator sellRuleMutator, Individual father, Individual mother)
random
- the random number generatorbuyRuleMutator
- mutator used for mutating buy rulesellRuleMutator
- mutator used for mutating sell rulefather
- one parent individualmother
- another parent individualMethod Detail |
---|
public boolean isValid(int min, int max)
The minimum size check is to prevent us wasting time on too simplistic rules. The maximum size check is to prevent rules exponentially increasing and so reduce CPU time. We reject rules not based on quote data as also being too simplistic to be worthwhile.
min
- the minimum number of nodes in each rulemax
- the maximum number of nodes in each rule
true
if both rules are validpublic int getTotalEquationSize()
public Money paperTrade(GPQuoteBundle quoteBundle, OrderCache orderCache, TradingDate startDate, TradingDate endDate, Money initialCapital, Money stockValue, int numberStocks, Money tradeCost, java.lang.String tradeValueBuy, java.lang.String tradeValueSell) throws EvaluationException
stockValue
to null
to trade by number of stocks in the portfolio.
quoteBundle
- the historical quote dataorderCache
- cache of ordered symbolsstartDate
- start date of tradingendDate
- last date of tradinginitialCapital
- initial capital in the portfoliostockValue
- the rough value of each stock holdingnumberStocks
- number of stocks in the portfoliotradeCost
- the cost of a trade
EvaluationException
public Money getValue()
public Expression getBuyRule()
public Expression getSellRule()
public Portfolio getPortfolio()
public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
object
- the other individual
-1
if this individual is worth less,
0
if the individuals are worth the same or
1
if this individual is worth more.public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
true
if the two individuals are worth the samepublic int hashCode()
hashCode
in class java.lang.Object
|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |