Skip to content

Instantly share code, notes, and snippets.

@milktrader
Last active August 29, 2015 14:17
Show Gist options
  • Save milktrader/8f871db1768e94296aba to your computer and use it in GitHub Desktop.
Save milktrader/8f871db1768e94296aba to your computer and use it in GitHub Desktop.
Grist gist
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> trans = Input(0)
0
julia> shares = Input(0)
0
julia> shares = lift(x->shares.value + x, trans)
0
julia> for r in res
push!(trans, r.value.quantity)
@show trans, shares
end
(trans,shares) = ([Reactive.Input{Int64}] 100,[Reactive.Lift{Int64}] 100)
(trans,shares) = ([Reactive.Input{Int64}] -100,[Reactive.Lift{Int64}] 0)
(trans,shares) = ([Reactive.Input{Int64}] 100,[Reactive.Lift{Int64}] 100)
(trans,shares) = ([Reactive.Input{Int64}] -100,[Reactive.Lift{Int64}] 0)
(trans,shares) = ([Reactive.Input{Int64}] 100,[Reactive.Lift{Int64}] 100)
(trans,shares) = ([Reactive.Input{Int64}] -100,[Reactive.Lift{Int64}] 0)
(trans,shares) = ([Reactive.Input{Int64}] 100,[Reactive.Lift{Int64}] 100)
(trans,shares) = ([Reactive.Input{Int64}] -100,[Reactive.Lift{Int64}] 0)
(trans,shares) = ([Reactive.Input{Int64}] 100,[Reactive.Lift{Int64}] 100)
(trans,shares) = ([Reactive.Input{Int64}] -100,[Reactive.Lift{Int64}] 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment