Skip to content

Commit

Permalink
Add ticker table
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsamson committed Mar 11, 2016
1 parent 5ec4165 commit 2ab4a1d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
22 changes: 20 additions & 2 deletions web/elm/src/Models.elm
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
module Models (..) where

type alias AppModel =
{ ticker : String }
{ ticker : String
, venue : String
, bid : Int
, ask : Int
, price : Int
, bidSize : Int
, askSize : Int
, bidDepth : Int
, askDepth : Int
}

initialModel : AppModel
initialModel =
{ ticker = "NYC" }
{ ticker = "NYC"
, venue = "OBEX"
, bid = 4000
, ask = 4100
, price = 4050
, bidSize = 10
, askSize = 10
, bidDepth = 100
, askDepth = 100
}
42 changes: 39 additions & 3 deletions web/elm/src/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ import Actions exposing (..)
import Models exposing (..)

type alias ViewModel =
{ ticker : String }
{ ticker : String
, venue : String
, bid : Int
, ask : Int
, price : Int
, bidSize : Int
, askSize : Int
, bidDepth : Int
, askDepth : Int
}

view : Signal.Address Action -> ViewModel -> Html.Html
view address model =
Expand Down Expand Up @@ -39,5 +48,32 @@ brandLink address model =

tickerTable : Signal.Address Action -> ViewModel -> Html.Html
tickerTable address model =
p
[][ text model.ticker ]
table
[ class "table table-bordered" ]
[ thead
[]
[ tr
[]
[ th [] [ text "Ticker" ]
, th [] [ text "Venue" ]
, th [] [ text "Bid" ]
, th [] [ text "Ask" ]
, th [] [ text "Last" ]
, th [] [ text "Bid Size/Depth" ]
, th [] [ text "Ask Size/Depth" ]
]
]
, tbody
[]
[ tr
[]
[ td [] [ text model.ticker ]
, td [] [ text model.venue ]
, td [] [ text (toString model.bid) ]
, td [] [ text (toString model.ask) ]
, td [] [ text (toString model.price) ]
, td [] [ text ((toString model.bidSize) ++ " / " ++ (toString model.bidDepth)) ]
, td [] [ text ((toString model.askSize) ++ " / " ++ (toString model.askDepth)) ]
]
]
]

0 comments on commit 2ab4a1d

Please sign in to comment.