Skip to content

Commit 68e9bbf

Browse files
authored
Modify Decide() to allow for easier user implementation of algorithms
1 parent 0972976 commit 68e9bbf

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

stockbot.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,19 @@ def Decide(self, f1, f2, f3, f4):
4848

4949

5050
# here is the skeleton of an algorithm; fill in the logic for calculating the probability of profit and expected return
51-
52-
prob_profit = 0.1
53-
expected_return = 1.1
54-
modifier = 0.5
55-
5651

57-
# ~~~~ fill in code here ~~~~
58-
52+
# ~~~~ Modify code below to implement your own trading Algorithm ~~~~
5953

54+
6055
position = self.OptimalPosition(expected_return, prob_profit, modifier)
61-
shares = abs(int(position/price))
56+
shares = abs(int(position/priceo))
6257

6358
if position > 0:
6459
self.Order(Decisions.buy, shares)
6560
else:
6661
self.Order(Decisions.sell, shares)
6762

68-
63+
# ~~~~ End of trading algorithm ~~~~
6964

7065
def Order(self, decision, n = -1):
7166
""" Executes a buy/sell order of n shares, or a buy/sell max order if no input for n.

0 commit comments

Comments
 (0)