Skip to content

Use Reactive to solve this problem #2

Open
@milktrader

Description

@milktrader

For convenience, the dev/tenblotters.jl file will be exported while this is being solved. It brings in the MarketData package and two variables, res and vals.

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

julia> vals
10-element Array{Float64,1}:
  11194.0
 -11625.0
   8727.0
  -4794.0
   2012.0
  -1481.0
   1956.0
  -2323.0
   1950.0
  -1830.0

The problem to solve is to keep track of the account value everyday for two years, given these trades.

The daily closing prices can be found in the cl const provided by MarketData.

julia> using MarketData

julia> cl
500x1 TimeSeries.TimeArray{Float64,1,DataType} 2000-01-03 to 2001-12-31

             Close     
2000-01-03 | 111.94    
2000-01-04 | 102.5     
2000-01-05 | 104.0     
2000-01-06 | 95.0      

2001-12-26 | 21.49     
2001-12-27 | 22.07     
2001-12-28 | 22.43     
2001-12-31 | 21.9     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions