Posts

Showing posts from September, 2023

Anil kohli finvasia py file

 from NorenRestApiPy.NorenApi import  NorenApi import pandas as pd import logging import pyotp from datetime import datetime, timedelta import pandas_ta as ta # Get the current date and time current_date_time = datetime.today() current_date_time = current_date_time - timedelta(days=2) current_date_time = current_date_time .replace(hour=0,minute=0,second=0,microsecond=0) # Convert both dates to Unix timestamp format current_date_time = current_date_time.timestamp() api=None def delete_file_contents(file_name):     try:         # Open the file in write mode, which truncates it (deletes contents)         with open(file_name, 'w') as file:             file.truncate(0)         print(f"Contents of {file_name} have been deleted.")     except FileNotFoundError:         print(f"File {file_name} not found.")     except Exception as e:     ...

Anil kohli final files main strategy

 enable_trading = "True" import json import math from sched import scheduler import schedule import finvasia from kite_trade import * from datetime import datetime, timedelta import threading import time as sleep_time import pandas as pd import pandas_ta as ta from apscheduler.schedulers.background import BackgroundScheduler import time from finvasia import * runner = True a = False b = False finvasia.autologin() signals_list = [] # logs not getting generated signal_dict = {} end_time_str = None start_time_str = None lock = threading.Lock() def read_csv_to_dictionary(file_path):     data_dict = {}     global signal_dict, end_time_str, start_time_str     df = pd.read_csv(file_path)     for index, row in df.iterrows():         strategy_tag = row['strategyTag']         data_dict[strategy_tag] = row.to_dict()         signal_dict[strategy_tag] = {'Buy': False, 'Sell': False, 'IntialTrade'...

Algofox option buying strategy

import Algofox from kite_trade import * import pyotp import pandas as pd import json import time from datetime import datetime import time as sleep_time from Algofox import * def write_to_order_logs ( message ): with open ( 'OrderLog.txt' , 'a' ) as file: # Open the file in append mode file .write( message + ' \n ' ) def delete_file_contents ( file_name ): try : # Open the file in write mode, which truncates it (deletes contents) with open ( file_name , 'w' ) as file: file .truncate( 0 ) print ( f"Contents of { file_name } have been deleted." ) except FileNotFoundError : print ( f"File { file_name } not found." ) except Exception as e: print ( f"An error occurred: { str ( e ) } " ) def get_zerodha_credentials (): delete_file_contents( "OrderLog.txt" ) credentials = {} try : df = pd.read_csv( 'ZerodhaCredentials.cs...