Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- os.system("@echo off")
- #@Krane 17/7/2018 /\ 2:20 PM
- #Calculate in minutes
- #Value in Us dollars
- #if stock cost == 500 at 10:30 AM
- #after 1 hours in minutes stock_prices[60] = 500
- #~
- #Function that take stock_prices && return
- #maxProfit in 1 buy
- #~
- #No insta buy-sell
- #Buy before sell w/ cooldown 1 min
- #EG code :
- #stock_prices = [10,7,5,8,11,9]
- #getMaxProfit(stockPrices)
- #"returns 6" buying for 5 dol and sell for 11
- #so 5 * 6 == purches
- #6 * 11 == profit IF stocks_remain the same for 1 min at least
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- import time
- stockPrices = [5,7,10,4,3] # eg 5 = 5 dollars / that share
- def maxProfitToday():
- PPS = input("Cat dai pe un share azi?: ")
- sellBe = input("Pe cat il vinzi?: ")
- if sellBe == "11" and PPS == "6":
- moneySpent = []
- moneyProfit = []
- for i in stockPrices:
- moneySpent.append(i * 6)
- moneyProfit.append(i * 11)
- for i in moneyProfit:
- for i2 in moneySpent:
- #time.sleep(60) # buy/sell rule
- if PPS == "6" and sellBe == "11":
- totalBaniAzi = i - i2
- print(moneySpent)
- print("^Bani luati per share^")
- print(moneyProfit)
- print("^Cat ai primit per share^")
- return "Azi faci " +str(totalBaniAzi)+ " dolari profit"
- else:
- return "Piata este nesigura."
- print(maxProfitToday())
- time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement