def AccountSearch(self, institutionID, userID, password): self._db.execute("""SELECT * FROM Institutions WHERE ID = %s""", (institutionID,)) if self._db.rowcount == 0: raise FinkinException("Cannot find Institution with ID=" + str(institutionID)) inst = self._db.fetchone() ofx = OFXClient(inst['OFXUrl'], userID, password, inst['Organization'], str(inst['FID'])) q = ofx.acctQuery() r = ofx.doQuery(q) if (self.debug): raise FinkinDebugException(q + "\n\n" + r) return OFXParser(r)
def TransactionSearch(self, institutionID, userID, password, account, startDate, endDate, accountType, routing): self._db.execute("""SELECT * FROM Institutions WHERE ID = %s""", (institutionID,)) if self._db.rowcount == 0: raise FinkinException("Cannot find Institution with ID=" + str(institutionID)) inst = self._db.fetchone() if (inst['Type'] == 2 and accountType == None): raise FinkinException("Missing parameter \'AccountType\' for bank query") if (inst['Type'] == 2 and routing == None): raise FinkinException("Missing parameter \'RoutingNumber\' for bank query") ofx = OFXClient(inst['OFXUrl'], userID, password, inst['Organization'], str(inst['FID'])) if (inst['Type'] == 2): #bank q = ofx.baQuery(account, startDate, endDate, accountType, routing) if (inst['Type'] == 1): #cc q = ofx.ccQuery(account, startDate, endDate) #if (inst['Type'] == 3): #invst # q = ofx.invstQuery(broker, account) r = ofx.doQuery(q) if (self.debug): raise FinkinDebugException(q + "\n\n" + r) return OFXParser(r)