Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchy of packages #3

Open
milktrader opened this issue Feb 17, 2015 · 6 comments
Open

Hierarchy of packages #3

milktrader opened this issue Feb 17, 2015 · 6 comments

Comments

@milktrader
Copy link
Member

juliaquant

@milktrader milktrader changed the title Diagram of packages Hierarchy of packages Feb 17, 2015
@milktrader
Copy link
Member Author

Here is another WIP

backtesting

@milktrader
Copy link
Member Author

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
Copy link
Contributor

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
Copy link
Member Author

Here is a dependency chart of signals

reactive_grist

@milktrader
Copy link
Member Author

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants