### Download Bhavcopy Between Dates Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads bhavcopy data for a range of dates. Specify the destination directory, start date, and end date. ```bash $ jdata bhavcopy -d /path/to/dir -f 2020-01-01 -t 2020-01-30 ``` -------------------------------- ### Download Stock Data using CLI Source: https://marketsetup.in/documentation/jugaad-data Example of downloading historical stock data for a specific symbol within a date range and saving it to a CSV file. Ensure the symbol, dates, and output file are correctly specified. ```bash jdata stock -s SBIN -f 2020-01-01 -t 2020-01-31 -o SBIN-Jan.csv ``` -------------------------------- ### Get All Market Indices Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves all available market indices. Use this to get a dictionary of all indices and their keys. ```python all_indices = n.all_indices() all_indices.keys() ``` -------------------------------- ### Get Index Keys Source: https://marketsetup.in/documentation/jugaad-data/live Retrieve the available keys for an index object to understand what data attributes can be accessed. ```python nifty.keys() ``` -------------------------------- ### Get General Stock Information Source: https://marketsetup.in/documentation/jugaad-data/live Fetches general information about a stock, including its company name, industry, and trading series. ```python q['info'] ``` ```json { 'symbol': 'HDFC', 'companyName': 'Housing Development Finance Corporation Limited', 'industry': 'FINANCE - HOUSING', 'activeSeries': ['EQ', 'W3'], 'debtSeries': [], 'tempSuspendedSeries': ['W1', 'W2'], 'isFNOSec': True, 'isCASec': False, 'isSLBSec': True, 'isDebtSec': False, 'isSuspended': False, 'isETFSec': False, 'isDelisted': False, 'isin': 'INE001A13049', 'isTop10': False, 'identifier': 'HDFCEQN' } ``` -------------------------------- ### Get Pre-Open Market Data Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves pre-open market data for a stock, including pre-open price/quantity details, ATO (At The Opening) orders, and IEP (Indicative Equilibrium Price). ```python q['preOpenMarket'] ``` ```json { 'preopen': [{'price': 2330.55, 'buyQty': 0, 'sellQty': 57}, {'price': 2400, 'buyQty': 0, 'sellQty': 7}, {'price': 2408.2, 'buyQty': 0, 'sellQty': 253}, {'price': 2449, 'buyQty': 0, 'sellQty': 10}, {'price': 2630.45, 'buyQty': 0, 'sellQty': 0, 'iep': True}, {'price': 2705.95, 'buyQty': 306, 'sellQty': 0}, {'price': 2710.5, 'buyQty': 8864, 'sellQty': 0}, {'price': 2718.9, 'buyQty': 16076, 'sellQty': 0}, {'price': 2750, 'buyQty': 100, 'sellQty': 0}], 'ato': {'buy': 1329, 'sell': 169}, 'IEP': 2630.45, 'totalTradedVolume': 51122, 'finalPrice': 0, 'finalQuantity': 0, 'lastUpdateTime': '25-Jan-2021 09:07:41', 'totalBuyQuantity': 79071, 'totalSellQuantity': 58736, 'atoBuyQty': 1329, 'atoSellQty': 169 } ``` -------------------------------- ### Fetch Current RBI Rates using Python Source: https://marketsetup.in/documentation/jugaad-data/rbi Use this snippet to retrieve current economic rates published by the RBI. Ensure the 'jugaad-data' library is installed. ```python from jugaad_data.rbi import RBI r = RBI() print(r.current_rates()) ``` -------------------------------- ### Get Live Tick Data Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves live tick data for a stock, providing a series of timestamped price points. ```python tick_data = n.tick_data("HDFC") ``` ```python tick_data['grapthData'][0:10] ``` ```json [[1611566100000, 2635], [1611566101000, 2636.25], [1611566102000, 2634.65], [1611566103000, 2634.75], [1611566104000, 2633.65], [1611566105000, 2633.3], [1611566106000, 2642.1], [1611566107000, 2642.55], [1611566108000, 2647], [1611566109000, 2657.6]] ``` -------------------------------- ### Get Stock Metadata Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves metadata for a stock, including its series, ISIN, listing date, and industry. ```python q['metadata'] ``` ```json { 'series': 'EQ', 'symbol': 'HDFC', 'isin': 'INE001A01036', 'status': 'Listed', 'listingDate': '23-Oct-1996', 'industry': 'HOUSING FINANCE', 'lastUpdateTime': '25-Jan-2021 16:00:00', 'pdSectorPe': 30.46, 'pdSymbolPe': 0, 'pdSectorInd': 'NIFTY FINANCIAL SERVICES ' } ``` -------------------------------- ### Retrieve Advance/Decline Counts Source: https://marketsetup.in/documentation/jugaad-data/live Get the number of stocks that have advanced, declined, or remained unchanged for the index. ```python nifty['advance'] ``` -------------------------------- ### Print Index Option Chain Details Source: https://marketsetup.in/documentation/jugaad-data/live Iterate through a slice of the index option chain data to print the Call/Put last prices and strike prices. This example shows data for indices. ```python print("----Index option chain-----") print("CE\tStrike\tPE") for option in option_chain['filtered']['data'][80:100]: print("{}\t{}\t{}".format(option['CE']['lastPrice'], option['strikePrice'], option['PE']['lastPrice'])) ``` -------------------------------- ### Print Equity Option Chain Details Source: https://marketsetup.in/documentation/jugaad-data/live Iterate through a slice of the equity option chain data to print the Call/Put last prices and strike prices. This example shows data for equities. ```python print("-----Equity option chain-----") print("CE\tStrike\tPE") for option in eq_option_chain['filtered']['data'][30:50]: print("{}\t{}\t{}".format(option['CE']['lastPrice'], option['strikePrice'], option['PE']['lastPrice'])) ``` -------------------------------- ### NSE Market Status Data Structure Source: https://marketsetup.in/documentation/jugaad-data/live Example of the data structure returned by the market_status() function, detailing market type, status, last trade information, and more. ```json [{'market': 'Capital Market', 'marketStatus': 'Close', 'tradeDate': '22-Dec-2023 15:30', 'index': 'NIFTY 50', 'last': 21349.4, 'variation': 94.35000000000218, 'percentChange': 0.44, 'marketStatusMessage': 'Market is Closed'}, {'market': 'Currency', 'marketStatus': 'Close', 'tradeDate': 'Invalid date', 'index': '', 'last': '', 'variation': '', 'percentChange': '', 'marketStatusMessage': 'Market is Closed'}, {'market': 'Commodity', 'marketStatus': 'Close', 'tradeDate': 'Invalid date', 'index': '', 'last': '', 'variation': '', 'percentChange': '', 'marketStatusMessage': 'Market is Closed'}, {'market': 'Debt', 'marketStatus': 'Close', 'tradeDate': 'Invalid date', 'index': '', 'last': '', 'variation': '', 'percentChange': '', 'marketStatusMessage': 'Market is Closed'}, {'market': 'currencyfuture', 'marketStatus': 'Close', 'tradeDate': 'Invalid date', 'index': '', 'last': '83.1650', 'variation': '', 'percentChange': '', 'marketStatusMessage': 'Market is Closed', 'expiryDate': '27-Dec-2023', 'underlying': 'USDINR', 'updated_time': '22-Dec-2023 17:00', 'tradeDateFormatted': '22-Dec-2023 17:00', 'slickclass': 'slick-item'}] ``` -------------------------------- ### Print Currency Option Chain Details Source: https://marketsetup.in/documentation/jugaad-data/live Iterate through a slice of the currency option chain data to print the Call/Put last prices and strike prices. This example shows data for currencies. ```python print("----Currency option chain ----") print("CE\tStrike\tPE") for option in curr_option_chain['filtered']['data'][10:30]: print("{}\t{}\t{}".format(option['CE']['lastPrice'], option['strikePrice'], option['PE']['lastPrice'])) ``` -------------------------------- ### Get NSE Market Status Source: https://marketsetup.in/documentation/jugaad-data/live Instantiate NSELive and call market_status() to retrieve the current market status. The 'marketState' key in the returned dictionary indicates if the market is open or closed. ```python from jugaad_data.nse import NSELive n = NSELive() status = n.market_status() status['marketState'] ``` -------------------------------- ### Get Security Information Source: https://marketsetup.in/documentation/jugaad-data/live Fetches detailed security information, including board and trading status, trading segment, and face value. ```python q['securityInfo'] ``` ```json { 'boardStatus': 'Main', 'tradingStatus': 'Active', 'tradingSegment': 'Normal Market', 'sessionNo': '-', 'slb': 'Yes', 'classOfShare': 'Equity', 'derivatives': 'Yes', 'surveillance': '-', 'faceValue': 2, 'issuedCap': 1800191002 } ``` -------------------------------- ### Retrieve Expiry Dates from Option Chain Data Source: https://marketsetup.in/documentation/jugaad-data/live Access the 'expiryDates' key within the fetched option chain data to get a list of available expiration dates. ```python option_chain['records']['expiryDates'] ``` -------------------------------- ### Get Stock Trade Information Source: https://marketsetup.in/documentation/jugaad-data/live Fetches detailed stock trade information, including block deals, market depth order book, and security-wise delivery details. ```python trade_info = n.trade_info("HDFC") ``` ```python trade_info ``` ```json { 'noBlockDeals': True, 'bulkBlockDeals': [{'name': 'Session I'}, {'name': 'Session II'}], 'marketDeptOrderBook': {'totalBuyQuantity': 1602, 'totalSellQuantity': 0, 'bid': [{'price': 2551.4, 'quantity': 1602}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}], 'ask': [{'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}], 'tradeInfo': {'totalTradedVolume': 7761405, 'totalTradedValue': 202685.21, 'totalMarketCap': 46084889.65, 'ffmc': 45851691.180862, 'impactCost': 0.02}, 'valueAtRisk': {'securityVar': 15.94, 'indexVar': 0, 'varMargin': 15.94, 'extremeLossMargin': 3.5, 'adhocMargin': 6.43, 'applicableMargin': 25.87}}, 'securityWiseDP': {'quantityTraded': 7761405, 'deliveryQuantity': 5387037, 'deliveryToTradedQuantity': 69.41, 'seriesRemarks': None, 'secWiseDelPosDate': '25-JAN-2021 EOD'} } ``` -------------------------------- ### Get Index Price Data Source: https://marketsetup.in/documentation/jugaad-data/live Access the detailed price information for the index, including open, high, low, last price, previous close, change, and various historical data points. ```python nifty['data'][0] ``` -------------------------------- ### Download Stock Data to Pandas DataFrame Source: https://marketsetup.in/documentation/jugaad-data Use this function to download historical stock data for a given symbol and date range. The data is returned as a pandas DataFrame. Ensure you have the 'jugaad-data' and 'pandas' libraries installed. ```python from jugaad_data.nse import stock_df df = stock_df(symbol="SBIN", from_date=date(2020,1,1), to_date=date(2020,1,30), series="EQ") print(df.head()) ``` -------------------------------- ### Display Sample Expiry Dates Source: https://marketsetup.in/documentation/jugaad-data/live This is a sample output showing the format of expiry dates returned. ```text ['28-Jan-2021', '04-Feb-2021', '11-Feb-2021', '18-Feb-2021', '25-Feb-2021', '04-Mar-2021', '10-Mar-2021', '18-Mar-2021', '25-Mar-2021', '01-Apr-2021', '24-Jun-2021', '30-Sep-2021', '30-Dec-2021', '30-Jun-2022', '29-Dec-2022', '29-Jun-2023', '26-Jun-2025'] ``` -------------------------------- ### Jugaad Data CLI Help Source: https://marketsetup.in/documentation/jugaad-data Displays the overall usage and available commands for the jdata CLI tool. Use this to understand the main functionalities. ```bash jdata --help ``` -------------------------------- ### JData Bhavcopy Help Source: https://marketsetup.in/documentation/jugaad-data/historical Shows the help message for the `jdata bhavcopy` command, detailing options for downloading bhavcopy data. ```bash $ jdata bhavcopy --help ``` -------------------------------- ### Download Index Bhavcopy Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads only index bhavcopy data for a specified date range. Requires destination directory, from date, and to date. ```bash $ jdata bhavcopy -d /path/to/dir -f 2020-01-01 -t 2020-01-30 --idx ``` -------------------------------- ### Sample Index Option Chain Output Source: https://marketsetup.in/documentation/jugaad-data/live This is a sample output of the printed index option chain data, showing Call/Put prices and strike prices. ```text --- Index option chain----- CE Strike PE 604 20800 14 558.95 20850 18 509.05 20900 16.7 462 20950 19.95 414.6 21000 24 365.8 21050 27.4 320.1 21100 32.05 282.5 21150 39.95 239 21200 50 203.4 21250 60 167.6 21300 76 135.15 21350 92.55 105 21400 115.55 82.5 21450 140.4 62.55 21500 169.15 45.2 21550 204.45 32.7 21600 244.45 25 21650 284.25 18.7 21700 329.45 15 21750 369.7 ``` -------------------------------- ### Download Full Bhavcopy Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads the full bhavcopy, including delivery trade quantity, for a specified date range. Requires destination directory, from date, and to date. ```bash $ jdata bhavcopy -d /path/to/dir -f 2020-01-01 -t 2020-01-30 --full ``` -------------------------------- ### Get Expiry Dates Source: https://marketsetup.in/documentation/jugaad-data/historical Fetch expiry dates for active derivative contracts on a given day. This can be filtered by contract type. ```APIDOC ## Download historical derivatives data ### Get expiry dates For a given day, fetch expiry dates of all active contracts. ```python from datetime import date from jugaad_data.nse import expiry_dates expiries = expiry_dates(date(2020,1,1)) print(expiries) ``` You can filter it further, based on the contract type eg. OPTIDX, FUTSTK etc. ```python from datetime import date from jugaad_data.nse import expiry_dates expiries = expiry_dates(date(2020,1,1), "FUTSTK") print(expiries) ``` ``` -------------------------------- ### Sample Equity Option Chain Output Source: https://marketsetup.in/documentation/jugaad-data/live This is a sample output of the printed equity option chain data, showing Call/Put prices and strike prices. ```text --- Equity option chain----- CE Strike PE 122.6 2440 0.6 104.6 2460 0.7 85.6 2480 1.3 65.45 2500 2.65 49.9 2520 5.35 33.6 2540 9.9 22.5 2560 17.5 13.75 2580 30.45 8.4 2600 44.1 4.55 2620 60.15 2.45 2640 77.85 1.75 2660 98 1.2 2680 116.55 1 2700 132 0.7 2720 154.5 0.65 2740 173.5 0.6 2760 179.65 0.5 2780 182.35 0.45 2800 236.15 0.55 2820 247.5 ``` -------------------------------- ### Download Derivatives Bhavcopy Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads derivatives bhavcopy data for a specified date range. Requires destination directory, from date, and to date. ```bash $ jdata bhavcopy -d /path/to/dir -f 2020-01-01 -t 2020-01-30 --fo ``` -------------------------------- ### Get All Expiry Dates Source: https://marketsetup.in/documentation/jugaad-data/historical Fetch all active contract expiry dates for a given day. This function returns a list of datetime.date objects. ```python from datetime import date from jugaad_data.nse import expiry_dates expiries = expiry_dates(date(2020,1,1)) print(expiries) ``` -------------------------------- ### Get Index Timestamp Source: https://marketsetup.in/documentation/jugaad-data/live Retrieve the timestamp of the last traded price for the index. This value updates continuously during live market hours. ```python nifty['timestamp'] ``` -------------------------------- ### JData CLI Help Source: https://marketsetup.in/documentation/jugaad-data/historical Displays the help message for the `jdata` command-line interface, outlining available commands and options. ```bash $ jdata --help ``` -------------------------------- ### Get Advance and Decline Counts Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves the total number of advancing and declining stocks from the 'all_indices' dictionary. This provides a snapshot of market sentiment. ```python print(all_indices['advances'], all_indices['declines']) ``` -------------------------------- ### View Bhavcopy File Content Source: https://marketsetup.in/documentation/jugaad-data Use the `tail` command to view the last few lines of the downloaded bhavcopy CSV files. This helps in quickly inspecting the data format and content. ```bash !tail cm01Jan2020bhav.csv ``` ```text ZENITHEXPO,BE,46.95,46.95,43.6,45.55,46.6,44.95,1201,54268.2,01-JAN-2020,22,INE058B01018, ZENSARTECH,EQ,175.95,176.9,173,175.4,175.85,174.6,18748,3281047.5,01-JAN-2020,4269,INE520A01027, ZENTEC,EQ,55.15,57.4,54.3,55.95,56.4,56.45,25296,1412952.05,01-JAN-2020,266,INE251B01027, ZICOM,BE,1.65,1.65,1.55,1.65,1.65,1.6,36099,56326.85,01-JAN-2020,32,INE871B01014, ZODIACLOTH,EQ,175.35,184.95,168.75,171.75,172,175.35,12971,2249854.55,01-JAN-2020,758,INE206B01013, ZODJRDMKJ,EQ,32.05,32.75,32,32.05,32.05,32.8,1070,34359.15,01-JAN-2020,73,INE077B01018, ZOTA,EQ,188.9,189.75,186.75,188.5,188.5,186.45,25664,4828369.25,01-JAN-2020,165,INE358U01012, ZUARI,EQ,92.4,92.4,90.6,92,92,90.5,9173,840932.3,01-JAN-2020,174,INE840M01016, ZUARIGLOB,EQ,49.1,50.25,48.1,48.5,48.2,50.05,19086,937517.35,01-JAN-2020,408,INE217A01012, ZYDUSWELL,EQ,1462,1479.95,1462,1465.95,1465.45,1470.3,1118,1642480.7,01-JAN-2020,301,INE768C01010, ``` ```bash !tail fo01Jan2020bhav.csv ``` ```text OPTSTK,ZEEL,26-Mar-2020,240,PE,0,0,0,15.55,13.15,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,260,PE,0,0,0,22.8,20.35,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,280,PE,0,0,0,31.7,29.45,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,300,PE,0,0,0,42.15,40.35,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,320,PE,0,0,0,54,52.85,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,340,PE,0,0,0,67.15,66.75,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,360,PE,0,0,0,81.4,81.9,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,380,PE,0,0,0,96.6,98,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,400,PE,0,0,0,112.65,114.95,0,0,0,0,01-JAN-2020, OPTSTK,ZEEL,26-Mar-2020,420,PE,0,0,0,129.3,132.5,0,0,0,0,01-JAN-2020, ``` -------------------------------- ### Sample Currency Option Chain Output Source: https://marketsetup.in/documentation/jugaad-data/live This is a sample output of the printed currency option chain data, showing Call/Put prices and strike prices. ```text ----Currency option chain ---- CE Strike PE 0.9075 82.375 0.0025 0.735 82.5 0.0025 0.65 82.625 0.0025 0.485 82.75 0.0025 0.355 82.875 0.0025 0.2325 83 0.0025 0.1075 83.125 0.0025 0.0025 83.25 0.02 0.0025 83.375 0.145 0.0025 83.5 0.27 0.0025 83.625 0.4 0.0025 83.75 0.5175 0.0025 84 0.765 0.0025 84.25 1.18 0 84.5 1.245 0.0025 84.75 0 0.0025 85 0 0 85.25 0 0 85.5 0 0 85.75 0 ``` -------------------------------- ### Get Stock Quote Data Source: https://marketsetup.in/documentation/jugaad-data/live Retrieves the current quote for a given stock symbol. The result includes price information, changes, and historical high/low data. ```python q = n.stock_quote("HDFC") q['priceInfo'] ``` ```json { 'lastPrice': 2560, 'change': -29.449999999999818, 'pChange': -1.137307150167017, 'previousClose': 2589.45, 'open': 2630.45, 'close': 2551.4, 'vwap': 2611.45, 'lowerCP': '2330.55', 'upperCP': '2848.35', 'pPriceBand': 'No Band', 'basePrice': 2589.45, 'intraDayHighLow': {'min': 2543, 'max': 2670, 'value': 2560}, 'weekHighLow': {'min': 1473.45, 'minDate': '24-Mar-2020', 'max': 2777.15, 'maxDate': '13-Jan-2021', 'value': 2560} } ``` -------------------------------- ### Download Bhavcopy for Specific Date Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads bhavcopy data for a single, specified date. Requires the destination directory and the from date. ```bash $ jdata bhavcopy -d /path/to/dir -f 2020-01-01 ``` -------------------------------- ### Download Bhavcopies for Stocks, Indices, and F&O Source: https://marketsetup.in/documentation/jugaad-data/historical Use these functions to download bhavcopies for a specific date. The full bhavcopy includes delivery volume percentages. Ensure the output directory exists. ```python from datetime import date from jugaad_data.nse import bhavcopy_save, full_bhavcopy_save, bhavcopy_fo_save, bhavcopy_index_save bhavcopy_save(date(2020,1,1), "/path/to/directory") full_bhavcopy_save(date(2020,1,1), "/path/to/directory") bhavcopy_fo_save(date(2020,1,1), "/path/to/directory") bhavcopy_index_save(date(2020,1,1), "/path/to/directory") ``` -------------------------------- ### Sample Details of a Derivative Contract Source: https://marketsetup.in/documentation/jugaad-data/live This is a sample output showing the detailed information for a specific derivative contract, including its identifier, type, prices, and turnover metrics. ```json { 'underlying': 'NIFTY', 'identifier': 'FUTIDXNIFTY28-01-2021XX0.00', 'instrumentType': 'FUTIDX', 'instrument': 'Index Futures', 'expiryDate': '28-Jan-2021', 'optionType': '-', 'strikePrice': 0, 'lastPrice': 14254, 'pChange': -0.8772509327093225, 'openPrice': 14475, 'highPrice': 14497.75, 'lowPrice': 14233.6, 'numberOfContractsTraded': 185139, 'totalTurnover': 1993001.4325575, 'premiumTurnover': 199300143255.75, 'openInterest': 127322, 'underlyingValue': 14238.9 } ``` -------------------------------- ### Download Bhavcopy and Historical Data Source: https://marketsetup.in/documentation/jugaad-data Use `bhavcopy_save` to download daily bhavcopy for stocks and derivatives. Use `bhavcopy_fo_save` for futures and options data. Specify the date and the directory to save the files. ```python from datetime import date from jugaad_data.nse import bhavcopy_save, bhavcopy_fo_save # Download bhavcopy bhavcopy_save(date(2020,1,1), "./") # Download bhavcopy for futures and options bhavcopy_fo_save(date(2020,1,1), "./") ``` -------------------------------- ### Download Today's Bhavcopy Source: https://marketsetup.in/documentation/jugaad-data/historical Downloads today's bhavcopy data to a specified directory. This command is typically used after market hours. ```bash $ jdata bhavcopy -d /path/to/dir ``` -------------------------------- ### Fetch Option Chains for Indices, Equities, and Currencies Source: https://marketsetup.in/documentation/jugaad-data/live Use these functions to retrieve live option chain data. Specify the index, equity symbol, or currency pair as needed. ```python option_chain = n.index_option_chain("NIFTY") # Index Option chains eq_option_chain = n.equities_option_chain("RELIANCE") # Equity option chains curr_option_chain = n.currency_option_chain("USDINR") # Currency option chains ``` -------------------------------- ### Verify Downloaded Bhavcopy Files Source: https://marketsetup.in/documentation/jugaad-data After downloading, you can list the CSV files in the directory to confirm the bhavcopy files have been saved. The output shows the naming convention for the downloaded files. ```bash ls *.csv ``` ```bash cm01Jan2020bhav.csv fo01Jan2020bhav.csv ``` -------------------------------- ### Download Bhavcopies Source: https://marketsetup.in/documentation/jugaad-data/historical Download bhavcopies for stocks, indices, and futures & options for a specific date. The `full_bhavcopy_save` includes delivery volume percentage. ```APIDOC ## Download bhavcopies You can download bhavcopies for stocks, indices and futures & Optios using `jugaad-data`. Below example shows how to download different bhavcopies for 1st Jan 2020 and saves to a directory in csv format. ```python from datetime import date from jugaad_data.nse import bhavcopy_save, full_bhavcopy_save, bhavcopy_fo_save, bhavcopy_index_save bhavcopy_save(date(2020,1,1), "/path/to/directory") full_bhavcopy_save(date(2020,1,1), "/path/to/directory") bhavcopy_fo_save(date(2020,1,1), "/path/to/directory") bhavcopy_index_save(date(2020,1,1), "/path/to/directory") ``` **Note** Difference between `bhavcopy_save` and `full_bhavcopy_save` is that in full bhavcopy you also get the percentage of volume which was in delivery. ``` -------------------------------- ### Download Futures & Options Data Source: https://marketsetup.in/documentation/jugaad-data/historical Use this command to download futures and options data. Specify symbol, date range, expiry, instrument type, and optionally strike price and call/put options. ```bash $ jdata derivatives --help Usage: jdata derivatives [OPTIONS] Options: -s, --symbol TEXT Stock/Index symbol [required] -f, --from TEXT From date - yyyy-mm-dd [required] -t, --to TEXT To date - yyyy-mm-dd [required] -e, --expiry TEXT Expiry date - yyyy-mm-dd [required] -i, --instru TEXT FUTSTK - Stock futures, FUTIDX - Index Futures, OPTSTK - Stock Options, OPTIDX - Index Options [required] -p, --price TEXT Strike price (Only for OPTSTK and OPTIDX) --ce / --pe --ce for call and --pe for put (Only for OPTSTK and OPTIDX) -o, --output TEXT Full path of output file --help Show this message and exit. ``` ```bash $ jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTSTK -o file_name.csv ``` ```bash $ jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTIDX -o file_name.csv ``` ```bash $ jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i OPTSTK -p 330 --ce -o file_name.csv ``` ```bash $ jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-23 -e 2020-01-23 -i OPTIDX -p 11000 --pe -o file_name.csv ``` -------------------------------- ### Fetch Live Index Data Source: https://marketsetup.in/documentation/jugaad-data/live Import and instantiate the NSELive class to fetch live data for a specific index. This is a common first step for all live data operations. ```python nifty = n.live_index("NIFTY 50") ``` -------------------------------- ### Get Filtered Expiry Dates by Contract Type Source: https://marketsetup.in/documentation/jugaad-data/historical Retrieve expiry dates for a specific contract type (e.g., 'FUTSTK') on a given day. This allows filtering the expiry dates based on derivatives contract types. ```python from datetime import date from jugaad_data.nse import expiry_dates expiries = expiry_dates(date(2020,1,1), "FUTSTK") print(expiries) ``` -------------------------------- ### Sample Equity Derivative Turnover Output Source: https://marketsetup.in/documentation/jugaad-data/live This sample output shows the identifier and total turnover for various equity derivative contracts, sorted by turnover. ```text FUTIDXNIFTY28-01-2021XX0.00 1993001.4325575 FUTIDXBANKNIFTY28-01-2021XX0.00 1971646.452105 FUTIDXNIFTY25-02-2021XX0.00 639651.073635 FUTSTKRELIANCE28-01-2021XX0.00 481936.0667 FUTSTKTATAMOTORS28-01-2021XX0.00 411916.428 FUTSTKKOTAKBANK28-01-2021XX0.00 342169.4506 FUTIDXBANKNIFTY25-02-2021XX0.00 317728.786825 FUTSTKHDFCBANK28-01-2021XX0.00 300168.45705 FUTSTKBHARTIARTL28-01-2021XX0.00 297890.25741900003 FUTSTKRELIANCE25-02-2021XX0.00 288693.0396 FUTSTKBAJFINANCE28-01-2021XX0.00 272159.20905 FUTSTKICICIBANK28-01-2021XX0.00 270931.0758 FUTSTKBHARTIARTL25-02-2021XX0.00 247874.5618938 FUTSTKINFY28-01-2021XX0.00 235133.2647 FUTSTKAXISBANK28-01-2021XX0.00 224137.1448 FUTSTKSBIN28-01-2021XX0.00 220771.3536 FUTSTKHDFC28-01-2021XX0.00 211855.64148 FUTSTKTATASTEEL28-01-2021XX0.00 207522.36192 FUTSTKHDFCBANK25-02-2021XX0.00 207458.4039 FUTSTKULTRACEMCO28-01-2021XX0.00 207429.98906 ```