The simple example would look like the following:
CREATE ALGORITHM SimpleAlgorithm
LOAD STOCK HISTORIES FOR stock_symbol FROM dateOne TO dateTwo
IF stock_symbol IS NOT OWNED AND SOLD DATE IS NOT THE SAME AS TODAY
LOAD STOCK HISTORIES FOR stock_symbol LAST 60 plus_minus ENTRIES
CHECK
IF SUM OF stock_plus IS GREATER THAN SUM OF stock_minus
AND LAST price IS GREATER THAN FIRST price
BUY STOCK
ALERT USER
IF stock_symbol IS OWNED AND BOUGHT DATE IS NOT THE SAME AS TODAY
RETRIEVE LAST 60 ENTRIES FOR stock_symbol
CHECK
IF SUM OF stock_minus IS GREATER THAN SUM OF stock_plus
AND LAST price IS LESS THAN FIRST price
SELL STOCK
ALERT USER
The above code will generate a Java class that will extend PredictiveAlgorithm abstract class. The generation will be implemented in Ruby and the code will be posted sometime next month. This implementation makes it a lot easier to generate many algorithm and not have to worry about Java syntax. The 17 lines above would generate quite a few lines of OO code.
No comments:
Post a Comment