def main(): """Main function that runs the loop state for entire program""" database_connection = userdata.init() # signed_in = account.sign_in('jordan00', 'Jordan!23', database_connection) signed_in = account.sign_in_or_create_user(database_connection) timeline.timeline(database_connection, signed_in, 1) while True: action = timeline.prompt_for_timeline_action() if action.isdigit(): action = int(action) if action: timeline.timeline(database_connection, signed_in, action) else: print('-' * 100) print('No posts on page 0. Please go to page 1.') print('-' * 100) elif action == 'ACCOUNT SETTINGS': account.account(signed_in, database_connection) timeline.timeline(database_connection, signed_in, 1) elif action == 'USERS': usersmodule.users_main_page(database_connection, signed_in) timeline.timeline(database_connection, signed_in, 1) elif action == 'POST': post = input('Type your post:\n\t>') userdata.add_post(database_connection, post, signed_in) timeline.timeline(database_connection, signed_in, 1) elif action == 'SIGN OUT': database_connection.close() print('Bye!') break
def main(): '''Main function that runs the loop state for entire program''' con = userdata.init() initializing = True while initializing: print('Press (N) to create a new account or (S) to ' 'sign into an existing account. Press (X) to exit.') action = input('\t>>> ').strip().upper() if action == 'N': signed_in = account.create_account(con) if signed_in: initializing = False else: continue elif action == 'S': signed_in = account.sign_in(con) if signed_in: break else: continue elif action == 'X': sys.exit() print('Not a valid operation') # signed_in = account.sign_in('jordan00', 'jr11', con) timeline.timeline(con, signed_in, 1) while True: action = timeline.prompt_for_action() if action == 'SIGN OUT': con.close() break elif action.isdigit(): action = int(action) if action: timeline.timeline(con, signed_in, action) else: print('-' * 50) print('No posts on page 0. Please go to page 1.') print('-' * 50) elif action == 'ACCOUNT SETTINGS': account.account(signed_in, con) timeline.timeline(con, signed_in, 1) elif action == 'USERS': usersmodule.users_page(con, signed_in) timeline.timeline(con, signed_in, 1) elif action == 'POST': post = input('Type your post:\n\t>') userdata.add_post(con, post, signed_in) timeline.timeline(con, signed_in, 1)
def readAccounts(self, filename): """Reads in the accounts from a database and stores it into a list of individual account objects Args: filename (str): name of database Returns: Accounts(list): List of each account item """ with open(filename, 'r') as file: line = file.readline() for line in file: name, acctNumber, pin, balance = (str(line)).split(',') acct = account.account(str(name), str(acctNumber), str(pin), float(balance)) assert isinstance(acct.name, str), \ "Name must be a string. Received %s" % type(acct.name) assert isinstance(acct.accountNumber, str), \ "Account Number must be a string. Received %s" % type(acct.accountNumber) assert isinstance(acct.pin, str), \ "Pin must be a 4 digit integer. Received %s" % type(acct.pin) assert isinstance(acct.balance, float), \ "Balance must be of type money. Received %s" % type(acct.balance) self.append(acct) return self
def from_buffer(buffer): account_list = [] buffer = buffer.split("\n") for line in buffer: username, password, authorizations = line.split("\t") account_list.append(account(username, password, authorizations)) return account_list
def __init__(self): self.account = account() self.urlPrefix = u'https://oapi.dingtalk.com/robot/send?access_token={0}'.format(self.account.dingdingToken) self.headers = \ { \ 'Content-Type': 'application/json',\ }
def setUp(self): self.Account1 = account() self.Account1.accountName = "Mr.Sparkle" self.Account1.accountInfo["Home Phone"] = "555-0113" self.Account1.accountInfo["Email"] = "*****@*****.**" self.Account1.accountInfo["address"] = "123 Fake Street" self.Account1.accountInfo["Office Phone"] = "555-5555" self.Account1.accountInfo["Office hours"] = "All day everyday"
def __init__(self, cluster_name): #recieves name of file with phones list self.accounts_file = cluster_name self.__log('Creating cluster') initcount = 0 accountcount = len(data.clusterAlpha.phones) - 1 while initcount <= accountcount: self.account_list[initcount] = account( data.clusterAlpha.phone[initcount])
def setUp(self): self.Directory1 = Directory() self.Directory2 = Directory() self.Directory2.data.append("firstAccount") self.Directory2.data.append("secondAccount") self.Directory2.data.append("lastAccount") self.Directory2.manyItems = 3 self.Account1 = account()
def main(): window = Tk() user = account.account() user.checkSetup() loginPage(window, user) window.protocol("WM_DELETE_WINDOW", closeout(user)) window.mainloop() del user
class Test(unittest.TestCase): accInfo = AccountClass.account() def test_check_password_length(self): print("checking possible passssword\n") passwordList = ['hbvkvbwvvvfs','hgfergebvibihbrv','gveirvbkrvbivbrv' ] for passwd in passwordList: print("Ckecking password" + passwd + "\n") passInfo = self.accInfo.check_password_length(passwd) self.assertTrue(passInfo)
class Test(unittest.TestCase): accInfo = AccountClass.account() def test_check_password_length(self): print("Checking possible password\n") passwordList = ['dsasdsdfewe', 'dsdsdfwefwe', 'sdsfweadwefwe'] for passwd in passwordList: print("checking password " + passwd + "\n") passinfo = self.accInfo.check_password_length(passwd) self.assertTrue(passinfo)
class Test(unittest.TestCase): accInfo = AccountClass.account() def test_check_password_length(self): print("Checking possible passwords\n") passwordList = ['beautifulday', 'astrictboss', 'alovelyhouse'] for passwd in passwordList: print("checking password " + passwd + "\n") passInfo = self.accInfo.check_password_length(passwd) self.assertTrue(passInfo)
class Test(unittest.TestCase): accinfo = AccountClass.account() def test_check_passwd_length(self): print("Checking possible passwords") passwordList = ["bubbleboy", "tintin123", "agnipath1", "goldengate"] for passwd in passwordList: print("checking password %s" % passwd) passinfo = self.accinfo.check_password_length(passwd) self.assertTrue(passinfo)
def creator(): creator1 = account() creator1.setId(1122) creator1.setBalance(20000) creator1.setAnnualInterestRate(45) creator1.deposit(3000) print("ID: ", creator1.getId()) print("Balance: ", creator1.getBalance()) print("Annual Interest Rate: ", creator1.getAnnualInterestRate()) print("Monthly Interest Rate: ", creator1.getMonthlyInterestRate()) print("Monthly Interest: ", creator1.getMonthlyInterest())
class Test(unittest.TestCase): accInfo = AccountClass.account() def test_check_pass(self): print ("Checking possible pass\n") passwordList = ['asdasdwer', 'asderesdsd', 'aderwqeqq'] for passwd in passwordList: print ("checking pass " + passwd + "\n") passInfo = self.accInfo.check_p(passwd) self.assertTrue(passInfo)
def addUser(self, userId, userName): retval = "User {} exists".format(userId) if not self.isAuctionOpen: retval = "Auction is closed" elif not self.isRegistrationOpen: retval = "Registration is closed" elif not self.isUserInAccounts(userId, userName): self.accounts.append(account(userId, userName, self.numBins)) retval = "User Added: {}".format(userId) return retval
def updateInfo(): conn = db_acc.account(con_db) data = request.json sheet = acc.account( data["idOfUser"], data["email"], data["password"], data["nameUser"], data["dateOfBirth"], data["adress"], data["company"], ) result = conn.update(sheet) return jsonify({"data": result}), 200
def register(): conn = db_acc.account(con_db) data = request.json sheet = acc.account( 1, data["email"], data["password"], data["nameUser"], data["dateOfBirth"], data["adress"], data["company"], ) result = conn.insert(sheet) return jsonify({"data": result}), 200
def executeLogin(self): accts = configurationSettings(1) self.name=self.lent1.get() self.password=self.lent2.get() # Check if the ID exists - if now ask if you want to create a new one if accts.checkID(self.name)==False: result = msg.askyesno("Account Not Found", "Do you want to create a new account?") if result==True: accts.createID(self.name, self.password) loginText = "ID " + self.name + " created, login" self.updateStatus(loginText) else: # ID is valid now check if the password matches if accts.confirmPassword(self.name, self.password)==False: msg.showerror("Error","Incorrect Password") else: # Update the status label self.isLoggedin = True loginText = "Logged in as " + self.name self.updateStatus(loginText) # Load prior accounts - limiting this to 100 accounts for now, however the way it's designed the only limit is memory for i in range(1, 100): tmpFileName = self.name + str(i) tmpFile = Path(tmpFileName) if tmpFile.is_file(): act = account(0) act.loadAccounts(tmpFileName, i) self.accountList.append(act) self.displayAccounts() # Remove the login widgets self.lent1.grid_forget() self.lent2.grid_forget() self.lbtn7.grid_forget() self.lslbl1.grid_forget() self.lslbl2.grid_forget() pass
def initFFrame(self,user,passw): # 初始化各个Frame db =dbcollector.mySqlDb(user,passw) crawler =crawlerutils.Crawler(db) search = searchFrame(self,crawler ) #搜索类 label = tk.Label(self, text='搜索', font=('', 12), bg='#F5F5F5') label.frame =search label.bind('<Motion>', self.baColor) label.bind('<Leave>', self.bcColor) label.bind('<Button-1>', self.bCFrame) x = 60 y=100 label.place(x=x, y=y) #dManager dManager =dManageFrame(self,db) dManager.initCurNum(self.curNum) self.dNum =tk.StringVar(self,value='下载管理') y += 50 crawler.initCurDowner(dManager.curDownload) #初始化正在下载 label = tk.Label(self, textvariable=self.dNum, font=('', 12), bg='#F5F5F5') label.frame = dManager self.bFunc(label) label.place(x=x, y=y) #本地管理 lManager = lManageFrame(self) y += 50 label = tk.Label(self, text='本地管理', font=('', 12), bg='#F5F5F5') label.frame = lManager self.bFunc(label) label.place(x=x, y=y) #用户管理 uManager= accountM(self,account.account(db)) y += 50 label = tk.Label(self, text='用户管理', font=('', 12), bg='#F5F5F5') label.frame = uManager self.bFunc(label) label.place(x=x, y=y)
def __init__(self): super().__init__() # 取用户名密码 self.account = account() # 打开数据库 self.ip_address = '' if sys.platform.startswith('win'): self.ip_address = '112.125.25.230' elif sys.platform.startswith('linux'): self.ip_address = '127.0.0.1' # 数据库与 model 模型的 key 匹配 country_info_db_keys = [ 'id', 'country', 'country_code', 'capital', 'trading_market', 'market_code', 'index_name', 'index_code', 'continent', 'timezone', 'deal_time', 'break_time', 'population', 'area', 'gdp_rmb', 'gdp_person_avg', 'inland_currency', 'currency_code', 'summer_time' ] country_info_model_keys = [ 'id', 'country', 'countryCode', 'capital', 'tradingMarket', 'marketCode', 'indexName', 'indexCode', 'continent', 'timezone', 'dealTime', 'breakTime', 'population', 'area', 'gdpRMB', 'gdpPersonAvg', 'inlandCurrency', 'inlandCurrencyCode', 'summerTime' ] self.country_info_keymapping = dict( zip(country_info_db_keys, country_info_model_keys)) index_history_db_keys = [ 'id', 'country', 'country_code', 'continent', 'index_name', 'index_code', 'index_history' ] index_history_model_keys = [ 'id', 'country', 'countryCode', 'continent', 'indexName', 'indexCode', 'indexHistory' ] self.index_history_keymapping = dict( zip(index_history_db_keys, index_history_model_keys))
def userLogin(userGroup): tokenGroup = [] # 字典数组 try: for user in userGroup: userAccount = account.account(user["username"], user["password"]) userAccount.login() userAccount.auth() userAccount.getxToken() tokenGroup.append({ "cookies": userAccount.dxtoken, "token": userAccount.xToken }) print( "[{}]".format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())), "登录成功,现在每隔", "{}".format(SLEEPTIME), "秒就会检查一次上报时间") except Exception as e: print( "[{}]".format(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())), "登录出错") print(e) os.system("pause") sys.exit() return tokenGroup
from sqlalchemy import select, func from flask import Flask from flask import request from flask import Response # 跨域 from flask_cors import * from account import account from datetimeManager import datetimeManager from dingdingMessager import dingdingMessager from emailMessager import emailMessager folder = os.path.abspath(os.path.dirname(__file__)) dm = datetimeManager() account = account() # 创建数据库引擎 engine = create_engine( f'mysql+pymysql://{account.mysqlUser}:{account.mysqlPassword}@112.125.25.230:3306/message' ) app = Flask(__name__) app.config['JSON_AS_ASCII'] = False CORS(app, supports_credentials=True) # 发钉钉 # host/message/api/dingtalk # 发邮件 # host/message/api/email # 所有方式 # host/message/api/all
print(make_directory(input('Введите имя папки: '))) elif choice == '2': print( delete_file_dir( input('Введите имя папки(файла) для удаления: '))) elif choice == '3': copy_file_dir() elif choice == '4': print(os.listdir()) elif choice == '5': print([x for x in os.listdir() if not os.path.isfile(x)]) elif choice == '6': print([x for x in os.listdir() if os.path.isfile(x)]) elif choice == '7': print(sys.platform) elif choice == '8': print('*** Build by Human Intelligence of DmitryChe! ***') elif choice == '9': victorina() elif choice == '10': account() elif choice == '11': print(change_dir( input('Введите путь к новой рабочей директори: '))) elif choice == '12': print(save_dirlist()) elif choice == '0': break else: print('\nНеверный пункт меню\n')
def name(name): exchange = ccxt.coinbasepro() BotStrategys = BotStrategy() current_buy_price = 0 candlesticks = [] open_ = [] high = [] low = [] close = [] start_time = time.time() length_bear = 0 length_bull = 0 period = 60 developingcandle = candle_info(period) utility = trading_utilities() timer = 0 count=0 my_time = [] fama = [] mama = [] hl2 = [] history = exchange.fetch_ohlcv(name,'1m') j = 0 accounts = account() plot = graphing() push = push_notification() current_high = 0 bought = 0 for i in range(len(history)-1,0,-1): my_time.append(history[i][0]/1000.00) open_.append(history[i][1]) high.append(history[i][2]) low.append(history[i][3]) close.append(history[i][4]) candlesticks.append([history[i][0]/1000.00,history[i][1],history[i][2],history[i][3],history[i][4]]) hl2.append((history[i][2]+history[i][3])/2.0) j+=1 while True: try: ticks = float(((exchange.fetchTicker(name)['last']))) #print(name,ticks) except: # print("Error Occured") # print("Attempting to reconnect...") pass #Builds the acutal candles developingcandle.candle_tick(ticks) #Determines the difference in percent between current price and highest price if current_high < ticks: current_high = ticks #print(round((ticks-current_high)/current_high,4)) #Once Time period has passed a finished candle is added on to stack if developingcandle.isClosed(): #Grabs OHLC values from candle_info class o,h,l,c = developingcandle.candle_tick(ticks) #Records current time and adds to list t = time.time() my_time.append(t) #adds tOHLC to candle list candlesticks.append([t,o,h,l,c]) #Creates ability to access all values individually open_.append(o) high.append(h) low.append(l) close.append(c) #like an average for candle hl2.append((h+l)/2.0) #clears candle_info class developingcandle = candle_info(period) print("Open: "+str(o)+" High: "+str(h)+" Low: "+str(l)+" Close: "+str(c)+" current: "+str(ticks)) #creates arrays to be used with ta-lib indicators in their desired format open2 = np.array(open_,dtype=float) high2 = np.array(close,dtype=float) low2 = np.array(low,dtype=float) close2 = np.array(close,dtype=float) my_time2 = np.array(my_time,dtype=float) hl2_ = np.array(hl2,dtype=float) #calls to candles_types class where all candle patterns are and returns list of candles names that are present candles_info = candles_types(open2,high2,low2,close2) bull,bear = candles_info.all_candles() #every 5 candles idealInvestment strategy has a chance to buy or sell if(count==0): BotStrategys.idealInvested(close, ticks,open2,high2,low2,close2) count+=1 #change 5 to how frenquently buy/sell orders are desired if(count>5): count=0 timer = 1 #only keeps 50 candles and deletes extra if len(open_)>50: del open_[0] del high[0] del low[0] del close[0] del my_time[0] del candlesticks[0] # # # if timer == 1 and time.time() > start_time + period: # open2 = np.array(open_,dtype=float) # high2 = np.array(close,dtype=float) # low2 = np.array(low,dtype=float) # close2 = np.array(close,dtype=float) # candles_info = candles_types(open2,high2,low2,close2) # bull,bear = candles_info.all_candles() # mama1 = np.array(mama,dtype=float) # fama1 = np.array(fama,dtype=float) #Put code to sleep to ensure API ping does not exceed rate limit time.sleep(exchange.rateLimit/1000)
def add_account(self, phone, it, ad, pw): act = account(phone, it, ad, pw) #print "phone = {0}".format(phone) p = {phone : act} self.accounts.update(p)
from Ballot import deploy_Ballot_contract, giveRightToVote, vote, winnerName # w3 = Web3(Web3.IPCProvider("./blockchain/geth.ipc")) w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) account_list = [] password = ['coinbase', 'n1', 'n2'] address = [ '0x2C749426ff936a1B522fFdc8dcBf9eb8d78b3D00', '0x0697875dc0ae871809f049211d85b939b7B75A75', '0xdB66F629495c5B1d17d28A35ccEd5ECB6F494BD3' ] for i in range(len(password)): privKey = extract_key_from_keyfile( _PATH + '/keyFile/' + password[i] + '.json', password[i].encode()) account_list.append(account(privKey, address[i])) w3.geth.miner.setEtherbase(account_list[0].address) w3.geth.miner.start(1) proposal_node = [ '0daDa006Be098D919433E05F15Fdb7d40daDa006Be098D919433E05F15Fdb7d4', 'dDd2b8e44e7249C130EFacA61A849032dDd2b8e44e7249C130EFacA61A849032', '7B6551d16a3EFd50Fe8699B131F514877B6551d16a3EFd50Fe8699B131F51487' ] contract = deploy_Ballot_contract(w3, account_list[0], proposal_node) print("contract addresss : ", contract.address) giveRightToVote(w3, account_list[0], contract, account_list[1].address) giveRightToVote(w3, account_list[0], contract, account_list[2].address)
import ystockquote import technicals import algorithm import account from numpy import * from pylab import * myaccount = account.account() figure2 = figure() lowerbox = figure2.add_subplot(111) figure1 = figure() upperbox = figure1.add_subplot(111) startdate = "20120101" enddate = "20121222" # Get Quotes GOOG = ystockquote.get_historical_prices("MSI", "20100101", "20120101") # Create empty lists, quick and dirty GOOGDate = [] GOOGOpen = [] GOOGHigh = [] GOOGLow = [] GOOGClose = [] GOOGVolume = [] GOOGAdj = [] # Adjusted Close
def __init__(self): self.utility = trading_utilities() self.account = account()
def testCreate(self): from account import account account = account() ret = account.create() return ret
def signin(): con = connection() cur = con.cursor() c = 0 while c < 3: id = int(input("Enter your User id. : ")) qu = "select userid from login " cur.execute(qu) cek = cur.fetchall() lis = [] for ce in cek: lis.append(ce[0]) i = lis.count(id) if (i == 0): print(" ! Incorrect Userid ") c += 1 else: c = 5 if (c == 3): return False c = 0 while c < 3: pas = getpass.getpass() qu = "select password from login where userid=%d" % (id) cur.execute(qu) cek = cur.fetchone() cek = str(cek[0]) if (pas != cek): print(" --- ! Incorrect password ---") c += 1 else: c = 5 if (c == 3): return False opt = 1 print("------ LoggedIn Sucessfully -------") qu = "select * from account " cur.execute(qu) cek = cur.fetchall() lis = [] for ce in cek: l = [ce[0], ce[1], ce[2], ce[3]] lis.append(l) accounts = [] for ce in cek: accounts.append(accoun.account(ce[0], ce[1], ce[2], ce[3])) for a in accounts: if id == a.userid: t = a while opt != 9: print("\n\t -- Sign In --\n") print("\t 1 - Address change") print("\t 2 - Deposit") print("\t 3 - Withdraw") print("\t 4 - Ministatement") print("\t 5 - Transfer") print("\t 6 - Account closure") print("\t 7 - Create Fixed deposit") print("\t 8 - Avail Loan") print("\t 9 - Logout") opt = int(input("\n...Enter your option : ")) if (opt == 1): print("\n------ Address change -------\n") print(" ---- Existing Address ----") qu = "select addressline1,addressline2,city,state,pin from users where userid=%d" % ( id) cur.execute(qu) addr = cur.fetchone() print(" AddressLine 1 : ", addr[0]) print(" AddressLine 2 : ", addr[1]) print(" City : ", addr[2]) print(" State : ", addr[3]) print(" Pincode : ", addr[4]) addr1 = input("Enter address line 1 : ") addr2 = input("Enter address line 2 : ") city = input("Enter your city : ") state = input("Enter your state : ") pin = int(input("Enter your pincode : ")) qu = "update users set addressline1='%s',addressline2='%s',city='%s',state='%s',pin=%d where userid=%d" % ( addr1, addr2, city, state, pin, id) cur.execute(qu) con.commit() print("--- Address changed sucessfully ---") if (opt == 2): print("\n------ Money Deposit -------\n") print("\t Current balance is Rs.", t.balance) dep = float( input( "Enter the amount to be deposited into your account : Rs.") ) t.deposit(dep) qu = "update account set balance=%f where userid=%d" % (t.balance, id) cur.execute(qu) con.commit() qu = "insert into trans values(%d,%d,'deposit',%f,curdate())" % ( id, t.account, dep) cur.execute(qu) con.commit() print("..Deposited sucessfully") print("\t New balance is ", t.balance) if (opt == 3): print("\n------ Money Withdrawal -------\n") print("\t Current balance is Rs.", t.balance) amt = float( input( "Enter the amount to be withdrawn from your account : Rs.") ) if amt > t.balance: print(".. ! Amount exceeds the balance ") print(".. ! Withdraw Unsucessfull") else: t.withdraw(amt) qu = "update account set balance=%f where userid=%d" % ( t.balance, id) cur.execute(qu) con.commit() qu = "insert into trans values(%d,%d,'withdraw',%f,curdate())" % ( id, t.account, amt) cur.execute(qu) con.commit() print("..Deposited sucessfully") print("\t New balance is ", t.balance) if (opt == 4): print("\n------ Mini Statement -------\n") i = stmt(id) entry(id) if (opt == 5): print("\n------ Transfer Money -------\n") print("\t Current balance is Rs.", t.balance) c = 0 while c < 3: acc = int(input("-- 'TO' Account no. : ")) for i in accounts: if acc == i.account and acc != t.account: toacc = i c = 5 if c != 5: print(" ! Incorrect Account no. ") c += 1 if (c == 3): return False qu = "select fname from users where userid=%d" % (toacc.userid) cur.execute(qu) nam = cur.fetchone() print("Account holder : ", nam[0]) amt = float(input("Enter the amount to deposit in account : Rs.")) if amt > t.balance: print(".. ! Amount exceeds the balance ") print(".. ! Transaction Unsucessfull") else: t.transfer(toacc, amt) qu = "update account set balance=%f where userid=%d" % ( t.balance, id) cur.execute(qu) con.commit qu = "update account set balance=%f where accno=%d" % ( toacc.balance, acc) cur.execute(qu) con.commit() qu = "insert into transaction (userid,fromacc,toacc,amount,transdate) values (%d,%d,%d,%f,curdate())" % ( id, t.account, acc, amt, ) cur.execute(qu) con.commit() print("..Transaction sucessfull") print("\t New balance in your account is Rs.", t.balance) if (opt == 6): print("\n------ Close Account -------\n") print("-- Account Details --") i = stmt(id) cnf = str(input("Are you sure ? (yes/no) : ")) if (cnf.lower() == 'no'): print("-- Account not closed --") elif (cnf.lower() == 'yes'): acc = t.account qu = "insert into closed (userid,accno,closedate) values(%d,%d,curdate())" % ( id, acc) cur.execute(qu) con.commit() qu = "delete from trans where userid=%d" % (id) cur.execute(qu) con.commit() qu = "delete from transaction where userid=%d" % (id) cur.execute(qu) con.commit() qu = "delete from account where userid=%d" % (id) cur.execute(qu) con.commit() qu = "delete from login where userid=%d" % (id) cur.execute(qu) con.commit() qu = "delete from users where userid=%d" % (id) cur.execute(qu) con.commit() os.system('cls') print(" ---- Account Closed ----") print("Successfully logged out") return True else: print(" ! Invalid option ") if (opt == 7): print(" ---- Create Fixed Deposit ----") amt = float(input("Enter the amount to deposit : ")) c = 0 while c == 0: if amt <= 1000: print(" ! ! Minimum balance is Rs.1000") amt = float(input("Enter the amount to deposit : ")) if amt >= 1000: c = 1 term = int(input("Duration of Fixed deposit in months : ")) c = 0 while c == 0: if term < 12: print(" ! ! Minimum duration is 12 months") term = int(input("Duration of Fixed deposit in months : ")) if term >= 12: c = 1 qu = "insert into fixed (userid,duration,amount,start) values (%d,%d,%f,curdate())" % ( id, term, amt) cur.execute(qu) con.commit() print("\n------ Fixed deposit created sucessfully -------") print("-- Fixed deposit Details --") fix(id) if (opt == 8): if (t.type.lower() != 'saving'): print(" --- ! You cannot avail loan") else: print(" ---- Avail a loan ----") amt = float(input("Enter the aviling loan amount : ")) c = 0 while c == 0: if amt > 2 * t.balance: print( " ! ! Your loan limit is (2 times the balance) Rs.", 2 * t.balance) amt = float(input("Amount to deposit : ")) if amt <= 2 * t.balance: c = 1 term = int(input("Repayment term in years : ")) c = 0 while c == 0: if term < 1: print(" ! ! Minimum duration is 1 year") term = int(input("Repayment term in years : ")) if term >= 1: c = 1 qu = "insert into loan (userid,lamount,repayterm,start) values (%d,%f,%d,curdate())" % ( id, amt, term) cur.execute(qu) con.commit() t.deposit(amt) qu = "update account set balance=%f where userid=%d" % ( t.balance, id) cur.execute(qu) con.commit() qu = "insert into trans values(%d,%d,'Loancredit',%f,curdate())" % ( id, t.account, amt) cur.execute(qu) con.commit() print("..Loan Sanctioned sucessfully") print("\t New balance is ", t.balance) if (opt == 9): os.system('cls') print("--- Successfully logged out ---") return True