Generation

typingsSun, 14 May 2023

def analyze_prices(df): positions, _ = open_positions(list(df['symbol'])) num_open_long_positions, num_open_short_positions = count_open_positions(positions) sent_orders = [] print(f"Num Open Long Positions: {num_open_long_positions}") print(f"Num Open Short Positions: {num_open_short_positions}") for _, row in df.iterrows(): symbol = row['symbol'] # Check if order has already been sent for this symbol if symbol in sent_orders: print(f"Ya se envió una orden {symbol}. Continuar...") if num_open_long_positions >= 2: print(f"Symbol: {row['symbol']} | Last Price: {row['last_price']} | Max Ask Price: {row['max_ask_price']}") if pd.notnull(row['max_ask_price']) and row['last_price'] <= row['max_ask_price'] - 0.005: print(f"Symbol: {row['symbol']} | TRUE | Ask: {row['max_ask_price']}")

Want to kickstart your project?Use the new AI Studio to create your code