I'm placing an order during live-streaming of stocks and getting data in a table/dataframe format like this , in which i get ohlc brick numbers and so on and on.....
time_stamp open high low close direction brick_counts volume GREEN_BAR RED_BAR BLUE_BAR time_id
20 2021-11-19 21:41:43 66030.0 66030.0 66028.5 66028.5 down -21 1116.333333 False False True 1
21 2021-11-19 21:41:43 66028.5 66028.5 66027.0 66027.0 down -22 1116.333333 False False True 1
22 2021-11-19 21:41:43 66027.0 66027.0 66025.5 66025.5 down -23 1116.333333 False False True 2
23 2021-11-19 21:41:43 66025.5 66025.5 66024.0 66024.0 down -24 1116.333333 False False True 2
24 2021-11-19 21:41:43 66024.0 66024.0 66022.5 66022.5 down -25 1116.333333 False False True 2
25 2021-11-19 21:41:43 66022.5 66022.5 66021.0 66021.0 down -26 1116.333333 False False True 2
And using this if-loop code to place an order to my account.
if len(pos_df.columns) == 0 and len(ord_df.columns) == 0:
for i in range(0,len(bricks_counts)):
if bricks_counts[i] == -23 and red_neg == True:
placeCoverOrder(ticker,"sell",quantity,high_down)
print("sell order placed {}".format(ticker))
break
Here i need that the if-loop should execute only once while live-streaming. I mean in the first iteration the if-loop sholud be true and in the second iteration the if-loop should be false.
Any help would be appreciated stack bros.
Aucun commentaire:
Enregistrer un commentaire