Very Good Evening Sir, I would like to share my notes out of your Video series with all learners who are interested.
I need your verification of my ‘NOTES’ and permission for the same to share on this platform sir.
Herewith I am sending the abstract notes I have prepared from SESSION-10 and SESSION-11 sir. Please correct for any errors sir.
VBR Prasad
SESSION-10 - “RP-Tick by Tick data storage” Part-1
—Dt.03-04-2025—SESSION 10----
If you are a Scalper, you need Tick by Tick Data
Copy Files ‘Option_Selling_Algo’ and ‘Live_Trade_Data’ files from Session 8
Rename the file ‘Option_Selling_Algo’ as ‘Tick By Tick Data Storage’
import pdb
import time
import datetime
import traceback
from Dhan_Tradehull import Tradehull
import pandas as pd
from pprint import pprint
import talib
import pandas_ta as ta
import xlwings as xw
import winsound
client_code = “11111111”
token_id = “eeeeeeee”
tsl = Tradehull(client_code,token_id)
watchlist = [‘NIFTY’]
wb = xw.Book(‘Live Trade Data.xlsx’)
data_storage = wb.sheets[‘Data Storage’]
bot_token = “8059847390:AAECSnQK-yOaGJ-clJchb1cx8CDhx2VQq-M”
receiver_chat_id = “1918451082”
bot_token = “7570885801:AAGQoHl00ydQPCgldwXhu4Qn3A9HpnHG630”
receiver_chat_id = “6092170243”
Delete rest of all code lines of ‘Option_Selling_Algo’ file.
ce_strike, pe_strike, strike = tsl.ATM_Strike_Selection(Underlying=‘NIFTY’, Expiry=0)
all_strike = [strike + number*50 for number in range(-20, 20)] # 2. finds all 40 strikes
all_ce_names = [“NIFTY 17 APR " + str(strike) + " CALL” for strike in all_strike]
all_pe_names = [“NIFTY 17 APR " + str(strike) + " PUT” for strike in all_strike]
equity_names = [“ACC”, “CIPLA”, “GAIL”, “NIFTY”]
all_names = all_ce_names + all_pe_names + equity_names
data_storage.range(‘B1’).value = all_names
all_ltp = tsl.get_ltp_data(names=all_names)
while True: # Now let’s replace the ‘while True’ to ‘for’ loop
for row_no in range(2, 1000000):
try:
current_time = datetime.datetime.now()
print(current_time)
if current_time.second % 5 == 0: # 5 stands for value in seconds and Here % stands for 'REMAINDER' of the unit 'second'
tsl.send_telegram_alert(message=f"{current_time} data storage is working fine ",receiver_chat_id=receiver_chat_id,bot_token=bot_token)
all_ltp = tsl.get_ltp_data(names=all_names) # Rest of the lines need not be cycled.
temp_dict = {}
temp_dict[current_time] = all_ltp
temp_dict = pd.DataFrame(temp_dict) # I am getting error as 'temp_dict' is not defined.
ltp_sequence = temp_dict.T[all_names].iloc[0].to_list()
data_storage.range('B' + str(row_no)).value = ltp_sequence
data_storage.range('A' + str(row_no)).value = str(current_time)
except Exception as e:
print(e)
tsl.send_telegram_alert(message="error in storing data",receiver_chat_id=receiver_chat_id,bot_token=bot_token)
continue
# temp_dict[all_names]
# (pdb++) temp_dict
# ['NIFTY 09 APR 21900 CALL', 'NIFTY 09 APR 21950 CALL', 'NIFTY 09 APR 22000 CALL', 'NIFTY 09 APR 22050 CALL', 'NIFTY 09 APR 22100 CALL', 'NIFTY 09 APR 22150 CALL', 'NIFTY 09 APR 22200 CALL', 'NIFTY 09 APR 22250 CALL', 'NIFTY 09 APR 22300 CALL', 'NIFTY 09 APR 22350 CALL', 'NIFTY 09 APR 22400 CALL', 'NIFTY 09 APR 22450 CALL', 'NIFTY 09 APR 22500 CALL', 'NIFTY 09 APR 22550 CALL', 'NIFTY 09 APR 22600 CALL', 'NIFTY 09 APR 22650 CALL', 'NIFTY 09 APR 22700 CALL', 'NIFTY 09 APR 22750 CALL', 'NIFTY 09 APR 22800 CALL', 'NIFTY 09 APR 22850 CALL', 'NIFTY 09 APR 22900 CALL', 'NIFTY 09 APR 22950 CALL', 'NIFTY 09 APR 23000 CALL', 'NIFTY 09 APR 23050 CALL', 'NIFTY 09 APR 23100 CALL', 'NIFTY 09 APR 23150 CALL', 'NIFTY 09 APR 23200 CALL', 'NIFTY 09 APR 23250 CALL', 'NIFTY 09 APR 23300 CALL', 'NIFTY 09 APR 23350 CALL', 'NIFTY 09 APR 23400 CALL', 'NIFTY 09 APR 23450 CALL', 'NIFTY 09 APR 23500 CALL', 'NIFTY 09 APR 23550 CALL', 'NIFTY 09 APR 23600 CALL', 'NIFTY 09 APR 23650 CALL', 'NIFTY 09 APR 23700 CALL', 'NIFTY 09 APR 23750 CALL', 'NIFTY 09 APR 23800 CALL', 'NIFTY 09 APR 23850 CALL', 'NIFTY 09 APR 21900 PUT', 'NIFTY 09 APR 21950 PUT', 'NIFTY 09 APR 22000 PUT', 'NIFTY 09 APR 22050 PUT', 'NIFTY 09 APR 22100 PUT', 'NIFTY 09 APR 22150 PUT', 'NIFTY 09 APR 22200 PUT', 'NIFTY 09 APR 22250 PUT', 'NIFTY 09 APR 22300 PUT', 'NIFTY 09 APR 22350 PUT', 'NIFTY 09 APR 22400 PUT', 'NIFTY 09 APR 22450 PUT', 'NIFTY 09 APR 22500 PUT', 'NIFTY 09 APR 22550 PUT', 'NIFTY 09 APR 22600 PUT', 'NIFTY 09 APR 22650 PUT', 'NIFTY 09 APR 22700 PUT', 'NIFTY 09 APR 22750 PUT', 'NIFTY 09 APR 22800 PUT', 'NIFTY 09 APR 22850 PUT', 'NIFTY 09 APR 22900 PUT', 'NIFTY 09 APR 22950 PUT', 'NIFTY 09 APR 23000 PUT', 'NIFTY 09 APR 23050 PUT', 'NIFTY 09 APR 23100 PUT', 'NIFTY 09 APR 23150 PUT', 'NIFTY 09 APR 23200 PUT', 'NIFTY 09 APR 23250 PUT', 'NIFTY 09 APR 23300 PUT', 'NIFTY 09 APR 23350 PUT', 'NIFTY 09 APR 23400 PUT', 'NIFTY 09 APR 23450 PUT', 'NIFTY 09 APR 23500 PUT', 'NIFTY 09 APR 23550 PUT', 'NIFTY 09 APR 23600 PUT', 'NIFTY 09 APR 23650 PUT', 'NIFTY 09 APR 23700 PUT', 'NIFTY 09 APR 23750 PUT', 'NIFTY 09 APR 23800 PUT', 'NIFTY 09 APR 23850 PUT', 'ACC', 'CIPLA', 'GAIL', 'NIFTY']
# (pdb++) temp_dict.T
# pdb.set_trace()
If I want to store Tick by Tick Data for 40 strikes, Also Tick by Tick data for ACC, CIPLAand GAIL
1. Find ATM =
2. find_40_strikes =
3. get_call_and_put_names =
4. all_ltp_data =
5. store_ltp =
CE_symbol_name, PE_symbol_name, strike = tsl.ATM_Strike_Selection(Underlying=‘NIFTY’, Expiry=0)
(pdb++) CE_symbol_name, PE_symbol_name, strike_price = tsl.ATM_Strike_Selection(Underlying=‘NIFTY’, Expiry=0)
(pdb++) strike # 1. Finds the ATM
[x for x in range(-20, 20)]
(pdb++) [x for x in range(-20, 20)]
In Python: The Following Code line is called ‘LIST COMPREHENSION’, which offers a shorter syntax when you want to create a new list based on the values of an existing list. Example: Based on a list of fruits, you
[strike + x*50 for x in range(-20, 20)] # strike stands for strike, 50 stands for Nigty Lot size, ‘x’ stands for first number: -20
(pdb++) [strike + x*50 for x in range(-20, 20)]
(pdb++) strike + -20*50 # Gives the value at -20.
Now I want to rename the above line as below:
all_strike = [strike + number*50 for number in range(-20, 20)] # 2. finds all 40 strikes
all_ce_names = [strike for strike in all_strike]
(pdb++) all_ce_names = [strike for strike in all_strike]
(pdb++) all_ce_names
[21900, 21950, 22000, 22050, 22100, 22150, 22200, 22250, 22300, 22350, 22400, 22450, 22500, 22550, 22600, 22650, 22700, 22750, 22800, 22850, 22900, 22950, 23000, 23050, 23100, 23150, 23200, 23250, 23300, 23350, 23400, 23450, 23500, 23550, 23600, 23650, 23700, 23750, 23800, 23850]
all_ce_names = [str(strike) for strike in all_strike] # Now the above line is converted to get the sring values.
(pdb++) all_ce_names = [str(strike) for strike in all_strike]
(pdb++) all_ce_names
[‘21900’, ‘21950’, ‘22000’, ‘22050’, ‘22100’, ‘22150’, ‘22200’, ‘22250’, ‘22300’, ‘22350’, ‘22400’, ‘22450’, ‘22500’, ‘22550’, ‘22600’, ‘22650’, ‘22700’, ‘22750’, ‘22800’, ‘22850’, ‘22900’, ‘22950’, ‘23000’, ‘23050’, ‘23100’, ‘23150’, ‘23200’, ‘23250’, ‘23300’, ‘23350’, ‘23400’, ‘23450’, ‘23500’, ‘23550’, ‘23600’, ‘23650’, ‘23700’, ‘23750’, ‘23800’, ‘23850’]
all_ce_names = ["NIFTY 09 APR " + str(strike) for strike in all_strike] # Now I have added another string “NIFTY 10 APR” to the above line of code.
(pdb++) all_ce_names = [“NIFTY 09 APR” + str(strike) for strike in all_strike]
(pdb++) all_ce_names
[‘NIFTY 09 APR 21900’, ‘NIFTY 09 APR 21950’, ‘NIFTY 09 APR 22000’, ‘NIFTY 09 APR 22050’, ‘NIFTY 09 APR 22100’, ‘NIFTY 09 APR 22150’, ‘NIFTY 09 APR 22200’, ‘NIFTY 09 APR 22250’, ‘NIFTY 09 APR 22300’, ‘NIFTY 09 APR 22350’, ‘NIFTY 09 APR 22400’, ‘NIFTY 09 APR 22450’, ‘NIFTY 09 APR 22500’, ‘NIFTY 09 APR 22550’, ‘NIFTY 09 APR 22600’, ‘NIFTY 09 APR 22650’, ‘NIFTY 09 APR 22700’, ‘NIFTY 09 APR 22750’, ‘NIFTY 09 APR 22800’, ‘NIFTY 09 APR 22850’, ‘NIFTY 09 APR 22900’, ‘NIFTY 09 APR 22950’, ‘NIFTY 09 APR 23000’, ‘NIFTY 09 APR 23050’, ‘NIFTY 09 APR 23100’, ‘NIFTY 09 APR 23150’, ‘NIFTY 09 APR 23200’, ‘NIFTY 09 APR 23250’, ‘NIFTY 09 APR 23300’, ‘NIFTY 09 APR 23350’, ‘NIFTY 09 APR 23400’, ‘NIFTY 09 APR 23450’, ‘NIFTY 09 APR 23500’, ‘NIFTY 09 APR 23550’, ‘NIFTY 09 APR 23600’, ‘NIFTY 09 APR 23650’, ‘NIFTY 09 APR 23700’, ‘NIFTY 09 APR 23750’, ‘NIFTY 09 APR 23800’, ‘NIFTY 09 APR 23850’]
all_ce_names = [“NIFTY 09 APR " + str(strike) + " CALL” for strike in all_strike] # Now I have added another string “CALL” to the above line of code.
(pdb++) all_ce_names = [“NIFTY 10 APR” + str(strike) for strike in all_strike]
(pdb++) all_ce_names
[‘NIFTY 09 APR 21900 CALL’, ‘NIFTY 09 APR 21950 CALL’, ‘NIFTY 09 APR 22000 CALL’, ‘NIFTY 09 APR 22050 CALL’, ‘NIFTY 09 APR 22100 CALL’, ‘NIFTY 09 APR 22150 CALL’, ‘NIFTY 09 APR 22200 CALL’, ‘NIFTY 09 APR 22250 CALL’, ‘NIFTY 09 APR 22300 CALL’, ‘NIFTY 09 APR 22350 CALL’, ‘NIFTY 09 APR 22400 CALL’, ‘NIFTY 09 APR 22450 CALL’, ‘NIFTY 09 APR 22500 CALL’, ‘NIFTY 09 APR 22550 CALL’, ‘NIFTY 09 APR 22600 CALL’, ‘NIFTY 09 APR 22650 CALL’, ‘NIFTY 09 APR 22700 CALL’, ‘NIFTY 09 APR 22750 CALL’, ‘NIFTY 09 APR 22800 CALL’, ‘NIFTY 09 APR 22850 CALL’, ‘NIFTY 09 APR 22900 CALL’, ‘NIFTY 09 APR 22950 CALL’, ‘NIFTY 09 APR 23000 CALL’, ‘NIFTY 09 APR 23050 CALL’, ‘NIFTY 09 APR 23100 CALL’, ‘NIFTY 09 APR 23150 CALL’, ‘NIFTY 09 APR 23200 CALL’, ‘NIFTY 09 APR 23250 CALL’, ‘NIFTY 09 APR 23300 CALL’, ‘NIFTY 09 APR 23350 CALL’, ‘NIFTY 09 APR 23400 CALL’, ‘NIFTY 09 APR 23450 CALL’, ‘NIFTY 09 APR 23500 CALL’, ‘NIFTY 09 APR 23550 CALL’, ‘NIFTY 09 APR 23600 CALL’, ‘NIFTY 09 APR 23650 CALL’, ‘NIFTY 09 APR 23700 CALL’, ‘NIFTY 09 APR 23750 CALL’, ‘NIFTY 09 APR 23800 CALL’, ‘NIFTY 09 APR 23850 CALL’]
NOW LET’S GET THE LTP OF ALL CE NAMES
ltp = tsl.get_ltp_data(names=all_ce_names)
(pdb++) ltp = tsl.get_ltp_data(names=all_ce_names)
(pdb++) ltp
{‘NIFTY 09 APR 21900 CALL’: 986.1, ‘NIFTY 09 APR 21950 CALL’: 928.5, ‘NIFTY 09 APR 22000 CALL’: 898, ‘NIFTY 09 APR 22050 CALL’: 838.05, ‘NIFTY 09 APR 22100 CALL’: 795, ‘NIFTY 09 APR 22150 CALL’: 717.6, ‘NIFTY 09 APR 22200 CALL’: 705.7, ‘NIFTY 09 APR 22250 CALL’: 651.45, ‘NIFTY 09 APR 22300 CALL’: 607.1, ‘NIFTY 09 APR 22350 CALL’: 555, ‘NIFTY 09 APR 22400 CALL’: 508, ‘NIFTY 09 APR 22450 CALL’: 463.5, ‘NIFTY 09 APR 22500 CALL’: 407.45, ‘NIFTY 09 APR 22550 CALL’: 371.55, ‘NIFTY 09 APR 22600 CALL’: 328.45, ‘NIFTY 09 APR 22650 CALL’: 286.25, ‘NIFTY 09 APR 22700 CALL’: 247, ‘NIFTY 09 APR 22750 CALL’: 211.4, ‘NIFTY 09 APR 22800 CALL’: 175, ‘NIFTY 09 APR 22850 CALL’: 144, ‘NIFTY 09 APR 22900 CALL’: 115.7, ‘NIFTY 09 APR 22950 CALL’: 92.45, ‘NIFTY 09 APR 23000 CALL’: 71.55, ‘NIFTY 09 APR 23050 CALL’: 55.85, ‘NIFTY 09 APR 23100 CALL’: 43.15, ‘NIFTY 09 APR 23150 CALL’: 32.95, ‘NIFTY 09 APR 23200 CALL’: 25.05, ‘NIFTY 09 APR 23250 CALL’: 19.1, ‘NIFTY 09 APR 23300 CALL’: 15.15, ‘NIFTY 09 APR 23350 CALL’: 11.7, ‘NIFTY 09 APR 23400 CALL’: 9.15, ‘NIFTY 09 APR 23450 CALL’: 7.55, ‘NIFTY 09 APR 23500 CALL’: 6.3, ‘NIFTY 09 APR 23550 CALL’: 5.05, ‘NIFTY 09 APR 23600 CALL’: 4.15, ‘NIFTY 09 APR 23650 CALL’: 3.6, ‘NIFTY 09 APR 23700 CALL’: 3, ‘NIFTY 09 APR 23750 CALL’: 2.75, ‘NIFTY 09 APR 23800 CALL’: 2.4, ‘NIFTY 09 APR 23850 CALL’: 2.1}
NOW SIMILARLY LET’S GET THE LTP OF ALL PE NAMES
all_pe_names = [“NIFTY 09 APR " + str(strike) + " PUT” for strike in all_strike]
(pdb++) ltp = tsl.get_ltp_data(names=all_pe_names)
(pdb++) ltp
[‘NIFTY 09 APR 21900 PUT’, ‘NIFTY 09 APR 21950 PUT’, ‘NIFTY 09 APR 22000 PUT’, ‘NIFTY 09 APR 22050 PUT’, ‘NIFTY 09 APR 22100 PUT’, ‘NIFTY 09 APR 22150 PUT’, ‘NIFTY 09 APR 22200 PUT’, ‘NIFTY 09 APR 22250 PUT’, ‘NIFTY 09 APR 22300 PUT’, ‘NIFTY 09 APR 22350 PUT’, ‘NIFTY 09 APR 22400 PUT’, ‘NIFTY 09 APR 22450 PUT’, ‘NIFTY 09 APR 22500 PUT’, ‘NIFTY 09 APR 22550 PUT’, ‘NIFTY 09 APR 22600 PUT’, ‘NIFTY 09 APR 22650 PUT’, ‘NIFTY 09 APR 22700 PUT’, ‘NIFTY 09 APR 22750 PUT’, ‘NIFTY 09 APR 22800 PUT’, ‘NIFTY 09 APR 22850 PUT’, ‘NIFTY 09 APR 22900 PUT’, ‘NIFTY 09 APR 22950 PUT’, ‘NIFTY 09 APR 23000 PUT’, ‘NIFTY 09 APR 23050 PUT’, ‘NIFTY 09 APR 23100 PUT’, ‘NIFTY 09 APR 23150 PUT’, ‘NIFTY 09 APR 23200 PUT’, ‘NIFTY 09 APR 23250 PUT’, ‘NIFTY 09 APR 23300 PUT’, ‘NIFTY 09 APR 23350 PUT’, ‘NIFTY 09 APR 23400 PUT’, ‘NIFTY 09 APR 23450 PUT’, ‘NIFTY 09 APR 23500 PUT’, ‘NIFTY 09 APR 23550 PUT’, ‘NIFTY 09 APR 23600 PUT’, ‘NIFTY 09 APR 23650 PUT’, ‘NIFTY 09 APR 23700 PUT’, ‘NIFTY 09 APR 23750 PUT’, ‘NIFTY 09 APR 23800 PUT’, ‘NIFTY 09 APR 23850 PUT’]
NOW LET’S GET THE LTP OF ALL PE NAMES
ltp = tsl.get_ltp_data(names=all_pe_names)
(pdb++) ltp = tsl.get_ltp_data(names=all_pe_names)
(pdb++) ltp
{‘NIFTY 09 APR 21900 PUT’: 3.4, ‘NIFTY 09 APR 21950 PUT’: 3.7, ‘NIFTY 09 APR 22000 PUT’: 4.05, ‘NIFTY 09 APR 22050 PUT’: 4.55, ‘NIFTY 09 APR 22100 PUT’: 5.1, ‘NIFTY 09 APR 22150 PUT’: 5.95, ‘NIFTY 09 APR 22200 PUT’: 6.7, ‘NIFTY 09 APR 22250 PUT’: 7.55, ‘NIFTY 09 APR 22300 PUT’: 9.4, ‘NIFTY 09 APR 22350 PUT’: 11, ‘NIFTY 09 APR 22400 PUT’: 13.2, ‘NIFTY 09 APR 22450 PUT’: 16.7, ‘NIFTY 09 APR 22500 PUT’: 20.65, ‘NIFTY 09 APR 22550 PUT’: 25.9, ‘NIFTY 09 APR 22600 PUT’: 32.6, ‘NIFTY 09 APR 22650 PUT’: 40.6, ‘NIFTY 09 APR 22700 PUT’: 51.1, ‘NIFTY 09 APR 22750 PUT’: 64.75, ‘NIFTY 09 APR 22800 PUT’: 80, ‘NIFTY 09 APR 22850 PUT’: 99.2, ‘NIFTY 09 APR 22900 PUT’: 121.85, ‘NIFTY 09 APR 22950 PUT’: 147.15, ‘NIFTY 09 APR 23000 PUT’: 177.15, ‘NIFTY 09 APR 23050 PUT’: 211.25, ‘NIFTY 09 APR 23100 PUT’: 245.25, ‘NIFTY 09 APR 23150 PUT’: 285.85, ‘NIFTY 09 APR 23200 PUT’: 329, ‘NIFTY 09 APR 23250 PUT’: 372.65, ‘NIFTY 09 APR 23300 PUT’: 416.95, ‘NIFTY 09 APR 23350 PUT’: 467.35, ‘NIFTY 09 APR 23400 PUT’: 513, ‘NIFTY 09 APR 23450 PUT’: 560.75, ‘NIFTY 09 APR 23500 PUT’: 610.2, ‘NIFTY 09 APR 23550 PUT’: 656.2, ‘NIFTY 09 APR 23600 PUT’: 704.7, ‘NIFTY 09 APR 23650 PUT’: 757, ‘NIFTY 09 APR 23700 PUT’: 806.5, ‘NIFTY 09 APR 23750 PUT’: 858.15, ‘NIFTY 09 APR 23800 PUT’: 902.5, ‘NIFTY 09 APR 23850 PUT’: 962.1}
NOW LET’S COMBINE(MERGE) BOTH CE AND PE NAMES AS WELL AS EQUITY NAMES
all_ce_names = [“NIFTY 09 APR " + str(strike) + " CALL” for strike in all_strike]
all_pe_names = [“NIFTY 09 APR " + str(strike) + " PUT” for strike in all_strike]
equity_names = [“ACC”, “CIPLA”, “GAIL”, “NIFTY”]
all_names = all_ce_names + all_pe_names + equity_names
(pdb++) all_names = all_ce_names + all_pe_names + equity_names
(pdb++) all_names
[‘NIFTY 09 APR 21900 CALL’, ‘NIFTY 09 APR 21950 CALL’, ‘NIFTY 09 APR 22000 CALL’, ‘NIFTY 09 APR 22050 CALL’, ‘NIFTY 09 APR 22100 CALL’, ‘NIFTY 09 APR 22150 CALL’, ‘NIFTY 09 APR 22200 CALL’, ‘NIFTY 09 APR 22250 CALL’, ‘NIFTY 09 APR 22300 CALL’, ‘NIFTY 09 APR 22350 CALL’, ‘NIFTY 09 APR 22400 CALL’, ‘NIFTY 09 APR 22450 CALL’, ‘NIFTY 09 APR 22500 CALL’, ‘NIFTY 09 APR 22550 CALL’, ‘NIFTY 09 APR 22600 CALL’, ‘NIFTY 09 APR 22650 CALL’, ‘NIFTY 09 APR 22700 CALL’, ‘NIFTY 09 APR 22750 CALL’, ‘NIFTY 09 APR 22800 CALL’, ‘NIFTY 09 APR 22850 CALL’, ‘NIFTY 09 APR 22900 CALL’, ‘NIFTY 09 APR 22950 CALL’, ‘NIFTY 09 APR 23000 CALL’, ‘NIFTY 09 APR 23050 CALL’, ‘NIFTY 09 APR 23100 CALL’, ‘NIFTY 09 APR 23150 CALL’, ‘NIFTY 09 APR 23200 CALL’, ‘NIFTY 09 APR 23250 CALL’, ‘NIFTY 09 APR 23300 CALL’, ‘NIFTY 09 APR 23350 CALL’, ‘NIFTY 09 APR 23400 CALL’, ‘NIFTY 09 APR 23450 CALL’, ‘NIFTY 09 APR 23500 CALL’, ‘NIFTY 09 APR 23550 CALL’, ‘NIFTY 09 APR 23600 CALL’, ‘NIFTY 09 APR 23650 CALL’, ‘NIFTY 09 APR 23700 CALL’, ‘NIFTY 09 APR 23750 CALL’, ‘NIFTY 09 APR 23800 CALL’, ‘NIFTY 09 APR 23850 CALL’, ‘NIFTY 09 APR 21900 PUT’, ‘NIFTY 09 APR 21950 PUT’, ‘NIFTY 09 APR 22000 PUT’, ‘NIFTY 09 APR 22050 PUT’, ‘NIFTY 09 APR 22100 PUT’, ‘NIFTY 09 APR 22150 PUT’, ‘NIFTY 09 APR 22200 PUT’, ‘NIFTY 09 APR 22250 PUT’, ‘NIFTY 09 APR 22300 PUT’, ‘NIFTY 09 APR 22350 PUT’, ‘NIFTY 09 APR 22400 PUT’, ‘NIFTY 09 APR 22450 PUT’, ‘NIFTY 09 APR 22500 PUT’, ‘NIFTY 09 APR 22550 PUT’, ‘NIFTY 09 APR 22600 PUT’, ‘NIFTY 09 APR 22650 PUT’, ‘NIFTY 09 APR 22700 PUT’, ‘NIFTY 09 APR 22750 PUT’, ‘NIFTY 09 APR 22800 PUT’, ‘NIFTY 09 APR 22850 PUT’, ‘NIFTY 09 APR 22900 PUT’, ‘NIFTY 09 APR 22950 PUT’, ‘NIFTY 09 APR 23000 PUT’, ‘NIFTY 09 APR 23050 PUT’, ‘NIFTY 09 APR 23100 PUT’, ‘NIFTY 09 APR 23150 PUT’, ‘NIFTY 09 APR 23200 PUT’, ‘NIFTY 09 APR 23250 PUT’, ‘NIFTY 09 APR 23300 PUT’, ‘NIFTY 09 APR 23350 PUT’, ‘NIFTY 09 APR 23400 PUT’, ‘NIFTY 09 APR 23450 PUT’, ‘NIFTY 09 APR 23500 PUT’, ‘NIFTY 09 APR 23550 PUT’, ‘NIFTY 09 APR 23600 PUT’, ‘NIFTY 09 APR 23650 PUT’, ‘NIFTY 09 APR 23700 PUT’, ‘NIFTY 09 APR 23750 PUT’, ‘NIFTY 09 APR 23800 PUT’, ‘NIFTY 09 APR 23850 PUT’, ‘ACC’, ‘CIPLA’, ‘GAIL’]
NOW LET’S GET THE LTP OF ALL NAMES
all_ltp = tsl.get_ltp_data(names=all_names)
(pdb++) all_ltp = tsl.get_ltp_data(names=all_names)
(pdb++) all_ltp
{‘ACC’: 1966.3, ‘GAIL’: 176.61, ‘CIPLA’: 1415.25, ‘NIFTY 09 APR 21900 CALL’: 986.1, ‘NIFTY 09 APR 21900 PUT’: 3.4, ‘NIFTY 09 APR 21950 CALL’: 928.5, ‘NIFTY 09 APR 21950 PUT’: 3.7, ‘NIFTY 09 APR 22000 CALL’: 898, ‘NIFTY 09 APR 22000 PUT’: 4.05, ‘NIFTY 09 APR 22050 CALL’: 838.05, ‘NIFTY 09 APR 22050 PUT’: 4.55, ‘NIFTY 09 APR 22100 CALL’: 795, ‘NIFTY 09 APR 22100 PUT’: 5.1, ‘NIFTY 09 APR 22150 CALL’: 717.6, ‘NIFTY 09 APR 22150 PUT’: 5.95, ‘NIFTY 09 APR 22200 CALL’: 705.7, ‘NIFTY 09 APR 22200 PUT’: 6.7, ‘NIFTY 09 APR 22250 CALL’: 651.45, ‘NIFTY 09 APR 22250 PUT’: 7.55, ‘NIFTY 09 APR 22300 CALL’: 607.1, ‘NIFTY 09 APR 22300 PUT’: 9.4, ‘NIFTY 09 APR 22350 CALL’: 555, ‘NIFTY 09 APR 22350 PUT’: 11, ‘NIFTY 09 APR 22400 CALL’: 508, ‘NIFTY 09 APR 22400 PUT’: 13.2, ‘NIFTY 09 APR 22450 CALL’: 463.5, ‘NIFTY 09 APR 22450 PUT’: 16.7, ‘NIFTY 09 APR 22500 CALL’: 407.45, ‘NIFTY 09 APR 22500 PUT’: 20.65, ‘NIFTY 09 APR 22550 CALL’: 371.55, ‘NIFTY 09 APR 22550 PUT’: 25.9, ‘NIFTY 09 APR 22600 CALL’: 328.45, ‘NIFTY 09 APR 22600 PUT’: 32.6, ‘NIFTY 09 APR 22650 CALL’: 286.25, ‘NIFTY 09 APR 22650 PUT’: 40.6, ‘NIFTY 09 APR 22700 CALL’: 247, ‘NIFTY 09 APR 22700 PUT’: 51.1, ‘NIFTY 09 APR 22750 CALL’: 211.4, ‘NIFTY 09 APR 22750 PUT’: 64.75, ‘NIFTY 09 APR 22800 CALL’: 175, ‘NIFTY 09 APR 22800 PUT’: 80, ‘NIFTY 09 APR 22850 CALL’: 144, ‘NIFTY 09 APR 22850 PUT’: 99.2, ‘NIFTY 09 APR 22900 CALL’: 115.7, ‘NIFTY 09 APR 22900 PUT’: 121.85, ‘NIFTY 09 APR 22950 CALL’: 92.45, ‘NIFTY 09 APR 22950 PUT’: 147.15, ‘NIFTY 09 APR 23000 CALL’: 71.55, ‘NIFTY 09 APR 23000 PUT’: 177.15, ‘NIFTY 09 APR 23050 CALL’: 55.85, ‘NIFTY 09 APR 23050 PUT’: 211.25, ‘NIFTY 09 APR 23100 CALL’: 43.15, ‘NIFTY 09 APR 23100 PUT’: 245.25, ‘NIFTY 09 APR 23150 CALL’: 32.95, ‘NIFTY 09 APR 23150 PUT’: 285.85, ‘NIFTY 09 APR 23200 CALL’: 25.05, ‘NIFTY 09 APR 23200 PUT’: 329, ‘NIFTY 09 APR 23250 CALL’: 19.1, ‘NIFTY 09 APR 23250 PUT’: 372.65, ‘NIFTY 09 APR 23300 CALL’: 15.15, ‘NIFTY 09 APR 23300 PUT’: 416.95, ‘NIFTY 09 APR 23350 CALL’: 11.7, ‘NIFTY 09 APR 23350 PUT’: 467.35, ‘NIFTY 09 APR 23400 CALL’: 9.15, ‘NIFTY 09 APR 23400 PUT’: 513, ‘NIFTY 09 APR 23450 CALL’: 7.55, ‘NIFTY 09 APR 23450 PUT’: 560.75, ‘NIFTY 09 APR 23500 CALL’: 6.3, ‘NIFTY 09 APR 23500 PUT’: 610.2, ‘NIFTY 09 APR 23550 CALL’: 5.05, ‘NIFTY 09 APR 23550 PUT’: 656.2, ‘NIFTY 09 APR 23600 CALL’: 4.15, ‘NIFTY 09 APR 23600 PUT’: 704.7, ‘NIFTY 09 APR 23650 CALL’: 3.6, ‘NIFTY 09 APR 23650 PUT’: 757, ‘NIFTY 09 APR 23700 CALL’: 3, ‘NIFTY 09 APR 23700 PUT’: 806.5, ‘NIFTY 09 APR 23750 CALL’: 2.75, ‘NIFTY 09 APR 23750 PUT’: 858.15, ‘NIFTY 09 APR 23800 CALL’: 2.4, ‘NIFTY 09 APR 23800 PUT’: 902.5, ‘NIFTY 09 APR 23850 CALL’: 2.1, ‘NIFTY 09 APR 23850 PUT’: 962.1}
ltp_temp_dict.T[all_names].iloc[0].to_list()
ltp = tsl.get_ltp_data(names=[‘NIFTY 09 APR 22900 CALL’, ‘NIFTY 09 APR 22900 PUT’])
SESSION-10 - PART-2 - ‘RP-How to deploy Algo on the Server’
—Session 10 — Part 2 ------
Deployment of Algo on server
- Overheat of Laptop
- Fluctuations in Internet Broad Band
- You need peace after deploying Algo without any hurdles.
What’s a Server?
(Kampstaal)
There will be 7 passes to reach Server
Bnaks, Colleges, Hospitals and several companies use Server
Dhan also uses remote Server, located in Data Centres.
You also call it as Cloud.
Several Companies like AWS by Amazon, Google, Microsoft, Azure are all exmaples of Cloud Computing Platforms.
Now let’s start using AWS beloging to Amazon here.
Sign into the console.amazon
Search for lightstall
Browser window will open for lightstall
Click on ‘create instance’ button, means a computer / server.amazon
Select your platform as Windows
Click on ‘Windows Server 2019’
Now select the size of Server you require.
Positively Select 2GB Memory , 60GB SSD Storage (90 days free), which costs $22/- per month.
Then Click on ‘Create instance’ button at the bottom
For the first time it takes few minutes to get your ‘Server’ ready.
Wait until it indicates the stage of ‘Running’.
Now click on the ‘Server’ window.
At the bottom of the window,
You will be provided with ID & Address, in the left side box.
You will be provide with Userbane & Password in the rigt side box.
Also don't forget to retrieve the default password and save it for further usage.
Next Step is to Connect Remote Desktop
Which gives you a box in which you have to fill all the credentials,
Save the connection settings.
Once again get the Remote Desktop, and click on ‘Connect’.
It will ask for the password, which you have to fill in and get connected.
And click on ‘Remember me’ , to get automatically get connected.
Now your server is ready to use.
Downlod Google Chrome on your laptop and paste in the server
ChromeSetup box will appear on the Server desk
Right click and ‘Rin it as Administrator’
Now copy and install all files to run the algo
Install Python and required libraries, including sublime text
Copy and paste the required Session file to run your algo
You can procede to run your algo by using ‘cmd’ propt
After starting the algo, you can close your server, but remember your algo keeps running
NOTE: REMEMBER THE ALGO IN THE CLOSED SERVER WILL KEEP RUNNING, EVEN AFTER YOU CLOSE THE SERVER
if you want to open the server again at your convenient time, you can open it with your credentials
NOW LET US TAK ABOUT BILLING
Remember that as long as your Server is in the state of ‘Running’ you will be billed
AWS will charge around Rs.3,500/- per month for a 4GB Memory Server
Say , if you want to save on the Monthly Flat charges of Rs.3,500, You can do it
Say if you can start and stop the Sever as per the trading hours:
Hourly Cost = Monthly Cost / Total Hours in a month = Rs.3500 / 720 Hours = Rs.4.86/- per Hours
Now if you calculate for actual usage hours:
Final Cost = Hourly Cost x Hours used = Rs.4.86 x 132 Hours = Rs.642/- per month # 22 Days x 6 hours per day = 132 Hours
Remember instead of paying RS.3,500/-, you can only pay Rs.642/- per month, provided you start and stop the server every day after market hours
This matters a lot to every small trader investing small capital initially
Remember to take a snapshot after stopping the server, which will be utilized to start on next days
EXAMPLE:
This is a one time process
Monday - Install --- Complete algo.. (Store ID and Password)
Monday : 3:30 pm : | stop the server and take snapshot
Choose 'Snapshots' from the available Menu and click on 'Create snapshot' and Name it
Monday : 4:00 pm : | Delete your server by Clicking on the top right hand corner, you can choose the delete option
Further Daily process:
Create instance from your snapshot
Now the server will start by filling our credentials
Use the server during the market hours and delete the srver
REMEMBER THAT THERE IS NO NEED TO TAKE SNAPSHOT EVERYDAY, THE SAME SNPSHOT WILL BE USEFUL EVERY DAY
THIS PROCEDURE SHOULD CONTINUE ON ALL TRADING DAYS, AS PER YOUR WISH
DO REMEMBER THAT YOU CAN CHOOSE A BETTER SUBSCRIPTION OF 8GB WILL BE BETTER, AS YOU CAN SAVE ON THE ABOVE METHOS
NOW LET US KNOW ABOUT HYPERCARE
- develop the Algo
- pdb level testing
- Test the algo atleast for 14 consecutive days
- If any error occurs during the testing period, resolve it start Re-Testing process