pyfin-trading


Namepyfin-trading JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryMaking Finance easy in Python!
upload_time2023-12-26 14:57:48
maintainer
docs_urlNone
authorPoonam Deshmukh
requires_python
license
keywords python finance algorithmic trading technical indicators
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Package for analyzing and visualizing financial time-series data

Developed by Poonam Deshmukh (c) 2023.

---

#### Requirements

`pyfin_trading` would need the following libraries to be installed

- `pandas`
- `numpy`
- `yfinance`
- `datetime`


#### Installation

You can install it via pip:

```bash
pip install pyfin-trading
```

#### Modules
- `stock_data`
- `stats`
- `indicators`

### 1. stock_data

This module majorly helps with getting stock data and can be accessed as follows:

```python
from pyfin_trading import stock_data as sd

df = sd.get_data(ticker, start_date, end_date, interval)
```
<br> - Input ticker symbol along with its corresponding exchange. <br> - Format for start_date & end_date must be "%Y-%m-%d" <br> - By default end_date is set to today <br> - Interval can take values like "1m", "2m", "5m", "15m", "30m", "60m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo" <br> &nbsp; where m = minute, h = hour, d = day, wk = week, mo = month <br> - By default interval is set to "1d"

### Example
```python
df = sd.get_data("ITC.NS", "2023-11-06")
```
This will return ITC's data from NSE spanning from 6th Nov 2023 to present day with interval set to daily

### 2. stats

It helps with calculating returns as well as some financial ratios:

```python
from pyfin_trading import stats as st

returns = st.calculate_returns(df) # Calculates Daily & Cumulative Returns
st.beta(df, market, interval)
st.volatility(df, trading_days = 252) # Calculates SD & Annualized Volatility
st.sharpe(df, risk, trading_days = 252) # Sharpe Ratio
st.sortino(df, risk, trading_days = 252) # Sortino Ratio
st.alpha(df, market, interval, beta, risk)
st.treynor(df, beta, risk, trading_days = 252) # Treynor Ratio
st.info(df, market, interval, risk, trading_days = 252) # Information Ratio
```
<br> - By default Nifty 50 is used as a proxy for the market i.e. "^NSEI"

### 3. indicators

For calculating technical indicators:

```python
from pyfin_trading import indicators as pt

pt.sma(df, sma_period = 15) 
pt.ema(df, ema_period = 15, adjust = False)
pt.rsi(df, rsi_period = 14)
pt.connors_rsi(df, rsi_period = 14, updown_length = 2)
pt.stoch(df, k = 14, d = 3) # Stochastic Oscillator
pt.bollinger_bands(df, sma_period = 20, std_dev = 2) # Bollinger Bands
pt.aroon(df, aroon_period = 25) # Aroon Oscillator
pt.macd(df, short_period = 12, long_period = 26, signal = 9, adjust = False) # Moving Average Convergence Divergence
pt.ichimoku_cloud(df, conversion = 9, base = 26, lead_b = 52) # Ichimoku Cloud
```


