From 3e1c7c495e39c44f90ae76da9d4728202668064f Mon Sep 17 00:00:00 2001 From: Denis Tereshkin Date: Fri, 11 Nov 2016 15:34:54 +0700 Subject: [PATCH] QuikBroker: respect client code in account ID --- src/Broker/QuikBroker.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Broker/QuikBroker.hs b/src/Broker/QuikBroker.hs index 3836393..087cf5b 100644 --- a/src/Broker/QuikBroker.hs +++ b/src/Broker/QuikBroker.hs @@ -102,9 +102,9 @@ qbCancelOrder state orderid = do qbStopBroker state = return () makeTransactionString transId order = - case (classcode, seccode) of - (Just cCode, Just sCode) -> Just $ - "ACCOUNT=" ++ T.unpack (orderAccountId order) ++ ";" ++ + case (classcode, seccode, accountTransactionString) of + (Just cCode, Just sCode, Just accountStr) -> Just $ + accountStr ++ "TYPE=" ++ orderTypeCode ++ ";" ++ "TRANS_ID=" ++ show transId ++ ";" ++ "CLASSCODE=" ++ cCode ++ ";" ++ @@ -128,6 +128,10 @@ makeTransactionString transId order = Limit p -> removeTrailingZeros . show $ p _ -> "0" 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 = case (classcode, seccode) of