Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -83,10 +83,17 @@ class StockDataFetcher:
|
|
83 |
return None
|
84 |
|
85 |
def fetch_option_chain(self, symbol):
|
|
|
|
|
86 |
response = requests.get(self.option_chain + symbol, headers=self.headers)
|
87 |
data = response.json()['optionChain']['optionChains']
|
88 |
ltp = response.json()['livePrice']['value']
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
chain = []
|
92 |
for i in range(len(data)):
|
|
|
83 |
return None
|
84 |
|
85 |
def fetch_option_chain(self, symbol):
|
86 |
+
if symbol.upper() == "BANKNIFTY":
|
87 |
+
symbol = "nifty-bank"
|
88 |
response = requests.get(self.option_chain + symbol, headers=self.headers)
|
89 |
data = response.json()['optionChain']['optionChains']
|
90 |
ltp = response.json()['livePrice']['value']
|
91 |
+
|
92 |
+
if symbol == "nifty-bank":
|
93 |
+
index_ltp = requests.get(self.latest_index_price + "BANKNIFTY" + "/latest", headers=self.headers).json()['value']
|
94 |
+
|
95 |
+
if symbol.upper() == "NIFTY":
|
96 |
+
index_ltp = requests.get(self.latest_index_price + "NIFTY" + "/latest", headers=self.headers).json()['value']
|
97 |
|
98 |
chain = []
|
99 |
for i in range(len(data)):
|