Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //get Order History
- static let GET_ORDERHISTORY_SPECS = ["uri": INQ_URL + "accounts/{accountid}/orderHist",
- "method":"GET",
- "fields":["fromDate","toDate","symbol","execType","orderStatus"],
- "header":["Authorization"]] as [String : Any]
- func getOrderHistory(fromDate: String,toDate: String,symbol: String,execType: String,orderStatus: String,completion: ((_ result: Bool,_ data:[OrderHistoryModel]) -> Void)? = nil) {
- let userInfo = AuthenticationManager.instance().userInfo.subAccounts[4].acctNo
- let defaults = UserDefaults.standard
- let tokenString = defaults.string(forKey: "tokenString")
- APIService.callApi(apiSpec: SecApiList.GET_ORDERHISTORY_SPECS,subPath: [userInfo], parameterValues: [fromDate,toDate,symbol,execType,orderStatus], headerValues: [tokenString!], success: { (data:SuccessArrayModel<OrderHistoryModel>) in
- if completion != nil {
- completion!(true,data.data!)
- }
- }, error: { (error:APIError) in
- self.handleError(errorInfo: error)
- }) { (response:AnyObject) -> SuccessArrayModel<OrderHistoryModel> in
- guard let responseData = response as? [String:Any], let result = SuccessArrayModel<OrderHistoryModel>(data: responseData) else {
- throw ParserError.invalidResponseData
- }
- return result
- }
- }
- //============
- getOrderHistory(fromDate: "10/01/2017", toDate: "31/08/2017", symbol: "ALL", execType: "ALL", orderStatus: "ALL")
- { (rs,NormalOrders) in
- if rs {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement