SPARK-1201: Security column in Secutity Limits
This commit is contained in:
1 parent
e013f93169
commit
1e4ad28088
1 file changed
+32
@@ -330,6 +330,7 @@ let securityLimits model dispatch =
|
||||
{ content = str "Exchange"; className = ""; isHeader = true }
|
||||
{ content = str "Security Type"; className = ""; isHeader = true }
|
||||
{ content = str "Symbol"; className = ""; isHeader = true }
|
||||
{ content = str "Security"; className = ""; isHeader = true }
|
||||
{ content = str "Max Net Long Position"; className = ""; isHeader = true }
|
||||
{ content = str "Max Net Short Position"; className = ""; isHeader = true }
|
||||
]
|
||||
@@ -339,6 +340,25 @@ let securityLimits model dispatch =
|
||||
|
||||
let symbolArray = Array.concat [| [| model.AllValueDisplay |]; Array.map<bts.api.Product, string> (fun a -> a.symbol ) model.mdRelayProductData |]
|
||||
|
||||
let getSecurityMap (limit:AccountSecurityPositionLimitUnit) =
|
||||
let allOption = {
|
||||
product = {
|
||||
exchange = bts.api.Venue.UNSET
|
||||
``type`` = bts.api.SecurityType.UNSET
|
||||
symbol = model.AllValueDisplay
|
||||
};
|
||||
names = (JSMap.add<string> "0" model.AllValueDisplay JSMap.empty<string>)
|
||||
}:ExpirationNameList
|
||||
|
||||
Array.concat [ [| allOption |]; model.mdRelayExpNameData]
|
||||
|> Array.filter (fun (x:bts.co2.ExpirationNameList) -> (
|
||||
((x.product.exchange = limit.security.exchange) || (x.product.exchange = bts.api.Venue.UNSET))
|
||||
&& ((x.product.``type`` = limit.security.securityType) || (x.product.``type`` = bts.api.SecurityType.UNSET))
|
||||
&& ((x.product.symbol = limit.security.securitySymbol) || (x.product.symbol = model.AllValueDisplay))
|
||||
)
|
||||
)
|
||||
|> Seq.map (fun x -> x.names ) |> JSMap.concat
|
||||
|
||||
let modifyRow (oldRow:AccountSecurityPositionLimitUnit) (newRow:AccountSecurityPositionLimitUnit) =
|
||||
let i = Array.findIndex (fun l -> oldRow = l) model.scratch.securityPositionLimits
|
||||
let left = Array.append (model.scratch.securityPositionLimits.[..i-1]) [| newRow |]
|
||||
@@ -361,6 +381,9 @@ let securityLimits model dispatch =
|
||||
| true -> model.AllValue
|
||||
modifyRow oldRow { oldRow with security = { oldRow.security with securitySymbol = v } }
|
||||
|
||||
let changeSecurityId (oldRow:AccountSecurityPositionLimitUnit) (value:string) =
|
||||
modifyRow oldRow { oldRow with security = { oldRow.security with securityId = (uint32 value) } }
|
||||
|
||||
let changeLongPositionLimit (oldRow:AccountSecurityPositionLimitUnit) (value:string) =
|
||||
modifyRow oldRow { oldRow with longPositionLimit = (uint32 value) }
|
||||
|
||||
@@ -399,6 +422,15 @@ let securityLimits model dispatch =
|
||||
className = ""
|
||||
isHeader = false
|
||||
}
|
||||
{ content = Fields.mapSelect
|
||||
""
|
||||
(JSMap.toMap (getSecurityMap limit))
|
||||
None
|
||||
(Some (sprintf "%i" limit.security.securityId))
|
||||
((changeSecurityId limit) >> SecurityLimits >> dispatch)
|
||||
className = ""
|
||||
isHeader = false
|
||||
}
|
||||
{ content = Fields.text
|
||||
""
|
||||
(sprintf "%i" limit.longPositionLimit)
|
||||
|
||||
Reference in new issue
Block a user