Sort securities
This commit is contained in:
1 parent
6454ea16ae
commit
97a2ff9adf
3 files changed
+65
-4
No files matched your search
@@ -810,7 +810,7 @@ let getPositionSecMap (sList:(uint32 * PositionSecurity) list) venue symbol =
|
||||
)
|
||||
|> List.map (fun i -> (sprintf "%O" (fst i)), (snd i).securityName)
|
||||
|> List.distinct
|
||||
|> Map.ofList
|
||||
|> List.sortBy (fun (y:string * string) -> Global.toSortableDate (snd y).[(snd y).Length - 2..])
|
||||
|
||||
|
||||
let SODPositionView model dispatch =
|
||||
@@ -900,7 +900,7 @@ let DayPositionView model dispatch =
|
||||
TableControl.Cell (span [Style [Color "green"]][str (sprintf "%i" ulimit.id)])
|
||||
TableControl.Cell (Fields.simpleSelect "" venueList (ulimit.venue) (fun v -> (ulimit.id, v, "venue", false) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.simpleSelect "" (getSymbolList model ulimit.venue) (ulimit.symbol) (fun v -> (ulimit.id, v, "symbol", false) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.mapSelect
|
||||
TableControl.Cell (Fields.tupleMapSelect
|
||||
""
|
||||
(getPositionSecMap
|
||||
securityList
|
||||
@@ -910,6 +910,7 @@ let DayPositionView model dispatch =
|
||||
(Some securityMap.[uint32 ulimit.SecurityId].securityName)
|
||||
(Some ulimit.SecurityId)
|
||||
(fun v -> (ulimit.id, v, "SecurityId", false) |> UpdateManualFill |> dispatch)
|
||||
None
|
||||
)
|
||||
TableControl.Cell (Fields.simpleSelect "" extantUsersMap ulimit.user (fun v -> (ulimit.id, v, "user", false) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.simpleSelect "" ["Buy"; "Sell"] ulimit.side (fun v -> (ulimit.id, v, "side", false) |> UpdateManualFill |> dispatch))
|
||||
@@ -959,7 +960,7 @@ let DayPositionView model dispatch =
|
||||
TableControl.Cell (span [Style [Color "green"]][str "NEW"])
|
||||
TableControl.Cell (Fields.simpleSelect "" venueList (limit.venue) (fun v -> (limit.newId, v, "venue", true) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.simpleSelect "" (getSymbolList model limit.venue) (limit.symbol) (fun v -> (limit.newId, v, "symbol", true) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.mapSelect
|
||||
TableControl.Cell (Fields.tupleMapSelect
|
||||
""
|
||||
(getPositionSecMap
|
||||
securityList
|
||||
@@ -971,7 +972,9 @@ let DayPositionView model dispatch =
|
||||
| _ -> Some securityMap.[uint32 limit.SecurityId].securityName
|
||||
)
|
||||
(Some limit.SecurityId)
|
||||
(fun v -> (limit.newId, v, "SecurityId", true) |> UpdateManualFill |> dispatch))
|
||||
(fun v -> (limit.newId, v, "SecurityId", true) |> UpdateManualFill |> dispatch)
|
||||
None
|
||||
)
|
||||
TableControl.Cell (Fields.simpleSelect "" extantUsersMap limit.user (fun v -> (limit.newId, v, "user", true) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.simpleSelect "" ["Buy"; "Sell"] limit.side (fun v -> (limit.newId, v, "side", true) |> UpdateManualFill |> dispatch))
|
||||
TableControl.Cell (Fields.positiveIntNumber
|
||||
|
||||
@@ -246,6 +246,39 @@ let radioButton (lbl:string) (description:string) (dv:bool) (attrs:IHTMLProp lis
|
||||
]
|
||||
|
||||
|
||||
let tupleMapSelect (lbl:string) (options:(string * string) List) (defaultText:string option) (defaultValue:string option) (onchange:'a->unit) (is_disabled:bool option) =
|
||||
let dis =
|
||||
match is_disabled with
|
||||
| None -> false
|
||||
| Some a -> a
|
||||
|
||||
let optList:ReactElement list =
|
||||
match defaultText with
|
||||
| None -> (option [] [str ""]) :: ([ for opt in options do yield option [ Value (fst opt) ] [ str (snd opt) ] ])
|
||||
| Some dt -> (option [] [str dt]) :: ([ for opt in options do yield option [ Value (fst opt) ] [ str (snd opt) ] ])
|
||||
|
||||
let dv = match defaultValue with
|
||||
| Some d -> d
|
||||
| None -> ""
|
||||
|
||||
div [ ClassName "field" ]
|
||||
[
|
||||
Label lbl
|
||||
div [ ClassName "control" ]
|
||||
[
|
||||
div [ ClassName "select"]
|
||||
[
|
||||
select [
|
||||
Value dv
|
||||
OnChange (fun ev -> !!ev.target?value |> onchange)
|
||||
Disabled dis
|
||||
]
|
||||
optList
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
let mapSelectEx (lbl:string) (options:Map<string,string>) (defaultText:string option) (defaultValue:string option) (onchange:'a->unit) (is_disabled:bool option) =
|
||||
let dis =
|
||||
match is_disabled with
|
||||
|
||||
@@ -13,6 +13,30 @@ let alert (_:AlertLevel) (_:string) = Fable.Core.Exceptions.jsNative
|
||||
|
||||
let compareDouble (d1:double) (d2:double) (precision: uint32) = (int (d1 * (double precision))) = (int (d2 * (double precision)))
|
||||
|
||||
let toSortableDate (badDate:string) =
|
||||
let month = badDate.[0]
|
||||
let year = badDate.[1]
|
||||
|
||||
let curYear = System.DateTime.Now.Year
|
||||
|
||||
let yearMap = Map.empty.
|
||||
Add((string curYear).[3], curYear).
|
||||
Add((string (curYear + 1 )).[3], curYear + 1).
|
||||
Add((string (curYear + 2 )).[3], curYear + 2).
|
||||
Add((string (curYear + 3 )).[3], curYear + 3).
|
||||
Add((string (curYear + 4 )).[3], curYear + 4).
|
||||
Add((string (curYear + 5 )).[3], curYear + 5).
|
||||
Add((string (curYear + 6 )).[3], curYear + 6).
|
||||
Add((string (curYear + 7 )).[3], curYear + 7).
|
||||
Add((string (curYear + 8 )).[3], curYear + 8).
|
||||
Add((string (curYear + 9 )).[3], curYear + 9)
|
||||
|
||||
let fullYear = string yearMap.[year]
|
||||
|
||||
sprintf "%s%c" fullYear month
|
||||
|
||||
|
||||
|
||||
|
||||
module Reflection =
|
||||
open Fable.Core.JsInterop
|
||||
@@ -33,3 +57,4 @@ module Reflection =
|
||||
|
||||
let pairsToObj<'a> (kv: (string*'a) seq) =
|
||||
createObj (unbox kv)
|
||||
|
||||
Reference in new issue
Block a user