Browse Source

QuikBroker: respect client code in account ID

master
Denis Tereshkin 9 years ago
parent
commit
3e1c7c495e
  1. 10
      src/Broker/QuikBroker.hs

10
src/Broker/QuikBroker.hs

@ -102,9 +102,9 @@ qbCancelOrder state orderid = do
qbStopBroker state = return () qbStopBroker state = return ()
makeTransactionString transId order = makeTransactionString transId order =
case (classcode, seccode) of case (classcode, seccode, accountTransactionString) of
(Just cCode, Just sCode) -> Just $ (Just cCode, Just sCode, Just accountStr) -> Just $
"ACCOUNT=" ++ T.unpack (orderAccountId order) ++ ";" ++ accountStr ++
"TYPE=" ++ orderTypeCode ++ ";" ++ "TYPE=" ++ orderTypeCode ++ ";" ++
"TRANS_ID=" ++ show transId ++ ";" ++ "TRANS_ID=" ++ show transId ++ ";" ++
"CLASSCODE=" ++ cCode ++ ";" ++ "CLASSCODE=" ++ cCode ++ ";" ++
@ -128,6 +128,10 @@ makeTransactionString transId order =
Limit p -> removeTrailingZeros . show $ p Limit p -> removeTrailingZeros . show $ p
_ -> "0" _ -> "0"
removeTrailingZeros v = if '.' `L.elem` v then L.dropWhileEnd (== '.') . L.dropWhileEnd (== '0') $ v else v removeTrailingZeros v = if '.' `L.elem` v then L.dropWhileEnd (== '.') . L.dropWhileEnd (== '0') $ v else v
accountTransactionString = case T.splitOn "#" (orderAccountId order) of
[accountStr, clientCodeStr] -> Just $ "ACCOUNT=" ++ T.unpack accountStr ++ ";CLIENT_CODE=" ++ T.unpack clientCodeStr ++ ";"
[accountStr] -> Just $ "ACCOUNT=" ++ T.unpack accountStr ++ ";"
_ -> Nothing
makeCancelTransactionString transId order orderId = makeCancelTransactionString transId order orderId =
case (classcode, seccode) of case (classcode, seccode) of

Loading…
Cancel
Save