Last active
November 25, 2025 06:04
-
-
Save giobel/4f4ee5b6ed5b483438291be888ef30a0 to your computer and use it in GitHub Desktop.
*MISC PYTHON*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Collection of misc python scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from revizto_decoder import decode_aptmpl | |
| import zlib, re, binascii, json | |
| import blackboxprotobuf | |
| import base64 | |
| import inspect | |
| import random | |
| import colorsys | |
| def color_to_int(r, g, b, a=255, order='RGBA'): | |
| """ | |
| Convert RGBA components (0–255) to a 32-bit integer. | |
| order = 'RGBA' or 'ARGB' (Revizto-like). | |
| """ | |
| if order.upper() == 'RGBA': | |
| return (r << 24) | (g << 16) | (b << 8) | a | |
| elif order.upper() == 'ARGB': | |
| return (a << 24) | (r << 16) | (g << 8) | b | |
| else: | |
| raise ValueError("order must be 'RGBA' or 'ARGB'") | |
| def random_color_int(): | |
| """Generate a random RGBA color encoded as an integer.""" | |
| r = random.randint(0, 255) | |
| g = random.randint(0, 255) | |
| b = random.randint(0, 255) | |
| a = 255 # fully opaque | |
| return color_to_int(r, g, b, a) | |
| def distinct_colors_int(n): | |
| """Generate n visually distinct colors encoded as 32-bit integers.""" | |
| colors = [] | |
| for i in range(n): | |
| hue = i / n # evenly spaced hues around the color wheel | |
| r, g, b = colorsys.hsv_to_rgb(hue, 0.85, 1.0) # bright and saturated | |
| r, g, b = int(r * 255), int(g * 255), int(b * 255) | |
| colors.append(color_to_int(r, g, b)) | |
| return colors | |
| def varName(var): | |
| lcls = inspect.stack()[2][0].f_locals | |
| for name in lcls: | |
| if id(var) == id(lcls[name]): | |
| return name | |
| return None | |
| def printStars(message): | |
| try: | |
| print (f"********{varName(message).upper()}**********\n", message) | |
| except: | |
| print('**************\n',message) | |
| path = 'test.aptmpl' | |
| with open(path, "rb") as f: | |
| data = f.read() | |
| printStars(data) | |
| # b'\n\tAppearSet\x10\x01\x18\x00"o\x10\x00\x18\x00"\x04test(\x002a\x08\x00\x11.\x1e\\\xb8\xa4\xf3V\x1a\x1aTx\x9c\xe3\xf2\xe7`\x16`\x90\xf2\xe4`\x10r\xe5r\x16r\x04\xd2\[email protected]\n$\xf9\x85x\x83\x83\x9c\xe3\xdd\x9c\x1c\xe3\x83R\x93\x12\x8b\xa4\x84\x85\x04]R\x93\xb3\x15\x82S\xd3sS\xf3J\x14B*\x0bR\x9589X\x85X\x83\x1d\x83\x0c\x1d5\xd8$\x18\x00/\xfd\x0f\xd0**\n(\n$03830493-408b-4122-ba60-328f872ca1c9\x10\x00' | |
| #ALL DECODED DATA | |
| decdata, typeof = blackboxprotobuf.decode_message(data) | |
| printStars(decdata) | |
| # {'1': {'8': 8387201631772831856}, '2': 1, '3': 0, '4': {'2': 0, '3': 0, '4': b'test', '5': 0, '6': {'1': 0, '2': 1897972181776473646, '3': b'x\x9c\xe3\xf2\xe7`\x16`\x90\xf2\xe4`\x10r\xe5r\x16r\x04\xd2\[email protected]\n$\xf9\x85x\x83\x83\x9c\xe3\xdd\x9c\x1c\xe3\x83R\x93\x12\x8b\xa4\x84\x85\x04]R\x93\xb3\x15\x82S\xd3sS\xf3J\x14B*\x0bR\x9589X\x85X\x83\x1d\x83\x0c\x1d5\xd8$\x18\x00/\xfd\x0f\xd0'}}, '5': {'1': {'1': b'03830493-408b-4122-ba60-328f872ca1c9', '2': 0}}} | |
| # RENAME APPEARANCE TEMPLATE | |
| decdata['4']['4'] = 'Colour Search' | |
| # EXTRACT TEMPLATE PROPERTIES | |
| blob1 = decdata['4']['6']['3'] | |
| printStars(blob1) | |
| # b'x\x9c\xe3\xf2\xe7`\x16`\x90\xf2\xe4`\x10r\xe5r\x16r\x04\xd2\[email protected]\n$\xf9\x85x\x83\x83\x9c\xe3\xdd\x9c\x1c\xe3\x83R\x93\x12\x8b\xa4\x84\x85\x04]R\x93\xb3\x15\x82S\xd3sS\xf3J\x14B*\x0bR\x9589X\x85X\x83\x1d\x83\x0c\x1d5\xd8$\x18\x00/\xfd\x0f\xd0' | |
| #DECOMPRESS TEMPLATE PROPERTIES | |
| mes1 = zlib.decompress(blob1) | |
| printStars(mes1) | |
| # b'\nO\x08\x03\x10\x00\x1aI\x08\x00\x12E\nC\x12A\x08\x00\x12;\x08\x00\x127\x125\x08\x00\x12\x0f\x12\rSRC_FBA_Rebar\x1a\x13\x12\x11Deck Segment Type"\t\x08\x05\x12\x05SAR1A(\x06\x18\x00' | |
| # DECODE TEMPLATE PROPERTIES | |
| decItem, itemTypeOf = blackboxprotobuf.decode_message(mes1) | |
| printStars (decItem) | |
| print ('test \n', decItem['1'][0]['2']) | |
| # {'1': {'1': 3, '2': 0, '3': {'1': 0, '2': {'1': {'2': {'1': 0, '2': {'1': 0, '2': {'2': {'1': 0, '2': {'2': b'SRC_FBA_Rebar'}, '3': {'2': b'Deck Segment Type'}, '4': {'1': 5, '2': b'SAR1A'}, '5': 6}}}, '3': 0}}}}}} | |
| #decItem['1'][0]['2'] = 1325369087 #4EFF86 | |
| decItem['1'] = [] | |
| template = {'1': 4, '2': 1325369087, '3': {'1': 0, '2': {'1': {'2': {'1': 0, '2': {'1': 0, '2': {'2': {'1': 0, '2': {'2': b'SRC_FBA_Rebar'}, '3': {'2': b'Slice Number'}, '4': {'1': 5, '2': b'S001'}, '5': 6}}}, '3': 1}}}}} | |
| print ('template', template['2']) | |
| for i in range(0,220): | |
| entry = template.copy() | |
| import copy | |
| entry = copy.deepcopy(template) # deep copy to avoid shared refs | |
| #colour | |
| entry['2'] = random_color_int() | |
| #property name | |
| entry['3']['2']['1']['2']['2']['2']['2']['4']['2'] = f"S{i:03}".encode('utf-8') # makes b'S001' … b'S010' | |
| #print(template['3']['2']['1']['2']['2']['2']['2']['4']['2']) | |
| print (entry) | |
| decItem['1'].append(entry) | |
| #print (decItem) | |
| # ### property name | |
| # print ('property tab ', decItem['1']['3']['2']['1']['2']['2']['2']['2']['2']['2']) | |
| # print ('property name ', decItem['1']['3']['2']['1']['2']['2']['2']['2']['3']['2']) | |
| # print ('condition ', decItem['1']['3']['2']['1']['2']['2']['2']['2']['5']) #6=equal 7=not equal | |
| # # property tab | |
| # decItem['1']['3']['2']['1']['2']['2']['2']['2']['2']['2'] = b'SRC_FBA' | |
| # # property name | |
| # decItem['1']['3']['2']['1']['2']['2']['2']['2']['3']['2'] = b'Diameter' | |
| # #condition | |
| # decItem['1']['3']['2']['1']['2']['2']['2']['2']['5'] = 7 | |
| # # RENAME PROPERTY VALUE | |
| # property_value = decItem['1']['3']['2']['1']['2']['2']['2']['2']['4']['2'] | |
| # print ('property value ', property_value) | |
| # decItem['1']['3']['2']['1']['2']['2']['2']['2']['4']['2'] = b'170' | |
| #printStars (decItem) | |
| encItem = blackboxprotobuf.encode_message(decItem, itemTypeOf) | |
| #replaced message | |
| mes2 = zlib.compress(encItem) | |
| decdata['4']['6']['3'] = mes2 | |
| data2 = blackboxprotobuf.encode_message(decdata, typeof) | |
| #printStars(data2) | |
| with open("Reencoded_AppearSet.aptmpl", "wb") as f: | |
| f.write(data2) | |
| print ('done') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyautogui | |
| import time | |
| import tkinter as tk | |
| from tkinter import messagebox | |
| from pynput import mouse | |
| from pynput import keyboard | |
| import math | |
| clicked_points = [] #start, step, end | |
| delay = 3 | |
| def on_click(x, y, button, pressed): | |
| if pressed: | |
| #print(f"You clicked at ({x}, {y}) with {button}") | |
| clicked_points.append((x,y)) | |
| # Stop after collecting 5 points (change as needed) | |
| if len(clicked_points) >= 3: | |
| #print("Captured 3 points:") | |
| for point in clicked_points: | |
| print(point) | |
| return False # Stop listening | |
| def on_press(key): | |
| try: | |
| global delay | |
| #print(f"Key pressed: {key.char}") | |
| delay = int(key.char) | |
| return False | |
| except AttributeError: | |
| print(f"Special key pressed: {key}") | |
| root = tk.Tk() | |
| root.withdraw() # Hide the main window | |
| root.attributes("-topmost", True) # Make sure it's on top | |
| tk.messagebox.showinfo("ScreenGrabber", f"Please click start,offset and end point") | |
| with mouse.Listener(on_click=on_click) as listener: | |
| listener.join() | |
| screenWidth, screenHeight = pyautogui.size() # Get the size of the primary monitor. | |
| print (screenWidth, screenHeight) | |
| #time.sleep(3) # Wait for the window to appear | |
| currentMouseX, currentMouseY = pyautogui.position() | |
| print (currentMouseX, currentMouseY) | |
| start = clicked_points[0] | |
| end = clicked_points[2] | |
| step = clicked_points[1][1]-clicked_points[0][1] | |
| count = math.ceil((end[1] - start[1])/step) + 1 | |
| print (f"length {end[1] - start[1]}") | |
| print (f"step {step}") | |
| print (f"count {count}") | |
| tk.messagebox.showinfo("ScreenGrabber", f"Click OK and type the delay in seconds. Default is 3 seconds") | |
| with keyboard.Listener(on_press=on_press) as listener: | |
| listener.join() | |
| time.sleep(1) | |
| for i in range(0,count): | |
| pyautogui.moveTo(start[0], start[1] + i * step) | |
| pyautogui.click() | |
| time.sleep(delay) # Wait for the window to appear | |
| timestamp = time.time() | |
| local_time = time.localtime(timestamp) | |
| formatted_time = time.strftime("%Y-%m-%d %H:%M:%S", local_time) | |
| formatted_time = formatted_time.replace(':','_') | |
| screenshot = pyautogui.screenshot() | |
| screenshot.save(formatted_time + "_FBA.png") | |
| tk.messagebox.showinfo("ScreenGrabber", f"Done") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import yfinance as yf | |
| def adrp(df, length): | |
| ratio = df['High'] / df['Low'] | |
| sma_ratio = ratio.rolling(length).mean() | |
| range_pct = round((sma_ratio - 1) * 100,2) | |
| return range_pct | |
| def check_price_streak( | |
| df, | |
| ticker, | |
| start_date, | |
| min_value, | |
| bought_price, | |
| target_value, | |
| ): | |
| # Download historical data | |
| #df = yf.download(ticker,period="30d", interval="1d", progress=False, auto_adjust=True) | |
| a = adrp(df, 20) | |
| # Ensure datetime index | |
| df.index = pd.to_datetime(df.index) | |
| # Filter starting from the chosen date | |
| df = df.loc[start_date:] | |
| a = a.loc[start_date] | |
| print(f"ADR {round(a.item(),2)}%") | |
| risk = round(((bought_price/min_value) - 1) * 100,2) | |
| print (f"Risk {risk}%") | |
| if (risk > 0.66 * a.item()): | |
| print (f"Risk too high!!! Risk = {round(risk/a.item(),2)}") | |
| else: | |
| print (f"Risk < 0.66 x ADR. Acceptable Risk = {round(risk/a.item(),2)}") | |
| # Safely extract 'Close', 'High', and 'Low' prices as Series, handling MultiIndex if present | |
| close = None | |
| high = None | |
| low = None | |
| if isinstance(df.columns, pd.MultiIndex): | |
| close_col_tuple = ('Close', ticker) | |
| high_col_tuple = ('High', ticker) | |
| low_col_tuple = ('Low', ticker) | |
| # Attempt to get directly if columns exist as (ColumnType, Ticker) | |
| if close_col_tuple in df.columns: | |
| close = df[close_col_tuple] | |
| if high_col_tuple in df.columns: | |
| high = df[high_col_tuple] | |
| if low_col_tuple in df.columns: | |
| low = df[low_col_tuple] | |
| # Fallback if the MultiIndex structure isn't exactly ('ColumnType', Ticker) | |
| if close is None and 'Close' in df.columns and isinstance(df['Close'], pd.DataFrame) and ticker in df['Close'].columns: | |
| close = df['Close'][ticker] | |
| if high is None and 'High' in df.columns and isinstance(df['High'], pd.DataFrame) and ticker in df['High'].columns: | |
| high = df['High'][ticker] | |
| if low is None and 'Low' in df.columns and isinstance(df['Low'], pd.DataFrame) and ticker in df['Low'].columns: | |
| low = df['Low'][ticker] | |
| # Final fallback if still not found, and 'Close' / 'High' / 'Low' are top-level series | |
| if close is None and 'Close' in df.columns and isinstance(df['Close'], pd.Series): | |
| close = df['Close'] | |
| if high is None and 'High' in df.columns and isinstance(df['High'], pd.Series): | |
| high = df['High'] | |
| if low is None and 'Low' in df.columns and isinstance(df['Low'], pd.Series): | |
| low = df['Low'] | |
| else: | |
| # Standard case: columns are flat, e.g., 'Close' | |
| close = df['Close'] | |
| high = df['High'] | |
| low = df['Low'] | |
| # Check if we successfully extracted all series | |
| if close is None or high is None or low is None: | |
| raise ValueError(f"Could not reliably extract 'Close', 'High', or 'Low' price for {ticker} from DataFrame with unexpected column structure.") | |
| # Ensure 'close', 'high', and 'low' are Series. Squeeze if they are single-column DataFrames. | |
| if isinstance(close, pd.DataFrame) and len(close.columns) == 1: | |
| close = close.squeeze() | |
| elif not isinstance(close, pd.Series): | |
| raise ValueError("Expected 'close' to be a pandas Series but got a different type after extraction.") | |
| if isinstance(high, pd.DataFrame) and len(high.columns) == 1: | |
| high = high.squeeze() | |
| elif not isinstance(high, pd.Series): | |
| raise ValueError("Expected 'high' to be a pandas Series but got a different type after extraction.") | |
| if isinstance(low, pd.DataFrame) and len(low.columns) == 1: | |
| low = low.squeeze() | |
| elif not isinstance(low, pd.Series): | |
| raise ValueError("Expected 'low' to be a pandas Series but got a different type after extraction.") | |
| n = len(close) # Assuming 'high' and 'low' have the same length and index | |
| if n < 2: | |
| return { | |
| "days": 0, | |
| "last_date": None, | |
| "last_price": None, | |
| "roi": "N/A", | |
| "reason": "Not enough data after start date" | |
| } | |
| streak = 2 | |
| # Start from the *day after* the chosen start date | |
| for i in range(1, n): | |
| current_close_price = close.iloc[i].item() | |
| current_high_price = high.iloc[i].item() | |
| current_low_price = low.iloc[i].item() | |
| # Condition 1: Intraday low dropped below minimum value (most aggressive stop-loss) | |
| if current_low_price <= min_value: | |
| final_price_for_roi = min_value # Assume sold at min_value | |
| roi = f"Gain {round((final_price_for_roi - bought_price)/bought_price*100,2)}%" | |
| return { | |
| "days": streak, | |
| "last_date": close.index[i], # Date when the low occurred | |
| "last_price": current_low_price, # The actual low price that triggered | |
| "roi": roi, | |
| "reason": f"Intraday low dropped below minimum ({min_value})" | |
| } | |
| # Condition 2: Closing price dropped below minimum value | |
| if current_close_price <= min_value: | |
| final_price_for_roi = min_value # Assume sold at min_value | |
| roi = f"Gain {round((final_price_for_roi - bought_price)/bought_price*100,2)}%" | |
| return { | |
| "days": streak, | |
| "last_date": close.index[i], # Date when the close occurred | |
| "last_price": current_close_price, # The actual close price that triggered | |
| "roi": roi, | |
| "reason": f"Closing price dropped below minimum ({min_value})" | |
| } | |
| # Condition 3: Intraday high reached or exceeded target value | |
| if current_high_price >= target_value: | |
| final_price_for_roi = target_value # Assume sold at target price | |
| roi = f"Gain {round((final_price_for_roi - bought_price)/bought_price*100,2)}%" | |
| return { | |
| "days": streak, | |
| "last_date": close.index[i], # Date when the high occurred | |
| "last_price": current_high_price, # The actual high price that triggered | |
| "roi": roi, | |
| "reason": f"Intraday high reached or exceeded target ({target_value})" | |
| } | |
| # Condition 4: Closing price reached or exceeded target value (if not already met by high) | |
| if current_close_price >= target_value: | |
| final_price_for_roi = target_value # Assume sold at target price | |
| roi = f"Gain {round((final_price_for_roi - bought_price)/bought_price*100,2)}%" | |
| return { | |
| "days": streak, | |
| "last_date": close.index[i], # Date when the close occurred | |
| "last_price": current_close_price, # The actual close price that triggered | |
| "roi": roi, | |
| "reason": f"Closing price reached or exceeded target ({target_value})" | |
| } | |
| streak += 1 | |
| # If we never broke any condition by the end of the data | |
| last_price_at_end = close.iloc[-1].item() | |
| roi_at_end = f"Gain {round((last_price_at_end - bought_price)/bought_price*100,2)}%" | |
| return { | |
| "days": streak, | |
| "last_date": close.index[-1], | |
| "last_price": last_price_at_end, | |
| "roi": roi_at_end, | |
| "reason": "Reached end of data" | |
| } | |
| ### INPUTS ### | |
| t = "NKTR" | |
| start_date = "2025-11-11" | |
| ### END ### | |
| data = yf.download(t, period="30d", interval="1d", progress=False, auto_adjust=True) | |
| #print (data) | |
| min_value = data.loc[start_date]['Low'].item() | |
| bought_price = data.loc[start_date]['High'].item() | |
| target_value = round(bought_price/min_value*bought_price,2) | |
| print(f"Bought Price ${round(bought_price,2)}") | |
| print(f"Bottom Price ${round(min_value,2)}") | |
| print(f"Target Price ${target_value}") | |
| print(f"Target Gain {round(((target_value/bought_price)-1)*100,2)}%") | |
| result = check_price_streak( | |
| df =data, | |
| ticker=t, | |
| start_date=start_date, | |
| min_value=min_value, | |
| bought_price=bought_price, | |
| target_value=target_value, | |
| ) | |
| print(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import yfinance as yf | |
| import pytz | |
| from datetime import datetime, time, timedelta | |
| # =========================== | |
| # Helper Functions | |
| # =========================== | |
| def adrp(df, length): | |
| """ | |
| df: pandas DataFrame containing df['High'] and df['Low'] | |
| length: SMA length (adrp_len) | |
| """ | |
| ratio = df['High'] / df['Low'] | |
| sma_ratio = ratio.rolling(length).mean() | |
| adrp_percent = 100 * (sma_ratio - 1) | |
| return adrp_percent | |
| def TestDate(df): | |
| df = df.copy() | |
| df.columns = [col[0] if isinstance(col, tuple) else col for col in df.columns] | |
| df["MA6"] = df["Close"].rolling(window=6, min_periods=6).mean() | |
| df_date = (df.loc["2025-11-07"]) | |
| print (df_date) | |
| print('condition2', (df_date["High"] - df_date["Close"]) / df_date["High"] )# Close near high (within 0.5%) | |
| print('condition3', (df_date["Low"] / df_date["Close"]) )# Low is within 7% of close | |
| print ('condition4a', (abs(df_date["Open"] - df_date["MA6"]) / df_date["MA6"])) | |
| print ('condition4b', (abs(df_date["Close"] - df_date["MA6"]) / df_date["MA6"])) | |
| condition1 = df_date["Open"] < df_date["Close"] # Green candle | |
| condition2 = (df_date["High"] - df_date["Close"]) / df_date["High"] < 0.0055 # Close near high (within 0.5%) | |
| condition3 = (df_date["Low"] / df_date["Close"]) > 0.93 # Low is within 7% of close | |
| condition4 = ( | |
| (abs(df_date["Open"] - df_date["MA6"]) / df_date["MA6"] < 0.018) | | |
| (abs(df_date["Close"] - df_date["MA6"]) / df_date["MA6"] < 0.018) | |
| ) | |
| print (condition1, condition2, condition3, condition4) | |
| def GetTriggerBar(df): | |
| #TestDate(df) | |
| df = df.copy() | |
| df.columns = [col[0] if isinstance(col, tuple) else col for col in df.columns] | |
| # Compute 6-day moving average | |
| df["MA6"] = df["Close"].rolling(window=6, min_periods=6).mean() | |
| # Filter conditions: | |
| # 1. open < close (green candle) | |
| # 2. close is almost equal to high (close/high close to 1.0, difference < 1%) | |
| # 3. low/close < 3% (wick at bottom is small) | |
| condition1 = df["Open"] < df["Close"] # Green candle | |
| condition2 = (df["High"] - df["Close"]) / df["High"] < 0.0055 # Close near high (within 0.5%) | |
| condition3 = (df["Low"] / df["Close"]) > 0.93 # Low is within 7% of close | |
| condition4 = ( | |
| (abs(df["Open"] - df["MA6"]) / df["MA6"] < 0.018) | | |
| (abs(df["Close"] - df["MA6"]) / df["MA6"] < 0.018) | |
| ) | |
| # Combine all conditions | |
| mask = condition1 & condition2 & condition3 & condition4 | |
| # Print matching dates and values | |
| matching_dates = df[mask] | |
| cleaned_df = matching_dates.dropna(how='all') | |
| # Define the cutoff date (10 days ago) | |
| cutoff_date = datetime.now() - timedelta(days=10) | |
| # Filter only rows from the last 10 calendar days | |
| recent_matches = cleaned_df[cleaned_df.index >= cutoff_date] | |
| #add ADR check | |
| #add ma6 in uptrend | |
| #above 10 days MA6 cleaned_df["Close"].iloc[-1] > cleaned_df["MA6"].iloc[-1]: | |
| if not cleaned_df.empty and not recent_matches.empty: | |
| print (F'**********************************{t}****************************') | |
| # print("Dates matching criteria (Open < Close, Close ≈ High, Low/Close > 93%):") | |
| print(recent_matches[["Open", "Close", "High", "Low","Volume","MA6"]]) | |
| # =========================== | |
| # Main Logic | |
| # =========================== | |
| # // Select all elements with the class | |
| # let elements = document.querySelectorAll('.tickerNameBox-GrtoTeat'); | |
| """ | |
| let elements = document.querySelectorAll('.tickerNameBox-GrtoTeat'); | |
| let titles = Array.from(elements).map(el => el.title); | |
| copy(titles.join("\n")); // copies directly to clipboard | |
| console.log("Copied to clipboard!"); | |
| """ | |
| clipboard_text = """ | |
| RLMD − Relmada Therapeutics, Inc. | |
| IMMX − Immix Biopharma, Inc. | |
| IMTX − Immatics N.V. | |
| RPID − Rapid Micro Biosystems, Inc. | |
| PEPG − PepGen Inc. | |
| NMRA − Neumora Therapeutics, Inc. | |
| GALT − Galectin Therapeutics Inc. | |
| OLMA − Olema Pharmaceuticals, Inc. | |
| MOD − Modine Manufacturing Company | |
| TNGX − Tango Therapeutics, Inc. | |
| PLPC − Preformed Line Products Company | |
| LMND − Lemonade, Inc. | |
| OMER − Omeros Corporation | |
| OPXS − Optex Systems Holdings, Inc. | |
| LUMN − Lumen Technologies, Inc. | |
| UFPT − UFP Technologies, Inc. | |
| ARDX − Ardelyx, Inc. | |
| COCO − The Vita Coco Company, Inc. | |
| OPEN − Opendoor Technologies Inc | |
| LASR − nLIGHT, Inc. | |
| VHC − VirnetX Holding Corp | |
| TERN − Terns Pharmaceuticals, Inc. | |
| ESPR − Esperion Therapeutics, Inc. | |
| SMHI − SEACOR Marine Holdings Inc. | |
| ENTA − Enanta Pharmaceuticals, Inc. | |
| LAES − SEALSQ Corp | |
| REKR − Rekor Systems, Inc. | |
| PGEN − Precigen, Inc. | |
| OESX − Orion Energy Systems, Inc. | |
| AIP − Arteris, Inc. | |
| ANIX − Anixa Biosciences, Inc. | |
| LQDA − Liquidia Corporation | |
| TYGO − Tigo Energy, Inc. | |
| """ | |
| #CHECK: KSS 07/11 NOT SHOWING, TTI 07/11 NOT SHOWING | |
| #MONITOR: TRVI, TTI, WDC, LXU, SWAG, OLMA | |
| tickers = [line.strip().split(' − ')[0] for line in clipboard_text.splitlines() if line.strip()] | |
| # tickers = ["TTI"] | |
| print ("Tickers to analyze:", tickers) | |
| ## TRIGGER BAR <3% | |
| for t in tickers: | |
| df = yf.download(t, period="30d", interval="1d", progress=False, auto_adjust=True) | |
| GetTriggerBar(df) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # =========================== | |
| # Main Logic | |
| # =========================== | |
| # // Select all elements with the class | |
| """ | |
| let elements = document.querySelectorAll('.tickerNameBox-GrtoTeat'); | |
| let titles = Array.from(elements).map(el => el.title); | |
| copy(titles.join("\n")); // copies directly to clipboard | |
| console.log("Copied to clipboard!"); | |
| """ | |
| clipboard_text = """ | |
| GRAL − GRAIL, Inc. | |
| SNDX − Syndax Pharmaceuticals, Inc. | |
| LMND − Lemonade, Inc. | |
| FSLY − Fastly, Inc. | |
| GANX − Gain Therapeutics, Inc. | |
| VTYX − Ventyx Biosciences, Inc. | |
| MTSI − MACOM Technology Solutions Holdings, Inc. | |
| SBH − Sally Beauty Holdings, Inc. (Name to be changed from Sally Holdings, Inc.) | |
| MKSI − MKS Inc. | |
| TRVI − Trevi Therapeutics, Inc. | |
| CELC − Celcuity Inc. | |
| TSEM − Tower Semiconductor Ltd. | |
| DYN − Dyne Therapeutics, Inc. | |
| KALV − KalVista Pharmaceuticals, Inc. | |
| MLYS − Mineralys Therapeutics, Inc. | |
| AMLX − Amylyx Pharmaceuticals, Inc. | |
| YOU − Clear Secure, Inc. | |
| FIGS − FIGS, Inc. | |
| """ | |
| #tickers = [line.strip().split(' − ')[0] for line in clipboard_text.splitlines() if line.strip()] | |
| tickers = ["TTI"] | |
| print ("Tickers to analyze:", tickers) | |
| ## TRIGGER BAR <3% | |
| for t in tickers: | |
| # num_days = 10 | |
| # start = plt.string_to_datetime('01/01/1900') | |
| # end = plt.today_datetime() | |
| # day_count = (end - start).days | |
| # print ('count', day_count) | |
| # df = yf.download(t, start, end, progress=False, auto_adjust=True) | |
| df = yf.download(t, period="10d", interval="1d", progress=False, auto_adjust=True) | |
| clean_df = GetTriggerBar(df) | |
| #print (df) | |
| opens = df['Open'][t].tolist() | |
| #print (opens) | |
| closes = df['Close'][t].tolist() | |
| #print (closes) | |
| highs = df['High'][t].tolist() | |
| #print (highs) | |
| lows = df['Low'][t].tolist() | |
| #print (lows) | |
| dates_str = plt.datetimes_to_string(df.index) | |
| #MA6 | |
| y_ma6 = clean_df["MA6"].tolist() | |
| # print('clean def@!!!!!\n', clean_df_mas) | |
| #print (dates_str) | |
| data = {'Open':opens, 'Close':closes, 'High':highs, 'Low':lows} | |
| plt.clear_figure() # clear previous plots | |
| # # # --- Candlestick plot --- | |
| clr = 236 | |
| plt.canvas_color(clr) | |
| plt.axes_color(clr) | |
| plt.ticks_color('gray') | |
| # plt.ticks_style('italic') | |
| plt.plotsize(200, 30) | |
| plt.candlestick(dates_str, data) | |
| plt.title(f'{t}') | |
| plt.date_form(input_form='d/m/Y') | |
| #plt.date_form(output_form='d') | |
| #plt.xfrequency(day_count) | |
| tday = '24/11/2025' | |
| df.loc[start_date:] | |
| # plt.vline(tday, "red") | |
| min_lows = min(df['Low'][t].tolist()) | |
| #plt.text(tday.split('/')[0], x = '24/11/2025', y = df.loc[tday]['Low'].item()-0.2) | |
| for i in range(len(dates_str)): | |
| #plt.text(dates_str[i].split('/')[0], x = dates_str[i], y = lows[i]-0.2) | |
| plt.text(dates_str[i][:2], x = dates_str[i], y = lows[i]-0.2) | |
| plt.xlabel("Date") | |
| plt.xticks([]) | |
| # xticks = range(len(dates_str)) | |
| # xlabels = dates_str | |
| # plt.xticks(xticks, xlabels) | |
| plt.grid(True,True) | |
| plt.ylabel("Stock Price $") | |
| #print(dates_str) | |
| #print(y_ma6) | |
| default = min(y_ma6) | |
| cleaned = [default if (math.isnan(x)) else x for x in y_ma6] | |
| for i in range(len(dates_str)): | |
| #plt.text(dates_str[i].split('/')[0], x = dates_str[i], y = lows[i]-0.2) | |
| plt.text('-', x = dates_str[i], y = cleaned[i]) | |
| # print(math.isnan(cleaned[0])) | |
| # #plt.scatter(y_ma6) | |
| # plt.plot(dates_str, cleaned, label = "plot", style="dot") | |
| # #plt.plot(dates_str, y_ma6) | |
| plt.show() | |
| plt.terminal_size() | |
| # box_data = [] | |
| # for i in range(len(opens)): | |
| # box_data.append([highs[i], closes[i], opens[i], lows[i]]) | |
| # print (box_data) | |
| # # # Convert dates to strings for x-axis | |
| # print(dates_str) | |
| # plt.box(dates_str, box_data,width = 0.3) | |
| # plt.title("Dummy Google Stock Price Box Plot") | |
| # plt.xlabel("Date") | |
| # plt.ylabel("Stock Price $") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment