mcxlib 0.2__tar.gz → 0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcxlib
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: python library to get MCX India data
5
5
  Home-page: https://github.com/RuchiTanmay/mcxlib
6
6
  Author: RuchiTanmay
@@ -41,4 +41,4 @@ __all__ = [
41
41
  "get_trading_statistics",
42
42
  ]
43
43
 
44
- __version__ = "0.1"
44
+ __version__ = "0.3"
@@ -25,12 +25,13 @@ def get_recent_expires(commodity:str = 'ALL') -> pd.DataFrame:
25
25
  raise ValueError("Apply a valid commodity name")
26
26
  return data_df
27
27
 
28
+
28
29
  def get_market_watch() -> pd.DataFrame:
29
30
  """
30
31
  get live market watch on MCX
31
32
  :return: panda dataframe
32
33
  """
33
- url="https://www.mcxindia.com/backpage.aspx/GetMarketWatch"
34
+ url = "https://www.mcxindia.com/backpage.aspx/GetMarketWatch"
34
35
  payload = {}
35
36
  headers = get_headers(use_for='market-watch')
36
37
  try:
@@ -47,7 +48,7 @@ def get_heat_map() -> pd.DataFrame:
47
48
  get live market heat map on MCX
48
49
  :return: panda dataframe
49
50
  """
50
- url="https://www.mcxindia.com/backpage.aspx/GetHeatMap"
51
+ url = "https://www.mcxindia.com/backpage.aspx/GetHeatMap"
51
52
  payload = {}
52
53
  headers = get_headers(use_for='heatmap')
53
54
  try:
@@ -146,7 +147,7 @@ def get_bhav_copy(trade_date:str = '20230102',
146
147
  :return: panda dataframe
147
148
  """
148
149
  headers = get_headers(use_for='bhavcopy')
149
- url="https://www.mcxindia.com/backpage.aspx/GetDateWiseBhavCopy"
150
+ url = "https://www.mcxindia.com/backpage.aspx/GetDateWiseBhavCopy"
150
151
  payload_param = {'Date': f'{trade_date}', 'InstrumentName': f'{instrument}'}
151
152
  payload = f"{payload_param}"
152
153
  try:
@@ -222,7 +223,7 @@ def get_pro_cli_details(trade_month:str = '202301') -> pd.DataFrame:
222
223
  "Segment": "ALL",
223
224
  "CommodityHead": "ALL",
224
225
  "Commodity": "ALL",
225
- "Startdate": f"{trade_month}"
226
+ "Startdate": f"{trade_month}"
226
227
  })
227
228
  try:
228
229
  data_dict = post_json(url, headers=headers, payload=payload)
@@ -265,7 +266,7 @@ def get_put_call_ratio(ratio_type:str = 'expiry_wise') -> pd.DataFrame:
265
266
  """
266
267
  if ratio_type =='expiry_wise':
267
268
  url = "https://www.mcxindia.com/backpage.aspx/GetExpirywisePutCallRatio"
268
- elif ratio_type =='commodity_wise':
269
+ elif ratio_type == 'commodity_wise':
269
270
  url = "https://www.mcxindia.com/backpage.aspx/GetCommoditywisePutCallRatio"
270
271
  else:
271
272
  raise ValueError(" Please apply valid ratio type")
@@ -290,7 +291,7 @@ def get_category_wise_turnover(year:int = 2023, month_number:int = 9) -> pd.Data
290
291
  month_long = calendar.month_name[month_number].lower()
291
292
  month_short = calendar.month_abbr[month_number].lower()
292
293
  try:
293
- url=f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
294
+ url = f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
294
295
  f"category-wise-turnover-{month_short}-{str(year)}.xlsx"
295
296
  data_df = pd.read_excel(url, skiprows=2, skipfooter=9)
296
297
  except Exception as e:
@@ -330,9 +331,9 @@ def get_ccl_delivery(year:int = 2023, month_number:int = 9) -> pd.DataFrame:
330
331
  :return: pandas dataframe
331
332
  """
332
333
  month_long = calendar.month_name[month_number].lower()
333
- month_short = calendar.month_abbr[month_number].lower()
334
+ # month_short = calendar.month_abbr[month_number].lower()
334
335
  try:
335
- url=f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
336
+ url = f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
336
337
  f"ccl_delivery.xlsx"
337
338
  data_df = pd.read_excel(url)
338
339
  except Exception as e:
@@ -353,22 +354,23 @@ def get_trading_statistics(year:int = 2023, month_number:int = 9) -> pd.DataFram
353
354
  month_long = calendar.month_name[month_number].lower()
354
355
  month_short = calendar.month_abbr[month_number].lower()
355
356
  try:
356
- url=f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
357
+ url = f"https://www.mcxindia.com/docs/default-source/market-data/historicaldata/{str(year)}/{month_long}/" \
357
358
  f"trading-statistics-{month_short}-{str(year)}.xlsx"
358
359
  data_df = pd.read_excel(url, skipfooter=5)
359
360
  except Exception as e:
360
361
  raise ValueError(f" apply valid parameter : MCX error:{e}")
361
362
  data_df.rename(columns={"Mode of Trading (% of Turnover)": "Mode of ALGO Trading (% of Turnover)",
362
- "Unnamed: 25": "Mode of Non-ALGO Trading (% of Turnover)"},inplace=True)
363
+ "Unnamed: 25": "Mode of Non-ALGO Trading (% of Turnover)"},inplace=True)
363
364
  data_df.dropna(inplace=True)
364
365
  data_df.reset_index(inplace=True)
365
366
  data_df.drop(columns='index', inplace=True)
366
367
  return data_df
367
368
 
368
369
 
369
- # if __name__ == '__main__':
370
- # df = get_recent_expires(commodity='COPPER')
371
- # print(df.columns)
372
- # print(df)
370
+ if __name__ == '__main__':
371
+ import mcxlib
372
+ df = mcxlib.get_recent_expires(commodity='COPPER')
373
+ print(df.columns)
374
+ print(df)
373
375
 
374
376
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcxlib
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: python library to get MCX India data
5
5
  Home-page: https://github.com/RuchiTanmay/mcxlib
6
6
  Author: RuchiTanmay
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
  setuptools.setup(
7
7
  name='mcxlib',
8
8
  packages=setuptools.find_packages(),
9
- version='0.2',
9
+ version='0.3',
10
10
  include_package_data=True,
11
11
  description='python library to get MCX India data',
12
12
  long_description=long_description,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes