From fa64cf3dd19019b3e077dfc53c9617f13e91201f Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 28 Jul 2024 23:12:21 +0200 Subject: [PATCH] switch from gpt-3.5-turbo-0125 to gpt-4o-mini --- app/cron_analyst_insight.py | 2 +- app/test.py | 78 ------------------------------------- 2 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 app/test.py diff --git a/app/cron_analyst_insight.py b/app/cron_analyst_insight.py index 38c0fa9..9af2c45 100644 --- a/app/cron_analyst_insight.py +++ b/app/cron_analyst_insight.py @@ -61,7 +61,7 @@ def get_summary(data): ) response = client.chat.completions.create( - model="gpt-3.5-turbo-0125", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "Summarize analyst insights clearly and concisely in under 400 characters. Ensure the summary is professional and easy to understand. Conclude with whether the report is bullish or bearish."}, {"role": "user", "content": data_string} diff --git a/app/test.py b/app/test.py deleted file mode 100644 index 3d3cb87..0000000 --- a/app/test.py +++ /dev/null @@ -1,78 +0,0 @@ -import time -from datetime import datetime -from GetStartEndDate import GetStartEndDate -from tqdm import tqdm -import concurrent.futures - -import intrinio_sdk as intrinio -import ujson -import sqlite3 -import pytz - -from dotenv import load_dotenv -import os -from threading import Lock - -ny_tz = pytz.timezone('America/New_York') - -load_dotenv() -api_key = os.getenv('INTRINIO_API_KEY') - -intrinio.ApiClient().set_api_key(api_key) -intrinio.ApiClient().allow_retries(True) - -def save_json(data): - with open(f"json/dark-pool/flow/data.json", 'w') as file: - ujson.dump(data, file) - -source = 'cta_a_delayed' -start_date = '' -end_date = '' -start_time = '' -end_time = '' -timezone = 'UTC' -page_size = 100 -darkpool_only = True -min_size = 100 -next_page = '' - -api_call_counter = 0 -lock = Lock() - -def get_data(symbol): - global api_call_counter - try: - response = intrinio.SecurityApi().get_security_trades_by_symbol( - identifier=symbol, source=source, start_date=start_date, start_time=start_time, - end_date=end_date, end_time=end_time, timezone=timezone, page_size=page_size, - darkpool_only=darkpool_only, min_size=min_size, next_page=next_page - ) - data = response.trades - - with lock: - api_call_counter += 1 - if api_call_counter % 1600 == 0: - #print("API call limit reached, sleeping for 60 seconds...") - time.sleep(60) - - except: - pass - -def run(): - con = sqlite3.connect('stocks.db') - cursor = con.cursor() - cursor.execute("SELECT DISTINCT symbol, name FROM stocks") - stocks = cursor.fetchall() - con.close() - - symbol_name_map = {row[0]: row[1] for row in stocks} - stock_symbols = list(symbol_name_map.keys()) - - with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: - list(tqdm(executor.map(get_data, stock_symbols), total=len(stock_symbols))) - -if __name__ == "__main__": - try: - run() - except Exception as e: - print(f"An error occurred: {e}")