Skip to content

Commit 20176ea

Browse files
committed
Small Changes
1 parent 9d20cf0 commit 20176ea

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

Algorithm.Python/KerasNeuralNetworkAlgorithm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def NetTrain(self):
8989
self.sell_prices[symbol.Value] = y_pred_final - np.std(y_data)
9090

9191
def Trade(self):
92-
for i in self.Portfolio.Values:
92+
for holding in self.Portfolio.Values:
9393
# liquidate
94-
if self.CurrentSlice[i.Symbol.Value].Open < self.sell_prices[i.Symbol.Value] and i.Invested:
94+
if self.CurrentSlice[holding.Symbol.Value].Open < self.sell_prices[holding.Symbol.Value] and holding.Invested:
9595
self.Liquidate(i.Symbol)
9696

9797
# buy
98-
if self.CurrentSlice[i.Symbol.Value].Open > self.buy_prices[i.Symbol.Value] and not i.Invested:
99-
self.SetHoldings(i.Symbol, 1 / len(self.symbols))
98+
if self.CurrentSlice[holding.Symbol.Value].Open > self.buy_prices[holding.Symbol.Value] and not holding.Invested:
99+
self.SetHoldings(holding.Symbol, 1 / len(self.symbols))

Algorithm.Python/NLTKSentimentTradingAlgorithm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ def Trade(self):
4848
positive_word = 'Up'
4949
negative_word = 'Down'
5050

51-
for i in self.Portfolio.Values:
51+
for holding in self.Portfolio.Values:
5252
# liquidate if it contains negative words
53-
if negative_word in words and i.Invested:
54-
self.Liquidate(i.Symbol)
53+
if negative_word in words and holding.Invested:
54+
self.Liquidate(holding.Symbol)
5555

5656
# buy if it contains positive words
57-
if positive_word in words and not i.Invested:
58-
self.SetHoldings(i.Symbol, 1 / len(self.symbols))
57+
if positive_word in words and not holding.Invested:
58+
self.SetHoldings(holding.Symbol, 1 / len(self.symbols))
5959

6060
def get_text(self):
6161
# import custom data

Algorithm.Python/PytorchNeuralNetworkAlgorithm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ def NetTrain(self):
9090

9191
def Trade(self):
9292

93-
for i in self.Portfolio.Values:
93+
for holding in self.Portfolio.Values:
9494
# liquidate
95-
if self.CurrentSlice[i.Symbol.Value].Open < self.sell_prices[i.Symbol.Value] and i.Invested:
96-
self.Liquidate(i.Symbol)
95+
if self.CurrentSlice[holding.Symbol.Value].Open < self.sell_prices[holding.Symbol.Value] and holding.Invested:
96+
self.Liquidate(holding.Symbol)
9797

9898
# buy
99-
if self.CurrentSlice[i.Symbol.Value].Open > self.buy_prices[i.Symbol.Value] and not i.Invested:
100-
self.SetHoldings(i.Symbol, 1 / len(self.symbols))
99+
if self.CurrentSlice[holding.Symbol.Value].Open > self.buy_prices[holding.Symbol.Value] and not holding.Invested:
100+
self.SetHoldings(holding.Symbol, 1 / len(self.symbols))
101101

102102

103103

Launcher/config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"environment": "backtesting", // "live-paper", "backtesting", "live-interactive", "live-interactive-iqfeed"
1010

1111
// algorithm class selector
12-
"algorithm-type-name": "BasicTemplateFrameworkAlgorithm",
12+
"algorithm-type-name": "PytorchNeuralNetworkAlgorithm",
1313

1414
// Algorithm language selector - options CSharp, FSharp, VisualBasic, Python, Java
15-
"algorithm-language": "CSharp",
15+
"algorithm-language": "Python",
1616

1717
//Physical DLL location
18-
"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
19-
//"algorithm-location": "../../../Algorithm.Python/BasicTemplateFrameworkAlgorithm.py",
18+
//"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
19+
"algorithm-location": "../../../Algorithm.Python/PytorchNeuralNetworkAlgorithm.py",
2020
//"algorithm-location": "QuantConnect.Algorithm.FSharp.dll",
2121
//"algorithm-location": "QuantConnect.Algorithm.VisualBasic.dll",
2222
//"algorithm-location": "QuantConnect.Algorithm.Java.dll",

0 commit comments

Comments
 (0)