Advertisement
Guest User

@krane@

a guest
Jul 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. import os
  2. os.system("@echo off")
  3. #@Krane 17/7/2018 /\ 2:20 PM
  4. #Calculate in minutes
  5. #Value in Us dollars
  6. #if stock cost == 500 at 10:30 AM
  7. #after 1 hours in minutes stock_prices[60] = 500
  8. #~
  9. #Function that take stock_prices && return
  10. #maxProfit in 1 buy
  11. #~
  12. #No insta buy-sell
  13. #Buy before sell w/ cooldown 1 min
  14. #EG code :
  15. #stock_prices = [10,7,5,8,11,9]
  16. #getMaxProfit(stockPrices)
  17. #"returns 6" buying for 5 dol and sell for 11
  18. #so 5 * 6 == purches
  19. #6 * 11 == profit IF stocks_remain the same for 1 min at least
  20. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. import time
  22. stockPrices = [5,7,10,4,3] # eg 5 = 5 dollars / that share
  23. def maxProfitToday():
  24. PPS = input("Cat dai pe un share azi?: ")
  25. sellBe = input("Pe cat il vinzi?: ")
  26. if sellBe == "11" and PPS == "6":
  27. moneySpent = []
  28. moneyProfit = []
  29. for i in stockPrices:
  30. moneySpent.append(i * 6)
  31. moneyProfit.append(i * 11)
  32. for i in moneyProfit:
  33. for i2 in moneySpent:
  34. #time.sleep(60) # buy/sell rule
  35. if PPS == "6" and sellBe == "11":
  36. totalBaniAzi = i - i2
  37. print(moneySpent)
  38. print("^Bani luati per share^")
  39. print(moneyProfit)
  40. print("^Cat ai primit per share^")
  41. return "Azi faci " +str(totalBaniAzi)+ " dolari profit"
  42. else:
  43. return "Piata este nesigura."
  44. print(maxProfitToday())
  45. time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement