Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Trading Engine
#1
So I am trying to code a python script to assist me with my stock trading. here's my code so far.
def buy():
   datr = float(input("Daily ATR: "))
   dzd = float(input("Demand Zone Distal: "))
   dzp = float(input("Demand Zone Proximal: "))
   szp = float(input("Supply Zone Proximal: "))
   szd = float(input("Supply Zone Distal: "))
   wr = (datr * 0.02)
   sl = (dzd - wr)
   rsk = (dzp - sl)
   rwd = (rsk * 3)
   t1 = (dzp + rwd)
   t2 = szp
   print("Target 1:", t1)
   print("Target 2:", t2)

def intromenu():
   choice = input("1. Buy\n2. Sell\n\nEnter: ")
   if choice == 1:
       buy()
   else:
       exit()

intromenu()
When I run the program, I enter 1, the program exits with no errors. I'm trying to make it so whenever I enter 1, the function buy() executes. Thanks.
Reply


Messages In This Thread
Python Trading Engine - by icabero0225 - May-27-2017, 07:00 PM
RE: Python Trading Engine - by buran - May-27-2017, 08:28 PM
RE: Python Trading Engine - by icabero0225 - May-27-2017, 09:46 PM
RE: Python Trading Engine - by bigmit37 - May-27-2017, 09:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python trivial endgame engine is not working as expected max22 0 639 Feb-24-2024, 04:41 PM
Last Post: max22
Star Pairs Trading Simulation Kiitoos 0 325 Feb-19-2024, 08:27 PM
Last Post: Kiitoos
  how to manage crypto trading flooding data from exchange servers Mikeardy 0 1,300 Dec-26-2021, 08:31 PM
Last Post: Mikeardy
  cbot ctrader automate trading hl29951 1 1,726 Jul-25-2021, 08:14 PM
Last Post: Larz60+
  Code should download and output trading data tayy 2 2,788 Mar-04-2021, 04:07 AM
Last Post: tayy
  Search Engine nman52 1 65,253 Dec-16-2020, 11:46 AM
Last Post: Larz60+
  problem python search engine forumpy 0 1,799 Sep-15-2020, 10:26 PM
Last Post: forumpy
  problem about slope in python script for bitcoin trading fisher_garry 1 2,592 Sep-02-2020, 01:39 PM
Last Post: fisher_garry
  Understanding Python's Import Engine MysticaL 1 2,279 Feb-07-2020, 11:26 PM
Last Post: snippsat
  Voynich search engine in python using dashes & dot totals to find Italian words Pleiades 3 3,669 Oct-10-2019, 10:04 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020