An Approach to the Markets

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Analytics.Trading.Data.Approach where

-- tells us under what conditions we buy or sell
-- but is it a ... GOOD approach? Hm.

import Analytics.Trading.Data.Advice           -- http://lpaste.net/109712

data Strategy a = -- the strategy is an arm of an approach, particularly
                  -- tailored to the buying or to the selling decision
   Strat { nshares :: Int, distance :: Distance a, trailing :: Int }
      deriving Show

data Distance a = -- gives how far apart or within an indicator is to
                -- the measured datum of the security
   Within (Measure a) | Beyond (Measure a)
      deriving Show

data Measure a = Percent a | Magnitude a
   deriving Show

data Approach a = Approach { buy :: Strategy a, sell :: Strategy a } 
   deriving Show