Exemplo n.º 1
0
def quote(ticker):
    with Markit(ticker) as m:
        try:
            price = m.quote()
            quota = ticker + " price = $" + str(price)
            return price
        except:
            print("\nDid not find ticker")
            return 0
Exemplo n.º 2
0
def get_data():
    markit = Markit()
    try:
        name = (markit.get_quote_msft())["Name"]
    except:
        pass
    try:
        last_price = (markit.get_quote_msft())["LastPrice"]
    except:
        pass
    try:
        timestamp = (markit.get_quote_msft())["Timestamp"]
    except:
        pass
    try:
        name1 = (markit.get_quote_goog())["Name"]
    except:
        pass
    try:
        last_price1 = (markit.get_quote_goog())["LastPrice"]
    except:
        pass
    try:
        timestamp1 = (markit.get_quote_goog())["Timestamp"]
    except:
        pass
    try:
        ORM.update_goog(name1, last_price1, timestamp1)
    except:
        pass
    try:
        ORM.update_msft(name, last_price, timestamp)
    except:
        pass
    sleep(5)
    get_data()
Exemplo n.º 3
0
def retrieve_company_data(company_name):
    markit_object = Markit()
    company_data = pd.DataFrame.from_dict(
        markit_object.company_search(company_name))
    return company_data
Exemplo n.º 4
0
def retrieve_quote(ticker_symbol):
    markit_object = Markit()
    quote_data = markit_object.get_quote(ticker_symbol)
    return quote_data
Exemplo n.º 5
0
def buy_stocks(username,shares,password,stock_exchange, stock_symbol,volume,stock_price):
	orm.check_balance(username)
	for cash in balance:
		if cash[balance'] == '0':
			print("insufficient balance") 
		if balance > (shares * stock_price):
			orm.buying_stocks(username,password,stock_exchange, stock_symbol,volume,stock_price)
	
	def buying_stocks(check_balance, stock_exchange, stock_symbol, stock_price, volume, username,password):
	#Check the balance
		print("\n\nTo access any function below, enter the corresponding key")
		print ('''To:
		want to buy stocks,press A.
		check Balance, press B.
		deposit cash,  press D.
		exit service,  press E\n
		:''')
		status = input("")
	
		if status == 'A':		
			passcheck(get_password,username)
			check_balance(balance)
	
		if status=='B':
			check_balance = orm.get_balance(username)
			
		  
		elif status=='D':
			passcheck(get_password,username)
			depositcash(stock_price*stock_symbol)

		elif status=='E':
			print ("Thank you for using our Services")
	# if enough balance, buy stocks, else return insufficient funds
	def buy(check_balance,shares,stock_price):
		number_of_shares = input("Enter number of shares: ")
		object = Markit()
		price = object.get_quote(stock_symbol)
		enter_price = input("Enter the price to purchase shares: ")

		if get_stock(stock) == None:
			stock_to_buy = {}
			stock_to_buy['shares'] = shares
			stock_to_buy['value'] = "{0:.2f}".format(float(stock_price))
		
		else:
			stock_to_buy = get_stock(stock)
			stock_to_buy['value'] = "{0:.2f}".format(float(enter_price) * int(number_of_shares)) 
			stock_to_buy['shares'] = str(int(stock_to_buy['shares']) + int(shares))
#return "Your balance is " + ({0:.2f}".format(float(enter_price) * int(number_of_shares) - balance)

def check_balance(username):
	balance = ORM.check_balance(username)
	return balance	

'''               

	
	pass

def sell_stocks(shares, price):
sale_price = input("Enter sale price: ")
	
	for stock in portfolio:
	    if stock['portfolio']
	    portfolio.remove(stock)
	pass	
	
'''
if __name__ == '__main__':
	buy_stocks(username,shares,password,stock_exchange, stock_symbol,volume,stock_price)
Exemplo n.º 6
0
def retrieve_company_data(stock_symbol):
	object = Markit()
	companyquote = object.get_quote(stock_symbol)
	return(companyquote)
Exemplo n.º 7
0
def retrive_symbols(stock_symbol):
	object = Markit()
	companylist = pd.DataFrame.from_dict(object.company_search(stock_symbol))
	return(companylist)
Exemplo n.º 8
0
def quote(ticker_symbol):
    with Markit() as m:
        return m.quote(ticker_symbol)
Exemplo n.º 9
0
def lookup(company_name):
    #endpoint = 'http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input='+company_name
    #response = json.loads(requests.get(endpoint).text)
    #return response[0]['Symbol']
    with Markit() as m:
        return m.lookup(company_name)
Exemplo n.º 10
0
def lookup(company_name):
    with Markit(company_name) as m:
        return m.lookup()
 def __init__(self):
     self.m = Markit()
     self.l = model()
Exemplo n.º 12
0
 def __init__(self):
     self.n=Markit()