JuliaQuant / Roadmap

High-level overview of group's goals and objectives
12 stars 5 forks source link

Hierarchy of packages #3

Open milktrader opened 9 years ago

milktrader commented 9 years ago

juliaquant

milktrader commented 9 years ago

Here is another WIP

backtesting

milktrader commented 9 years ago

I'm wondering if we need a blotter at all. Why not just have the fill simulator update the account (with cash balance) and portfolio (with asset attributes)?

The challenge would be to conceive of how to track PnL, historic drawdowns, etc.

multidis commented 9 years ago

PnL, drawdowns etc. are dependent on past signal history only, so in principle it should be possible to track those in dependent lift-signals. But an array-like structure with all recorded transactions is probably still needed.

milktrader commented 9 years ago

Here is a dependency chart of signals

reactive_grist

milktrader commented 9 years ago

The fill simulator (TradingLogic) generates the transaction, or more accurately updates the transaction signal which then affects the cash balance signal and the asset quantity signals.

asset quantity updates the portfolio value signal along with the closing price signal and would take precedence when they happen on the same day.

Finally, the account value signal gets updates by two signals as well, the portfolio value and the cash balance.

What I'm not sure about is how to organize this application inside a foldl framework (or what Elm calls the foldp framework)

Another missing piece is a time machine, which would be used to generate equity and drawdown curves.

milktrader commented 9 years ago

The common approach to creating the accounting structure is to log each transaction in a blotter. The Grist package does this with the following example:

julia> res
10-element Array{Timestamps.Timestamp{T},1}:
 2000-01-03 |  100      Stock         111.94  $    AAPL
 2000-03-15 | -100      Stock         116.25  $    AAPL
 2000-05-25 |  100      Stock          87.27  $    AAPL
 2000-08-07 | -100      Stock          47.94  $    AAPL
 2000-10-17 |  100      Stock          20.12  $    AAPL
 2000-12-28 | -100      Stock          14.81  $    AAPL
 2001-03-13 |  100      Stock          19.56  $    AAPL
 2001-05-23 | -100      Stock          23.23  $    AAPL
 2001-08-03 |  100      Stock           19.5  $    AAPL
 2001-10-19 | -100      Stock           18.3  $    AAPL

If a reactive framework is used instead, this blotter would need to be derived from a time machine, as the transaction signal would only contain the value for the last value