Code Monkey home page Code Monkey logo

grist.jl's Introduction

Grist is a financial blotter.

Documentation is planned here.

julia> Pkg.clone("https://github.com/JuliaQuant/Grist.jl.git")

This is a current API tour (subject to change, of course):

julia> using Grist

julia> a = LongCall(:CAT, 1.11, 115.);

julia> a.quantity = 100
100

julia>  b = Stock(:BA, 100.11);

julia> b.quantity = 1000
1000

julia> c = Stock(:AAPL, 102);

julia> c.currency = EUR;

julia> c.quantity = -100;

julia> d = Date(2015,3,12);

julia> foo = Timestamp(d - Day(15), a);

julia> bar = Timestamp(d - Day(7), b);

julia> baz = Timestamp(d , c)
2015-03-12 | -100      Stock         102.0   €    AAPL

julia>  res = [foo, bar, baz]
3-element Array{Timestamps.Timestamp{T},1}:
 2015-02-25 |  100      LongCall        1.11  $    CAT 
 2015-03-05 |  1000     Stock         100.11  $    BA  
 2015-03-12 | -100      Stock         102.0   €    AAPL

julia> res[:BA]
1-element Array{Timestamps.Timestamp{T},1}:
 2015-03-05 |  1000     Stock         100.11  $    BA

julia>  res[LongCall]
1-element Array{Timestamps.Timestamp{T},1}:
 2015-02-25 |  100      LongCall        1.11  $    CAT

julia> res[EUR]
1-element Array{Timestamps.Timestamp{T},1}:
 2015-03-12 | -100      Stock         102.0   €    AAPL

julia> res[d-Day(14):d]
2-element Array{Timestamps.Timestamp{T},1}:
 2015-03-05 |  1000     Stock         100.11  $    BA  
 2015-03-12 | -100      Stock         102.0   €    AAPL

grist.jl's People

Stargazers

N4v41 avatar Iblis Lin avatar Chip Kent avatar Paul Milovanov avatar  avatar

Watchers

 avatar Avik Sengupta avatar Iblis Lin avatar James Cloos avatar Pavel Paramonov avatar  avatar

grist.jl's Issues

Use Reactive to solve this problem

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     

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.