eshan6704 commited on
Commit
791cbd7
·
verified ·
1 Parent(s): ec859a0

Update app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +30 -30
app/app.py CHANGED
@@ -11,13 +11,13 @@ import importlib.util
11
  # -------------------------------------------------------
12
  from . import common
13
  from . import stock
14
- from . import indices_html
15
- from . import index_live_html
16
- from . import preopen_html
17
- from . import eq_html
18
- from . import bhavcopy_html
19
- from . import build_nse_fno
20
- from . import nsepythonmodified
21
 
22
  # External libs (installed via requirements.txt)
23
  #import nsepython as nse
@@ -75,27 +75,27 @@ def handle_stock(req: FetchRequest):
75
  t = req.req_type.lower()
76
 
77
  if t == "info":
78
- return common.wrap(yahooinfo.fetch_info(req.name))
79
  if t == "intraday":
80
- return common.wrap(stock.fetch_intraday(req.name, req.date_start, req.date_end))
81
  if t == "daily":
82
- return common.wrap(stock.fetch_daily(req.name, req.date_start, req.date_end))
83
  if t == "nse_eq":
84
  return eq_html.build_eq_html(req.name)
85
  if t == "qresult":
86
- return common.wrap(stock.fetch_qresult(req.name))
87
  if t == "result":
88
- return common.wrap(stock.fetch_result(req.name))
89
  if t == "balance":
90
- return common.wrap(stock.fetch_balance(req.name))
91
  if t == "cashflow":
92
- return common.wrap(stock.fetch_cashflow(req.name))
93
  if t == "dividend":
94
- return common.wrap(stock.fetch_dividend(req.name))
95
  if t == "split":
96
- return common.wrap(stock.fetch_split(req.name))
97
  if t == "other":
98
- return common.wrap(stock.fetch_other(req.name))
99
  if t == "stock_hist":
100
  return nsepythonmodied.nse_stock_hist(
101
  req.date_start, req.date_end, req.name
@@ -118,39 +118,39 @@ def handle_index(req: FetchRequest):
118
  if t == "nse_fno":
119
  return build_nse_fno.nse_fno_html(req.date_end, req.name)
120
  if t == "nse_fiidii":
121
- return nsepythonmodied.nse_fiidii().to_html()
122
  if t == "nse_events":
123
- return nsepythonmodied.nse_events().to_html()
124
  if t == "nse_future":
125
- return common.wrap(nsepython.nse_future(req.name))
126
  if t == "nse_highlow":
127
- return nsepythonmodied.nse_highlow(req.date_end).to_html()
128
  if t == "stock_highlow":
129
- return nsepythonmodied.stock_highlow(req.date_end).to_html()
130
  if t == "nse_bhav":
131
  return bhavcopy_html.build_bhavcopy_html(req.date_end)
132
  if t == "nse_largedeals":
133
- return nsepythonmodied.nse_largedeals().to_html()
134
  if t == "nse_bulkdeals":
135
- return nsepythonmodied.nse_bulkdeals().to_html()
136
  if t == "nse_blockdeals":
137
- return nsepythonmodied.nse_blockdeals().to_html()
138
  if t == "nse_most_active":
139
- return nsepython.nse_most_active().to_html()
140
  if t == "index_history":
141
- return nsepythonmodied.index_history("NIFTY", req.date_start, req.date_end).to_html()
142
  if t == "largedeals_historical":
143
  return nsepythonmodied.nse_largedeals_historical(
144
  req.date_start, req.date_end
145
- ).to_html()
146
  if t == "index_pe_pb_div":
147
  return nsepythonmodied.index_pe_pb_div(
148
  "NIFTY", req.date_start, req.date_end
149
- ).to_html()
150
  if t == "index_total_returns":
151
  return nsepythonmodied.index_total_returns(
152
  "NIFTY", req.date_start, req.date_end
153
- ).to_html()
154
 
155
  return common.wrap(f"<h3>Unhandled index req_type: {t}</h3>")
156
 
 
11
  # -------------------------------------------------------
12
  from . import common
13
  from . import stock
14
+ from . import indices_html as indices
15
+ from . import index_live_html as live
16
+ from . import preopen_html as pre
17
+ from . import eq_html as eq
18
+ from . import bhavcopy_html as bhav
19
+ from . import build_nse_fno as fno
20
+ from . import nsepythonmodified as ns
21
 
22
  # External libs (installed via requirements.txt)
23
  #import nsepython as nse
 
75
  t = req.req_type.lower()
76
 
77
  if t == "info":
78
+ return yahooinfo.fetch_info(req.name)
79
  if t == "intraday":
80
+ return stock.fetch_intraday(req.name, req.date_start, req.date_end)
81
  if t == "daily":
82
+ return stock.fetch_daily(req.name, req.date_start, req.date_end)
83
  if t == "nse_eq":
84
  return eq_html.build_eq_html(req.name)
85
  if t == "qresult":
86
+ return stock.fetch_qresult(req.name)
87
  if t == "result":
88
+ return stock.fetch_result(req.name)
89
  if t == "balance":
90
+ return stock.fetch_balance(req.name)
91
  if t == "cashflow":
92
+ return stock.fetch_cashflow(req.name)
93
  if t == "dividend":
94
+ return stock.fetch_dividend(req.name)
95
  if t == "split":
96
+ return stock.fetch_split(req.name)
97
  if t == "other":
98
+ return stock.fetch_other(req.name)
99
  if t == "stock_hist":
100
  return nsepythonmodied.nse_stock_hist(
101
  req.date_start, req.date_end, req.name
 
118
  if t == "nse_fno":
119
  return build_nse_fno.nse_fno_html(req.date_end, req.name)
120
  if t == "nse_fiidii":
121
+ return nsepythonmodied.nse_fiidii()
122
  if t == "nse_events":
123
+ return nsepythonmodied.nse_events()
124
  if t == "nse_future":
125
+ return nsepython.nse_future(req.name)
126
  if t == "nse_highlow":
127
+ return nsepythonmodied.nse_highlow(req.date_end)
128
  if t == "stock_highlow":
129
+ return nsepythonmodied.stock_highlow(req.date_end)
130
  if t == "nse_bhav":
131
  return bhavcopy_html.build_bhavcopy_html(req.date_end)
132
  if t == "nse_largedeals":
133
+ return nsepythonmodied.nse_largedeals()
134
  if t == "nse_bulkdeals":
135
+ return nsepythonmodied.nse_bulkdeals()
136
  if t == "nse_blockdeals":
137
+ return nsepythonmodied.nse_blockdeals()
138
  if t == "nse_most_active":
139
+ return nsepython.nse_most_active()
140
  if t == "index_history":
141
+ return nsepythonmodied.index_history("NIFTY", req.date_start, req.date_end)
142
  if t == "largedeals_historical":
143
  return nsepythonmodied.nse_largedeals_historical(
144
  req.date_start, req.date_end
145
+ )
146
  if t == "index_pe_pb_div":
147
  return nsepythonmodied.index_pe_pb_div(
148
  "NIFTY", req.date_start, req.date_end
149
+ )
150
  if t == "index_total_returns":
151
  return nsepythonmodied.index_total_returns(
152
  "NIFTY", req.date_start, req.date_end
153
+ )
154
 
155
  return common.wrap(f"<h3>Unhandled index req_type: {t}</h3>")
156