Skip to content

Commit d7e24a7

Browse files
committed
corrected sell logic and suggestion heap
1 parent 14faf95 commit d7e24a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ranking_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ def main():
361361

362362

363363

364-
logging.info("Finished processing all strategies. Waiting for 60 seconds.")
365-
time.sleep(60)
364+
logging.info("Finished processing all strategies. Waiting for 120 seconds.")
365+
time.sleep(120)
366366

367367
elif status == "early_hours":
368368
if early_hour_first_iteration is True:

trading_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def main():
182182

183183
decision, quantity, buy_weight, sell_weight, hold_weight = weighted_majority_decision_and_median_quantity(decisions_and_quantities)
184184

185-
if portfolio_qty == 0.0 and buy_weight > sell_weight:
185+
if portfolio_qty == 0.0 and buy_weight > sell_weight and (((quantity + portfolio_qty) * current_price) / portfolio_value) < 0.1:
186186
print(f"Suggestions for buying for {ticker} with a weight of {buy_weight}")
187187
max_investment = portfolio_value * 0.10
188188
buy_quantity = min(int(max_investment // current_price), int(buying_power // current_price))
@@ -203,7 +203,7 @@ def main():
203203
print(f"Executing SELL order for {ticker}")
204204

205205
print(f"Executing quantity of {quantity} for {ticker}")
206-
quantity = min(quantity, 1)
206+
quantity = max(quantity, 1)
207207
order = place_order(trading_client, symbol=ticker, side=OrderSide.SELL, quantity=quantity, mongo_client=mongo_client) # Place order using helper
208208

209209
logging.info(f"Executed SELL order for {ticker}: {order}")

0 commit comments

Comments
 (0)