---

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyfin-trading",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,finance,algorithmic trading,technical indicators",
    "author": "Poonam Deshmukh",
    "author_email": "poonamdeshmukh616@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/76/74db70f780b72950324de5f0c68d6ec839bdfe32e655eed814d3a76615c1/pyfin_trading-1.0.0.tar.gz",
    "platform": null,
    "description": "## Package for analyzing and visualizing financial time-series data\n\nDeveloped by Poonam Deshmukh (c) 2023.\n\n---\n\n#### Requirements\n\n`pyfin_trading` would need the following libraries to be installed\n\n- `pandas`\n- `numpy`\n- `yfinance`\n- `datetime`\n\n\n#### Installation\n\nYou can install it via pip:\n\n```bash\npip install pyfin-trading\n```\n\n#### Modules\n- `stock_data`\n- `stats`\n- `indicators`\n\n### 1. stock_data\n\nThis module majorly helps with getting stock data and can be accessed as follows:\n\n```python\nfrom pyfin_trading import stock_data as sd\n\ndf = sd.get_data(ticker, start_date, end_date, interval)\n```\n<br> - Input ticker symbol along with its corresponding exchange. <br> - Format for start_date & end_date must be \"%Y-%m-%d\" <br> - By default end_date is set to today <br> - Interval can take values like \"1m\", \"2m\", \"5m\", \"15m\", \"30m\", \"60m\", \"90m\", \"1h\", \"1d\", \"5d\", \"1wk\", \"1mo\", \"3mo\" <br> &nbsp; where m = minute, h = hour, d = day, wk = week, mo = month <br> - By default interval is set to \"1d\"\n\n### Example\n```python\ndf = sd.get_data(\"ITC.NS\", \"2023-11-06\")\n```\nThis will return ITC's data from NSE spanning from 6th Nov 2023 to present day with interval set to daily\n\n### 2. stats\n\nIt helps with calculating returns as well as some financial ratios:\n\n```python\nfrom pyfin_trading import stats as st\n\nreturns = st.calculate_returns(df) # Calculates Daily & Cumulative Returns\nst.beta(df, market, interval)\nst.volatility(df, trading_days = 252) # Calculates SD & Annualized Volatility\nst.sharpe(df, risk, trading_days = 252) # Sharpe Ratio\nst.sortino(df, risk, trading_days = 252) # Sortino Ratio\nst.alpha(df, market, interval, beta, risk)\nst.treynor(df, beta, risk, trading_days = 252) # Treynor Ratio\nst.info(df, market, interval, risk, trading_days = 252) # Information Ratio\n```\n<br> - By default Nifty 50 is used as a proxy for the market i.e. \"^NSEI\"\n\n### 3. indicators\n\nFor calculating technical indicators:\n\n```python\nfrom pyfin_trading import indicators as pt\n\npt.sma(df, sma_period = 15) \npt.ema(df, ema_period = 15, adjust = False)\npt.rsi(df, rsi_period = 14)\npt.connors_rsi(df, rsi_period = 14, updown_length = 2)\npt.stoch(df, k = 14, d = 3) # Stochastic Oscillator\npt.bollinger_bands(df, sma_period = 20, std_dev = 2) # Bollinger Bands\npt.aroon(df, aroon_period = 25) # Aroon Oscillator\npt.macd(df, short_period = 12, long_period = 26, signal = 9, adjust = False) # Moving Average Convergence Divergence\npt.ichimoku_cloud(df, conversion = 9, base = 26, lead_b = 52) # Ichimoku Cloud\n```\n\n\n---\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Making Finance easy in Python!",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "finance",
        "algorithmic trading",
        "technical indicators"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6c746bd979e23527578eb70cd19e741cabeba3632a84fba999066fe8a5740f4",
                "md5": "ec0fc55bbb7928f055081b958b495eec",
                "sha256": "612510050ea358ad486483c55fb587384e46d5f393bb773234ea6cb16a1a8454"
            },
            "downloads": -1,
            "filename": "pyfin_trading-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ec0fc55bbb7928f055081b958b495eec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5957,
            "upload_time": "2023-12-26T14:57:46",
            "upload_time_iso_8601": "2023-12-26T14:57:46.636687Z",
            "url": "https://files.pythonhosted.org/packages/e6/c7/46bd979e23527578eb70cd19e741cabeba3632a84fba999066fe8a5740f4/pyfin_trading-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e67674db70f780b72950324de5f0c68d6ec839bdfe32e655eed814d3a76615c1",
                "md5": "c027fa3142a4f729a07ca9a05e531c78",
                "sha256": "7ef6d806fbeba9dc7bfd9beb3535942091a0efee907ba820a3550a4e3bccb36c"
            },
            "downloads": -1,
            "filename": "pyfin_trading-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c027fa3142a4f729a07ca9a05e531c78",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4977,
            "upload_time": "2023-12-26T14:57:48",
            "upload_time_iso_8601": "2023-12-26T14:57:48.438068Z",
            "url": "https://files.pythonhosted.org/packages/e6/76/74db70f780b72950324de5f0c68d6ec839bdfe32e655eed814d3a76615c1/pyfin_trading-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-26 14:57:48",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyfin-trading"
}
        
Elapsed time: 0.51206s