finmetry


Namefinmetry JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/dev-ddr/finmetry
SummaryStock market data analysis
upload_time2023-08-31 06:28:30
maintainer
docs_urlNone
authorDarshan Rathod, Sachin K S
requires_python>=3.6, <4
license
keywords stock market market finanace investment
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Finmetry

This is the project on stock market data analysis using modern data anlysis tools, AI and ML.

In depth tests on various stock market tools are conducted.

## The current version is

    0.1.7
    

# Importing and initiating


```python
%load_ext autoreload

%autoreload 2
import finmetry as fm

import pandas as pd
pd.set_option('display.max_rows', 5)
pd.set_option('display.max_columns', 20)
import numpy as np
import datetime as dtm
```

The API has `Stock` class which helps in managing the data related to any security. Clients are classes of various data providing external libraries such as `py5paisa, yfinance ` etc. finmetry API has the class based of the python API of such external libraries for ease of use with `Stock` class. This version of finmetry is mainly developed around client `py5paisa`, as it provieds enough data for in-depth market analysis.

## Initializing Stock

`Stock` class API provides handy tools for managing various data provided by clients. The `Stock` instance is provided to various clients which will then download the data for those stocks. There are multiple clients which provide variety of data on security. Further information on these can be found on specific module or through help of specific methods. The information about intializing Client5paisa can be found [here](#Client5paisa).

The `Stock` class consists of various methods to get historical data and managing the local storage of data. If the `store_local` is `False` then no local storage is done. It is advisable to keep a folder for market data which can be provided to `Stock` class for proper handling. Also, if the historical data is already downloaded then this helps in directly accesing offline data instead of downloading it again.


```python
from finmetry import Stock

market_foldpath = r"D:\Finmetry\local_data"

s1 = Stock(
    symbol="RELIANCE",
    exchange="N",
    exchange_type="C",
    store_local=True,
    local_data_foldpath=market_foldpath,
)
```

As `store_local = True`, Folder with name `RELIANCE` is created. Now all the historical and other types of data will be stored in this folder. If there is already some historical data downloaded then API would directly access that data.

## <a id="Client5paisa"></a>Intitalizing Client5paisa

`Client5paisa` is the class derived from `py5paisa.FivePaisaClient`. This is done to ease the data handling process.

First, we will initialize `Client5paisa` which will be used for data downloading for various stocks. For this the user needs 5paisa account and the API keys. User can refer to [py5paisa](https://github.com/5paisa/py5paisa) for further details on getting API credentials. User need, API credentials (`cred`), email-id (`email`), password (`password`) of 5paisa account and date of birth (`dob`). Here, the credentials are already loaded on variables and not shown for security reasons.


```python
c_5p = fm.client_5paisa.Client5paisa(email=email, password=password, dob=dob, cred=cred)
```

     19:32:23 | Logged in!!
    

### ScripMaster

py5paisa provides the .csv file containing symbols and other information of majority of the Indian securities. The file is around 40Mb (while writing this and may vary in future) which may take about few seconds to download depending upon the internet speed. It is advisable to save it offline and use that .csv again for faster intialization. The local file should be updated often for any changes in .csv file, if any.

#### Downloading the file


```python
scrip_master = fm.client_5paisa.ScripMaster()
```

#### Save the file locally


```python
scrip_master_filepath = r"D:\Finmetry\local_data\scrip_master.csv"
scrip_master.save(scrip_master_filepath)
```

#### Loading from local file


```python
scrip_master_filepath = r"D:\Finmetry\local_data\scrip_master.csv"
scrip_master = fm.client_5paisa.ScripMaster(filepath=scrip_master_filepath)
scrip_master.data
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Exch</th>
      <th>ExchType</th>
      <th>Scripcode</th>
      <th>Name</th>
      <th>Series</th>
      <th>Expiry</th>
      <th>...</th>
      <th>Multiplier</th>
      <th>Underlyer</th>
      <th>Root</th>
      <th>TickSize</th>
      <th>CO BO Allowed</th>
      <th>Symbol</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>B</td>
      <td>C</td>
      <td>199117</td>
      <td>SETFN50INAV</td>
      <td>EQ</td>
      <td>1980-01-01 00:00:00</td>
      <td>...</td>
      <td>1</td>
      <td>NaN</td>
      <td>SETFN50INAV</td>
      <td>0.01</td>
      <td>N</td>
      <td>SETFN50INAV</td>
    </tr>
    <tr>
      <th>1</th>
      <td>B</td>
      <td>C</td>
      <td>199118</td>
      <td>MOHEALTINAV</td>
      <td>EQ</td>
      <td>1980-01-01 00:00:00</td>
      <td>...</td>
      <td>1</td>
      <td>NaN</td>
      <td>MOHEALTINAV</td>
      <td>0.01</td>
      <td>N</td>
      <td>MOHEALTINAV</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>202732</th>
      <td>M</td>
      <td>D</td>
      <td>256029</td>
      <td>NATURALGAS 23 JUN 2023 CE 130.00              ...</td>
      <td></td>
      <td>2023-06-23 23:59:59</td>
      <td>...</td>
      <td>1</td>
      <td>23 Jun 2023</td>
      <td>NATURALGAS</td>
      <td>0.05</td>
      <td>Y</td>
      <td>NATURALGAS 23 JUN 2023 CE 130.00              ...</td>
    </tr>
    <tr>
      <th>202733</th>
      <td>M</td>
      <td>D</td>
      <td>256030</td>
      <td>NATURALGAS 23 JUN 2023 PE 130.00              ...</td>
      <td></td>
      <td>2023-06-23 23:59:59</td>
      <td>...</td>
      <td>1</td>
      <td>23 Jun 2023</td>
      <td>NATURALGAS</td>
      <td>0.05</td>
      <td>Y</td>
      <td>NATURALGAS 23 JUN 2023 PE 130.00              ...</td>
    </tr>
  </tbody>
</table>
<p>202734 rows × 20 columns</p>
</div>



User can repeat the process of downloading and saving to update the local file. This `scrip_master` will be used for generating various inputs for data fatching methods. The `Exch, ExchType, Scripcode` are some of the parameters required to get the market data of various securities. Hence this `scrip_master` should be provided to client_5paisa instance (i.e, `c_5p`).

#### Provide scrip_master to Client5paisa


```python
c_5p.scrip_master = scrip_master
```

User can also provide the `scrip_master` instance during initialization of `Client5paisa` class.


```python
c_5p = fm.client_5paisa.Client5paisa(
    email=email, password=password, dob=dob, cred=cred, scrip_master=scrip_master
)
```

## Historical data

Historical data for list of stocks can be downloaded using `c_5p.download_historical_data`. If `Stock.store_local is True` then the data will be stored locally with separate file for each months data.


```python
syms = ["RELIANCE", "ITC", "TCS"]
sl1 = []
for sym in syms:
    s1 = Stock(
        symbol=sym.upper(),
        exchange="N",
        exchange_type="C",
        store_local=True,
        local_data_foldpath=market_foldpath,
    )
    sl1.append(s1)
```


```python
c_5p.download_historical_data(
    stocklist=sl1, interval="1m", start="2019-04-1", end="2019-04-30"
)
```

### Accessing local data

Stock class has the method to access the data stored locally.


```python
s1 = sl1[0]
data = s1.load_historical_data(interval="1m", start="2019-04-1", end="2019-04-30")
data
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Open</th>
      <th>High</th>
      <th>Low</th>
      <th>Close</th>
      <th>Volume</th>
    </tr>
    <tr>
      <th>Datetime</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>2019-04-01 09:15:00</th>
      <td>1371.00</td>
      <td>1373.15</td>
      <td>1369.50</td>
      <td>1370.10</td>
      <td>73889</td>
    </tr>
    <tr>
      <th>2019-04-01 09:16:00</th>
      <td>1370.30</td>
      <td>1370.75</td>
      <td>1368.90</td>
      <td>1369.00</td>
      <td>45357</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>2019-04-30 15:29:00</th>
      <td>1392.15</td>
      <td>1393.00</td>
      <td>1391.00</td>
      <td>1393.00</td>
      <td>33141</td>
    </tr>
    <tr>
      <th>2019-04-30 15:30:00</th>
      <td>1392.45</td>
      <td>1392.45</td>
      <td>1392.45</td>
      <td>1392.45</td>
      <td>25</td>
    </tr>
  </tbody>
</table>
<p>7137 rows × 5 columns</p>
</div>



## Live Market Data

Various live market data is provided by py5paisa, like Market Depth and Market Feed.

### Market Depth


```python
d1 = c_5p.get_market_depth(sl1)
d1
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>AverageTradePrice</th>
      <th>BuyQuantity</th>
      <th>Close</th>
      <th>Exchange</th>
      <th>ExchangeType</th>
      <th>High</th>
      <th>LastQuantity</th>
      <th>LastTradeTime</th>
      <th>LastTradedPrice</th>
      <th>Low</th>
      <th>...</th>
      <th>Open</th>
      <th>OpenInterest</th>
      <th>ScripCode</th>
      <th>SellQuantity</th>
      <th>TotalBuyQuantity</th>
      <th>TotalSellQuantity</th>
      <th>UpperCircuitLimit</th>
      <th>Volume</th>
      <th>Datetime</th>
      <th>Symbol</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2342.62</td>
      <td>0</td>
      <td>2352</td>
      <td>N</td>
      <td>C</td>
      <td>2359</td>
      <td>1</td>
      <td>/Date(1681986517000)/</td>
      <td>2346.05</td>
      <td>2332.1</td>
      <td>...</td>
      <td>2354.1</td>
      <td>0</td>
      <td>2885</td>
      <td>0</td>
      <td>0</td>
      <td>783</td>
      <td>2587.20</td>
      <td>3233882</td>
      <td>2023-04-20 19:37:00.123152</td>
      <td>RELIANCE</td>
    </tr>
    <tr>
      <th>1</th>
      <td>400.07</td>
      <td>0</td>
      <td>398.75</td>
      <td>N</td>
      <td>C</td>
      <td>402.65</td>
      <td>5</td>
      <td>/Date(1681986598000)/</td>
      <td>400.30</td>
      <td>397.7</td>
      <td>...</td>
      <td>400</td>
      <td>0</td>
      <td>1660</td>
      <td>0</td>
      <td>279</td>
      <td>0</td>
      <td>438.60</td>
      <td>6667781</td>
      <td>2023-04-20 19:37:00.123152</td>
      <td>ITC</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3094.25</td>
      <td>0</td>
      <td>3089.6</td>
      <td>N</td>
      <td>C</td>
      <td>3113</td>
      <td>11</td>
      <td>/Date(1681986560000)/</td>
      <td>3104.80</td>
      <td>3078</td>
      <td>...</td>
      <td>3090</td>
      <td>0</td>
      <td>11536</td>
      <td>0</td>
      <td>0</td>
      <td>14</td>
      <td>3398.55</td>
      <td>2419999</td>
      <td>2023-04-20 19:37:00.123152</td>
      <td>TCS</td>
    </tr>
  </tbody>
</table>
<p>3 rows × 23 columns</p>
</div>



### Market Feed


```python
c_5p.get_market_feed(sl1)
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Chg</th>
      <th>ChgPcnt</th>
      <th>Exch</th>
      <th>ExchType</th>
      <th>High</th>
      <th>LastRate</th>
      <th>Low</th>
      <th>PClose</th>
      <th>Symbol</th>
      <th>TickDt</th>
      <th>Time</th>
      <th>Token</th>
      <th>TotalQty</th>
      <th>Datetime</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>-5.95</td>
      <td>-0.252976</td>
      <td>N</td>
      <td>C</td>
      <td>2359.00</td>
      <td>2346.05</td>
      <td>2332.1</td>
      <td>2352.00</td>
      <td>RELIANCE</td>
      <td>/Date(1681986517000+0530)/</td>
      <td>35917</td>
      <td>2885</td>
      <td>3233882</td>
      <td>2023-04-20 19:37:03.343834</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1.55</td>
      <td>0.388715</td>
      <td>N</td>
      <td>C</td>
      <td>402.65</td>
      <td>400.30</td>
      <td>397.7</td>
      <td>398.75</td>
      <td>ITC</td>
      <td>/Date(1681986598000+0530)/</td>
      <td>35998</td>
      <td>1660</td>
      <td>6667781</td>
      <td>2023-04-20 19:37:03.343834</td>
    </tr>
    <tr>
      <th>2</th>
      <td>15.20</td>
      <td>0.491973</td>
      <td>N</td>
      <td>C</td>
      <td>3113.00</td>
      <td>3104.80</td>
      <td>3078.0</td>
      <td>3089.60</td>
      <td>TCS</td>
      <td>/Date(1681986560000+0530)/</td>
      <td>35960</td>
      <td>11536</td>
      <td>2419999</td>
      <td>2023-04-20 19:37:03.343834</td>
    </tr>
  </tbody>
</table>
</div>



### Market Data

For `feed_type='md'`, user gets the data for Buyers and seller for 5 depth. Here, Last traded price is not there.


```python
d1 = c_5p.get_market_data(sl1,feed_type='md')
d1
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Exch</th>
      <th>ExchType</th>
      <th>Token</th>
      <th>TBidQ</th>
      <th>TOffQ</th>
      <th>Details</th>
      <th>TimeStamp</th>
      <th>Time</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>N</td>
      <td>C</td>
      <td>2885</td>
      <td>0</td>
      <td>783</td>
      <td>[{'Quantity': 0, 'Price': 0, 'NumberOfOrders':...</td>
      <td>0</td>
      <td>/Date(1681986590946)/</td>
    </tr>
    <tr>
      <th>1</th>
      <td>N</td>
      <td>C</td>
      <td>1660</td>
      <td>279</td>
      <td>0</td>
      <td>[{'Quantity': 279, 'Price': 400.3, 'NumberOfOr...</td>
      <td>0</td>
      <td>/Date(1681986598666)/</td>
    </tr>
    <tr>
      <th>2</th>
      <td>N</td>
      <td>C</td>
      <td>11536</td>
      <td>0</td>
      <td>14</td>
      <td>[{'Quantity': 0, 'Price': 0, 'NumberOfOrders':...</td>
      <td>0</td>
      <td>/Date(1681986591595)/</td>
    </tr>
  </tbody>
</table>
</div>



for `feed_type='mf'`, user gets the data for nearest bid and offer and the last traded price.


```python
d1 = c_5p.get_market_data(sl1,feed_type='mf')
d1
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Exch</th>
      <th>ExchType</th>
      <th>Token</th>
      <th>LastRate</th>
      <th>LastQty</th>
      <th>TotalQty</th>
      <th>High</th>
      <th>Low</th>
      <th>OpenRate</th>
      <th>PClose</th>
      <th>AvgRate</th>
      <th>Time</th>
      <th>BidQty</th>
      <th>BidRate</th>
      <th>OffQty</th>
      <th>OffRate</th>
      <th>TBidQ</th>
      <th>TOffQ</th>
      <th>TickDt</th>
      <th>ChgPcnt</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>N</td>
      <td>C</td>
      <td>2885</td>
      <td>2346.05</td>
      <td>1</td>
      <td>3233882</td>
      <td>2359.00</td>
      <td>2332.1</td>
      <td>2354.1</td>
      <td>2352.00</td>
      <td>2342.62</td>
      <td>35918</td>
      <td>0</td>
      <td>0.0</td>
      <td>783</td>
      <td>2346.05</td>
      <td>0</td>
      <td>783</td>
      <td>/Date(1681986518000)/</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>N</td>
      <td>C</td>
      <td>1660</td>
      <td>400.30</td>
      <td>5</td>
      <td>6667781</td>
      <td>402.65</td>
      <td>397.7</td>
      <td>400.0</td>
      <td>398.75</td>
      <td>400.07</td>
      <td>35999</td>
      <td>279</td>
      <td>400.3</td>
      <td>0</td>
      <td>0.00</td>
      <td>279</td>
      <td>0</td>
      <td>/Date(1681986599000)/</td>
      <td>0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>N</td>
      <td>C</td>
      <td>11536</td>
      <td>3104.80</td>
      <td>11</td>
      <td>2419999</td>
      <td>3113.00</td>
      <td>3078.0</td>
      <td>3090.0</td>
      <td>3089.60</td>
      <td>3094.25</td>
      <td>35961</td>
      <td>0</td>
      <td>0.0</td>
      <td>14</td>
      <td>3104.80</td>
      <td>0</td>
      <td>14</td>
      <td>/Date(1681986561000)/</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
</div>



## Getting Option Chain data

For getting option chain data, user needs the expiry date for the option chain. Available expiry dates can be weekly or monthly depending upon the type of security. For indices, the options can have weekly expiry and for all of the stocks the expiry is monthly.


```python
dates1 = c_5p.get_monthly_option_expiry()
dates1 = c_5p.get_weekly_option_expiry()
dates1
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Exch</th>
      <th>ExchType</th>
      <th>ExpiryDate</th>
      <th>Timestamp</th>
      <th>Date</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>N</td>
      <td>D</td>
      <td>/Date(1681981200000+0530)/</td>
      <td>1681981200000</td>
      <td>2023-04-20</td>
    </tr>
    <tr>
      <th>1</th>
      <td>N</td>
      <td>D</td>
      <td>/Date(1682586000000+0530)/</td>
      <td>1682586000000</td>
      <td>2023-04-27</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>5</th>
      <td>N</td>
      <td>D</td>
      <td>/Date(1685005200000+0530)/</td>
      <td>1685005200000</td>
      <td>2023-05-25</td>
    </tr>
    <tr>
      <th>6</th>
      <td>N</td>
      <td>D</td>
      <td>/Date(1688029200000+0530)/</td>
      <td>1688029200000</td>
      <td>2023-06-29</td>
    </tr>
  </tbody>
</table>
<p>7 rows × 5 columns</p>
</div>




```python
c_5p.get_option_chain(sl1[0],'2023-04-27')
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>CPType</th>
      <th>ChangeInOI</th>
      <th>EXCH</th>
      <th>ExchType</th>
      <th>LastRate</th>
      <th>Name</th>
      <th>OpenInterest</th>
      <th>Prev_OI</th>
      <th>PreviousClose</th>
      <th>ScripCode</th>
      <th>StrikeRate</th>
      <th>Volume</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>CE</td>
      <td>0</td>
      <td>N</td>
      <td>D</td>
      <td>0.0</td>
      <td>RELIANCE 27 APR 2023 CE 1160.00</td>
      <td>0</td>
      <td>0</td>
      <td>0.0</td>
      <td>55506</td>
      <td>1160</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>PE</td>
      <td>0</td>
      <td>N</td>
      <td>D</td>
      <td>0.0</td>
      <td>RELIANCE 27 APR 2023 PE 1160.00</td>
      <td>0</td>
      <td>0</td>
      <td>0.0</td>
      <td>55507</td>
      <td>1160</td>
      <td>0</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>232</th>
      <td>CE</td>
      <td>0</td>
      <td>N</td>
      <td>D</td>
      <td>0.0</td>
      <td>RELIANCE 27 APR 2023 CE 3480.00</td>
      <td>0</td>
      <td>0</td>
      <td>0.0</td>
      <td>41363</td>
      <td>3480</td>
      <td>0</td>
    </tr>
    <tr>
      <th>233</th>
      <td>PE</td>
      <td>0</td>
      <td>N</td>
      <td>D</td>
      <td>0.0</td>
      <td>RELIANCE 27 APR 2023 PE 3480.00</td>
      <td>0</td>
      <td>0</td>
      <td>0.0</td>
      <td>41366</td>
      <td>3480</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
<p>234 rows × 12 columns</p>
</div>



---
---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dev-ddr/finmetry",
    "name": "finmetry",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6, <4",
    "maintainer_email": "",
    "keywords": "stock market,market,finanace,investment",
    "author": "Darshan Rathod, Sachin K S",
    "author_email": "darshan.rathod1994@gmail.com, sachinks@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/4b/387641e1a2be54f5f91db01ec13ae60620b8cfa128aec71b67bab8666f50/finmetry-0.1.7.tar.gz",
    "platform": null,
    "description": "# Finmetry\n\nThis is the project on stock market data analysis using modern data anlysis tools, AI and ML.\n\nIn depth tests on various stock market tools are conducted.\n\n## The current version is\n\n    0.1.7\n    \n\n# Importing and initiating\n\n\n```python\n%load_ext autoreload\n\n%autoreload 2\nimport finmetry as fm\n\nimport pandas as pd\npd.set_option('display.max_rows', 5)\npd.set_option('display.max_columns', 20)\nimport numpy as np\nimport datetime as dtm\n```\n\nThe API has `Stock` class which helps in managing the data related to any security. Clients are classes of various data providing external libraries such as `py5paisa, yfinance ` etc. finmetry API has the class based of the python API of such external libraries for ease of use with `Stock` class. This version of finmetry is mainly developed around client `py5paisa`, as it provieds enough data for in-depth market analysis.\n\n## Initializing Stock\n\n`Stock` class API provides handy tools for managing various data provided by clients. The `Stock` instance is provided to various clients which will then download the data for those stocks. There are multiple clients which provide variety of data on security. Further information on these can be found on specific module or through help of specific methods. The information about intializing Client5paisa can be found [here](#Client5paisa).\n\nThe `Stock` class consists of various methods to get historical data and managing the local storage of data. If the `store_local` is `False` then no local storage is done. It is advisable to keep a folder for market data which can be provided to `Stock` class for proper handling. Also, if the historical data is already downloaded then this helps in directly accesing offline data instead of downloading it again.\n\n\n```python\nfrom finmetry import Stock\n\nmarket_foldpath = r\"D:\\Finmetry\\local_data\"\n\ns1 = Stock(\n    symbol=\"RELIANCE\",\n    exchange=\"N\",\n    exchange_type=\"C\",\n    store_local=True,\n    local_data_foldpath=market_foldpath,\n)\n```\n\nAs `store_local = True`, Folder with name `RELIANCE` is created. Now all the historical and other types of data will be stored in this folder. If there is already some historical data downloaded then API would directly access that data.\n\n## <a id=\"Client5paisa\"></a>Intitalizing Client5paisa\n\n`Client5paisa` is the class derived from `py5paisa.FivePaisaClient`. This is done to ease the data handling process.\n\nFirst, we will initialize `Client5paisa` which will be used for data downloading for various stocks. For this the user needs 5paisa account and the API keys. User can refer to [py5paisa](https://github.com/5paisa/py5paisa) for further details on getting API credentials. User need, API credentials (`cred`), email-id (`email`), password (`password`) of 5paisa account and date of birth (`dob`). Here, the credentials are already loaded on variables and not shown for security reasons.\n\n\n```python\nc_5p = fm.client_5paisa.Client5paisa(email=email, password=password, dob=dob, cred=cred)\n```\n\n     19:32:23 | Logged in!!\n    \n\n### ScripMaster\n\npy5paisa provides the .csv file containing symbols and other information of majority of the Indian securities. The file is around 40Mb (while writing this and may vary in future) which may take about few seconds to download depending upon the internet speed. It is advisable to save it offline and use that .csv again for faster intialization. The local file should be updated often for any changes in .csv file, if any.\n\n#### Downloading the file\n\n\n```python\nscrip_master = fm.client_5paisa.ScripMaster()\n```\n\n#### Save the file locally\n\n\n```python\nscrip_master_filepath = r\"D:\\Finmetry\\local_data\\scrip_master.csv\"\nscrip_master.save(scrip_master_filepath)\n```\n\n#### Loading from local file\n\n\n```python\nscrip_master_filepath = r\"D:\\Finmetry\\local_data\\scrip_master.csv\"\nscrip_master = fm.client_5paisa.ScripMaster(filepath=scrip_master_filepath)\nscrip_master.data\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Exch</th>\n      <th>ExchType</th>\n      <th>Scripcode</th>\n      <th>Name</th>\n      <th>Series</th>\n      <th>Expiry</th>\n      <th>...</th>\n      <th>Multiplier</th>\n      <th>Underlyer</th>\n      <th>Root</th>\n      <th>TickSize</th>\n      <th>CO BO Allowed</th>\n      <th>Symbol</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>B</td>\n      <td>C</td>\n      <td>199117</td>\n      <td>SETFN50INAV</td>\n      <td>EQ</td>\n      <td>1980-01-01 00:00:00</td>\n      <td>...</td>\n      <td>1</td>\n      <td>NaN</td>\n      <td>SETFN50INAV</td>\n      <td>0.01</td>\n      <td>N</td>\n      <td>SETFN50INAV</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>B</td>\n      <td>C</td>\n      <td>199118</td>\n      <td>MOHEALTINAV</td>\n      <td>EQ</td>\n      <td>1980-01-01 00:00:00</td>\n      <td>...</td>\n      <td>1</td>\n      <td>NaN</td>\n      <td>MOHEALTINAV</td>\n      <td>0.01</td>\n      <td>N</td>\n      <td>MOHEALTINAV</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>202732</th>\n      <td>M</td>\n      <td>D</td>\n      <td>256029</td>\n      <td>NATURALGAS 23 JUN 2023 CE 130.00              ...</td>\n      <td></td>\n      <td>2023-06-23 23:59:59</td>\n      <td>...</td>\n      <td>1</td>\n      <td>23 Jun 2023</td>\n      <td>NATURALGAS</td>\n      <td>0.05</td>\n      <td>Y</td>\n      <td>NATURALGAS 23 JUN 2023 CE 130.00              ...</td>\n    </tr>\n    <tr>\n      <th>202733</th>\n      <td>M</td>\n      <td>D</td>\n      <td>256030</td>\n      <td>NATURALGAS 23 JUN 2023 PE 130.00              ...</td>\n      <td></td>\n      <td>2023-06-23 23:59:59</td>\n      <td>...</td>\n      <td>1</td>\n      <td>23 Jun 2023</td>\n      <td>NATURALGAS</td>\n      <td>0.05</td>\n      <td>Y</td>\n      <td>NATURALGAS 23 JUN 2023 PE 130.00              ...</td>\n    </tr>\n  </tbody>\n</table>\n<p>202734 rows \u00d7 20 columns</p>\n</div>\n\n\n\nUser can repeat the process of downloading and saving to update the local file. This `scrip_master` will be used for generating various inputs for data fatching methods. The `Exch, ExchType, Scripcode` are some of the parameters required to get the market data of various securities. Hence this `scrip_master` should be provided to client_5paisa instance (i.e, `c_5p`).\n\n#### Provide scrip_master to Client5paisa\n\n\n```python\nc_5p.scrip_master = scrip_master\n```\n\nUser can also provide the `scrip_master` instance during initialization of `Client5paisa` class.\n\n\n```python\nc_5p = fm.client_5paisa.Client5paisa(\n    email=email, password=password, dob=dob, cred=cred, scrip_master=scrip_master\n)\n```\n\n## Historical data\n\nHistorical data for list of stocks can be downloaded using `c_5p.download_historical_data`. If `Stock.store_local is True` then the data will be stored locally with separate file for each months data.\n\n\n```python\nsyms = [\"RELIANCE\", \"ITC\", \"TCS\"]\nsl1 = []\nfor sym in syms:\n    s1 = Stock(\n        symbol=sym.upper(),\n        exchange=\"N\",\n        exchange_type=\"C\",\n        store_local=True,\n        local_data_foldpath=market_foldpath,\n    )\n    sl1.append(s1)\n```\n\n\n```python\nc_5p.download_historical_data(\n    stocklist=sl1, interval=\"1m\", start=\"2019-04-1\", end=\"2019-04-30\"\n)\n```\n\n### Accessing local data\n\nStock class has the method to access the data stored locally.\n\n\n```python\ns1 = sl1[0]\ndata = s1.load_historical_data(interval=\"1m\", start=\"2019-04-1\", end=\"2019-04-30\")\ndata\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Open</th>\n      <th>High</th>\n      <th>Low</th>\n      <th>Close</th>\n      <th>Volume</th>\n    </tr>\n    <tr>\n      <th>Datetime</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>2019-04-01 09:15:00</th>\n      <td>1371.00</td>\n      <td>1373.15</td>\n      <td>1369.50</td>\n      <td>1370.10</td>\n      <td>73889</td>\n    </tr>\n    <tr>\n      <th>2019-04-01 09:16:00</th>\n      <td>1370.30</td>\n      <td>1370.75</td>\n      <td>1368.90</td>\n      <td>1369.00</td>\n      <td>45357</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>2019-04-30 15:29:00</th>\n      <td>1392.15</td>\n      <td>1393.00</td>\n      <td>1391.00</td>\n      <td>1393.00</td>\n      <td>33141</td>\n    </tr>\n    <tr>\n      <th>2019-04-30 15:30:00</th>\n      <td>1392.45</td>\n      <td>1392.45</td>\n      <td>1392.45</td>\n      <td>1392.45</td>\n      <td>25</td>\n    </tr>\n  </tbody>\n</table>\n<p>7137 rows \u00d7 5 columns</p>\n</div>\n\n\n\n## Live Market Data\n\nVarious live market data is provided by py5paisa, like Market Depth and Market Feed.\n\n### Market Depth\n\n\n```python\nd1 = c_5p.get_market_depth(sl1)\nd1\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>AverageTradePrice</th>\n      <th>BuyQuantity</th>\n      <th>Close</th>\n      <th>Exchange</th>\n      <th>ExchangeType</th>\n      <th>High</th>\n      <th>LastQuantity</th>\n      <th>LastTradeTime</th>\n      <th>LastTradedPrice</th>\n      <th>Low</th>\n      <th>...</th>\n      <th>Open</th>\n      <th>OpenInterest</th>\n      <th>ScripCode</th>\n      <th>SellQuantity</th>\n      <th>TotalBuyQuantity</th>\n      <th>TotalSellQuantity</th>\n      <th>UpperCircuitLimit</th>\n      <th>Volume</th>\n      <th>Datetime</th>\n      <th>Symbol</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2342.62</td>\n      <td>0</td>\n      <td>2352</td>\n      <td>N</td>\n      <td>C</td>\n      <td>2359</td>\n      <td>1</td>\n      <td>/Date(1681986517000)/</td>\n      <td>2346.05</td>\n      <td>2332.1</td>\n      <td>...</td>\n      <td>2354.1</td>\n      <td>0</td>\n      <td>2885</td>\n      <td>0</td>\n      <td>0</td>\n      <td>783</td>\n      <td>2587.20</td>\n      <td>3233882</td>\n      <td>2023-04-20 19:37:00.123152</td>\n      <td>RELIANCE</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>400.07</td>\n      <td>0</td>\n      <td>398.75</td>\n      <td>N</td>\n      <td>C</td>\n      <td>402.65</td>\n      <td>5</td>\n      <td>/Date(1681986598000)/</td>\n      <td>400.30</td>\n      <td>397.7</td>\n      <td>...</td>\n      <td>400</td>\n      <td>0</td>\n      <td>1660</td>\n      <td>0</td>\n      <td>279</td>\n      <td>0</td>\n      <td>438.60</td>\n      <td>6667781</td>\n      <td>2023-04-20 19:37:00.123152</td>\n      <td>ITC</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3094.25</td>\n      <td>0</td>\n      <td>3089.6</td>\n      <td>N</td>\n      <td>C</td>\n      <td>3113</td>\n      <td>11</td>\n      <td>/Date(1681986560000)/</td>\n      <td>3104.80</td>\n      <td>3078</td>\n      <td>...</td>\n      <td>3090</td>\n      <td>0</td>\n      <td>11536</td>\n      <td>0</td>\n      <td>0</td>\n      <td>14</td>\n      <td>3398.55</td>\n      <td>2419999</td>\n      <td>2023-04-20 19:37:00.123152</td>\n      <td>TCS</td>\n    </tr>\n  </tbody>\n</table>\n<p>3 rows \u00d7 23 columns</p>\n</div>\n\n\n\n### Market Feed\n\n\n```python\nc_5p.get_market_feed(sl1)\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Chg</th>\n      <th>ChgPcnt</th>\n      <th>Exch</th>\n      <th>ExchType</th>\n      <th>High</th>\n      <th>LastRate</th>\n      <th>Low</th>\n      <th>PClose</th>\n      <th>Symbol</th>\n      <th>TickDt</th>\n      <th>Time</th>\n      <th>Token</th>\n      <th>TotalQty</th>\n      <th>Datetime</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>-5.95</td>\n      <td>-0.252976</td>\n      <td>N</td>\n      <td>C</td>\n      <td>2359.00</td>\n      <td>2346.05</td>\n      <td>2332.1</td>\n      <td>2352.00</td>\n      <td>RELIANCE</td>\n      <td>/Date(1681986517000+0530)/</td>\n      <td>35917</td>\n      <td>2885</td>\n      <td>3233882</td>\n      <td>2023-04-20 19:37:03.343834</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1.55</td>\n      <td>0.388715</td>\n      <td>N</td>\n      <td>C</td>\n      <td>402.65</td>\n      <td>400.30</td>\n      <td>397.7</td>\n      <td>398.75</td>\n      <td>ITC</td>\n      <td>/Date(1681986598000+0530)/</td>\n      <td>35998</td>\n      <td>1660</td>\n      <td>6667781</td>\n      <td>2023-04-20 19:37:03.343834</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>15.20</td>\n      <td>0.491973</td>\n      <td>N</td>\n      <td>C</td>\n      <td>3113.00</td>\n      <td>3104.80</td>\n      <td>3078.0</td>\n      <td>3089.60</td>\n      <td>TCS</td>\n      <td>/Date(1681986560000+0530)/</td>\n      <td>35960</td>\n      <td>11536</td>\n      <td>2419999</td>\n      <td>2023-04-20 19:37:03.343834</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\n### Market Data\n\nFor `feed_type='md'`, user gets the data for Buyers and seller for 5 depth. Here, Last traded price is not there.\n\n\n```python\nd1 = c_5p.get_market_data(sl1,feed_type='md')\nd1\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Exch</th>\n      <th>ExchType</th>\n      <th>Token</th>\n      <th>TBidQ</th>\n      <th>TOffQ</th>\n      <th>Details</th>\n      <th>TimeStamp</th>\n      <th>Time</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>N</td>\n      <td>C</td>\n      <td>2885</td>\n      <td>0</td>\n      <td>783</td>\n      <td>[{'Quantity': 0, 'Price': 0, 'NumberOfOrders':...</td>\n      <td>0</td>\n      <td>/Date(1681986590946)/</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>N</td>\n      <td>C</td>\n      <td>1660</td>\n      <td>279</td>\n      <td>0</td>\n      <td>[{'Quantity': 279, 'Price': 400.3, 'NumberOfOr...</td>\n      <td>0</td>\n      <td>/Date(1681986598666)/</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>N</td>\n      <td>C</td>\n      <td>11536</td>\n      <td>0</td>\n      <td>14</td>\n      <td>[{'Quantity': 0, 'Price': 0, 'NumberOfOrders':...</td>\n      <td>0</td>\n      <td>/Date(1681986591595)/</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\nfor `feed_type='mf'`, user gets the data for nearest bid and offer and the last traded price.\n\n\n```python\nd1 = c_5p.get_market_data(sl1,feed_type='mf')\nd1\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Exch</th>\n      <th>ExchType</th>\n      <th>Token</th>\n      <th>LastRate</th>\n      <th>LastQty</th>\n      <th>TotalQty</th>\n      <th>High</th>\n      <th>Low</th>\n      <th>OpenRate</th>\n      <th>PClose</th>\n      <th>AvgRate</th>\n      <th>Time</th>\n      <th>BidQty</th>\n      <th>BidRate</th>\n      <th>OffQty</th>\n      <th>OffRate</th>\n      <th>TBidQ</th>\n      <th>TOffQ</th>\n      <th>TickDt</th>\n      <th>ChgPcnt</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>N</td>\n      <td>C</td>\n      <td>2885</td>\n      <td>2346.05</td>\n      <td>1</td>\n      <td>3233882</td>\n      <td>2359.00</td>\n      <td>2332.1</td>\n      <td>2354.1</td>\n      <td>2352.00</td>\n      <td>2342.62</td>\n      <td>35918</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>783</td>\n      <td>2346.05</td>\n      <td>0</td>\n      <td>783</td>\n      <td>/Date(1681986518000)/</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>N</td>\n      <td>C</td>\n      <td>1660</td>\n      <td>400.30</td>\n      <td>5</td>\n      <td>6667781</td>\n      <td>402.65</td>\n      <td>397.7</td>\n      <td>400.0</td>\n      <td>398.75</td>\n      <td>400.07</td>\n      <td>35999</td>\n      <td>279</td>\n      <td>400.3</td>\n      <td>0</td>\n      <td>0.00</td>\n      <td>279</td>\n      <td>0</td>\n      <td>/Date(1681986599000)/</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>N</td>\n      <td>C</td>\n      <td>11536</td>\n      <td>3104.80</td>\n      <td>11</td>\n      <td>2419999</td>\n      <td>3113.00</td>\n      <td>3078.0</td>\n      <td>3090.0</td>\n      <td>3089.60</td>\n      <td>3094.25</td>\n      <td>35961</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>14</td>\n      <td>3104.80</td>\n      <td>0</td>\n      <td>14</td>\n      <td>/Date(1681986561000)/</td>\n      <td>0</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\n## Getting Option Chain data\n\nFor getting option chain data, user needs the expiry date for the option chain. Available expiry dates can be weekly or monthly depending upon the type of security. For indices, the options can have weekly expiry and for all of the stocks the expiry is monthly.\n\n\n```python\ndates1 = c_5p.get_monthly_option_expiry()\ndates1 = c_5p.get_weekly_option_expiry()\ndates1\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Exch</th>\n      <th>ExchType</th>\n      <th>ExpiryDate</th>\n      <th>Timestamp</th>\n      <th>Date</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>N</td>\n      <td>D</td>\n      <td>/Date(1681981200000+0530)/</td>\n      <td>1681981200000</td>\n      <td>2023-04-20</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>N</td>\n      <td>D</td>\n      <td>/Date(1682586000000+0530)/</td>\n      <td>1682586000000</td>\n      <td>2023-04-27</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>N</td>\n      <td>D</td>\n      <td>/Date(1685005200000+0530)/</td>\n      <td>1685005200000</td>\n      <td>2023-05-25</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>N</td>\n      <td>D</td>\n      <td>/Date(1688029200000+0530)/</td>\n      <td>1688029200000</td>\n      <td>2023-06-29</td>\n    </tr>\n  </tbody>\n</table>\n<p>7 rows \u00d7 5 columns</p>\n</div>\n\n\n\n\n```python\nc_5p.get_option_chain(sl1[0],'2023-04-27')\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>CPType</th>\n      <th>ChangeInOI</th>\n      <th>EXCH</th>\n      <th>ExchType</th>\n      <th>LastRate</th>\n      <th>Name</th>\n      <th>OpenInterest</th>\n      <th>Prev_OI</th>\n      <th>PreviousClose</th>\n      <th>ScripCode</th>\n      <th>StrikeRate</th>\n      <th>Volume</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>CE</td>\n      <td>0</td>\n      <td>N</td>\n      <td>D</td>\n      <td>0.0</td>\n      <td>RELIANCE 27 APR 2023 CE 1160.00</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>55506</td>\n      <td>1160</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>PE</td>\n      <td>0</td>\n      <td>N</td>\n      <td>D</td>\n      <td>0.0</td>\n      <td>RELIANCE 27 APR 2023 PE 1160.00</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>55507</td>\n      <td>1160</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>232</th>\n      <td>CE</td>\n      <td>0</td>\n      <td>N</td>\n      <td>D</td>\n      <td>0.0</td>\n      <td>RELIANCE 27 APR 2023 CE 3480.00</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>41363</td>\n      <td>3480</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>233</th>\n      <td>PE</td>\n      <td>0</td>\n      <td>N</td>\n      <td>D</td>\n      <td>0.0</td>\n      <td>RELIANCE 27 APR 2023 PE 3480.00</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0.0</td>\n      <td>41366</td>\n      <td>3480</td>\n      <td>0</td>\n    </tr>\n  </tbody>\n</table>\n<p>234 rows \u00d7 12 columns</p>\n</div>\n\n\n\n---\n---\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Stock market data analysis",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/dev-ddr/finmetry"
    },
    "split_keywords": [
        "stock market",
        "market",
        "finanace",
        "investment"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eee7f9bceee40ad3e99b84d3be198fca6fc67758c2aa2cee26e3b6020a13aa57",
                "md5": "4c15fb4e74ee1bbec4c855d3a07de749",
                "sha256": "431b15ed7e06e9752287012075f439f94d0a67c9e6af8b7911d70d3e320d54b2"
            },
            "downloads": -1,
            "filename": "finmetry-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c15fb4e74ee1bbec4c855d3a07de749",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6, <4",
            "size": 14729,
            "upload_time": "2023-08-31T06:28:29",
            "upload_time_iso_8601": "2023-08-31T06:28:29.105941Z",
            "url": "https://files.pythonhosted.org/packages/ee/e7/f9bceee40ad3e99b84d3be198fca6fc67758c2aa2cee26e3b6020a13aa57/finmetry-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c4b387641e1a2be54f5f91db01ec13ae60620b8cfa128aec71b67bab8666f50",
                "md5": "8b0da83216e8ef5ad52acdaa36a5d69e",
                "sha256": "744977db4ec12697e363d21b5e9cd06a7065e2090c743b7a2f59ee6c69195cf3"
            },
            "downloads": -1,
            "filename": "finmetry-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "8b0da83216e8ef5ad52acdaa36a5d69e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6, <4",
            "size": 18284,
            "upload_time": "2023-08-31T06:28:30",
            "upload_time_iso_8601": "2023-08-31T06:28:30.892780Z",
            "url": "https://files.pythonhosted.org/packages/5c/4b/387641e1a2be54f5f91db01ec13ae60620b8cfa128aec71b67bab8666f50/finmetry-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-31 06:28:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dev-ddr",
    "github_project": "finmetry",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "finmetry"
}
        
Elapsed time: 0.13907s