示例#1
0
	def __init__(self):

		# Store URL
		url =' https://finance.yahoo.com/gainers'

		#Handle Page? handles contents of website?
		page = requests.get(url)
		self.spLimit = balance.Balance().balance

		
		# Store contents of website under doc
		doc = lh.fromstring(page.content)
		self.tr_elements = doc.xpath('//tr')
		self.toList()
		self.saves()
def main():
    bal = balance.Balance("balance.csv")
    cht = chart.Chart("chart.csv", bal)
    mty = Ministry(cht)
    unused = mty.unused_accounts()

    from pprint import pprint

    def names(numbers):
        return [cht.account(num).name() for num in numbers]

    display = {}
    for key in unused:
        display[key] = names(unused[key])
    pprint(display)
示例#3
0
	def buy(self):

		
		sys.path.insert(0, self.parent_dir) 
		
		s =''
		for i in range(0, len(self.Ssym),1):
			# Writes Stock Buying info to accounts.csv
			with  open(self.path,'a') as account:
				writer = csv.writer(account, delimiter= ',',quotechar = '"',lineterminator = '\n')
				# 
				s = [str(self.Ssym[i]),str(self.Sprice[i]),str(self.Svolume[i]),]
				writer.writerow(s)

				balanceNew  = int(balance.Balance().balance)
				d = int(self.Svolume[i])
				e = int(CPS.getprice(self.Ssym[i]))
				s = d*e
				price  = balanceNew-(d*e)
				(CPS.writeBalance((price)))
示例#4
0
文件: main.py 项目: ssilb4/custom_atm
def main():
    card_number = insert_card.InsertCard()

    pin = input("write pin number: ")
    print(pin)
    if pin_number.PinNumber().check_pin_number(pin, card_number):
        pass
    else:
        print("false pin number")
        return False

    accounts = select_account.SelectAccount()
    accounts_number = accounts.get_account(card_number)
    print(accounts_number)
    account_index = input("select account index. (It starts 0): ")
    account_number = ""
    if accounts.select_accounts(int(account_index)) == False:
        print("false selected account")
        return False
    else:
        account_number = accounts.select_accounts(int(account_index))

    balanceOperation = balance.Balance(account_number)
    purpose = input(
        "select number. (1: see balance, 2: withdraw, 3: diposit ): ")
    if purpose == "1":
        return balanceOperation.getBalance(account_number)
    elif purpose == "2":
        withdraw_money = int(input("write money: "))
        return balanceOperation.withdraw(account_number, withdraw_money)
    elif purpose == "3":
        deposit_money = int(input("write money: "))
        return balanceOperation.deposit(account_number, deposit_money)
    else:
        print("false selected transaction")
        return False
示例#5
0
import balance
from netaddr import IPNetwork, IPAddress, IPSet


ip1 = IPNetwork('192.168.0.0/24')
ip2 = IPNetwork('10.1.0.0/24')
ip3 = IPNetwork('143.82.0.0/16')

address1 = '54450450e24286143a35686ad77a7c851ada01a0'
address2 = '00000450e24286143a35686ad77a7c851ada0000'
bal = balance.Balance()

bal.add_delegated_ips(address1, ip1)
bal.add_delegated_ips(address1, ip2)
bal.add_delegated_ips(address2, ip3)

print(bal.delegated_ips)

print "checking address 192.168.0.0/25"
print bal.affected_delegated_ips(IPNetwork('0.0.0.0/0'))

print "checking address 192.168.0.0/24"
print bal.affected_delegated_ips(IPNetwork('192.168.0.0/24'))

print "checking address 192.168.0.0/23"
print bal.affected_delegated_ips(IPNetwork('192.168.0.0/23'))

示例#6
0
import hand
import balance
import game
import go

# Start game
game = game.Game()

# Create Deck and shuffle
deck = deck.Deck()
deck.createDeck()
deck.shuffle()

# Bring in starting stack
stack = input("How much would you like to bring to the table? ")
player_balance = balance.Balance(int(stack))

while not game.is_finished:

    print("Your balance is: {}".format(player_balance.get_balance()))

    bet = input("What would you like to bet? ")
    bet = int(bet)
    r = go.Round(bet)
    if not player_balance.bet_accepted(r.bet):
        print('Bet too much! Please choose a smaller amount')
        while not player_balance.bet_accepted(r.bet):
            bet = input("What would you like to bet? ")
            bet = int(bet)
            r = go.Round(bet)
示例#7
0
	def sell(self):
		
		# Stock to sell
		self.load = ['SLF.TO']
		self.SellSym = []
		self.SellVol = []


		# Removes stock that is being sold from csv
		#self.ctrTwo = -1
		if len(self.load) > 1:
			for i in range(0,len(self.load),1):
				with open(self.path, 'r') as inp, open(self.parent_dir+'\\Data\\accountsTmp.csv','a+') as out:
			
		
					writer = csv.writer(out, delimiter = ',', lineterminator = '/n')
					
					for row in csv.reader(inp, delimiter=','):
						if str(row[0]) != str(self.load[0]):
							writer.writerow(row)
						else:
							self.SellVol.append(int(row[2]))
							self.SellSym.append(row[0])
				
					self.ctr -= 1
		else:
			with open(self.path, 'r') as inp, open(self.parent_dir+'\\Data\\accountsTmp.csv','a+') as out:
	
					writer = csv.writer(out, delimiter = ',',lineterminator = '\n')
					for row in csv.reader(inp, delimiter = ',',lineterminator = '\n'):
						if str(row[0]) != str(self.load[0]):
							writer.writerow(row)
						else:
							self.SellVol.append(int(row[2]))
							self.SellSym.append(row[0])

		# Eeases main CSV file 
		erase = open(self.path, 'w+')
		erase.close()



		for i in range(0, len(self.SellVol),1):
			
			balanceNew  = int(balance.Balance().balance)
			d = int(self.SellVol[i])
			e = int(CPS.getprice(self.SellSym[i]))
			price  = (d * e) + (balanceNew)
			(CPS.writeBalance((price)))


			# Re writes to main from temp accounts pages
		datas = self.parent_dir +'\\Data\\accountsTmp.csv'
		# Replaces csv file from temp
		with open(self.path, 'w') as account:
			writer = csv.writer(account, delimiter = ',',quotechar = '"',lineterminator = '\n')
			with open(datas, 'r') as write:
				reader = csv.reader(write,delimiter = ',')
				for row in reader:
					writer.writerow(row)
		

		# Erase accountsTmp File
		erase = open(datas, 'w+')
		erase.close()
示例#8
0
#This is an example of usage

import balance

redirects = ['site1.example.com', 'site2.example.it']

libra = balance.Balance()
libra.add(redirects)
libra.setWeight(5)
libra.listen('127.0.0.1', 3000)
libra.thread()