alphatools-jv


Namealphatools-jv JSON
Version 3.4.1 PyPI version JSON
download
home_pagehttps://github.com/jaskirat1208/backtest-platform
SummaryWrapper over angel broking smartapi to read cached options market data
upload_time2023-07-17 23:53:36
maintainer
docs_urlNone
authorJaskirat Singh
requires_python
license
keywords
VCS
bugtrack_url
requirements twine wheel smartapi-python websocket-client multipledispatch mintotp requests pandas setuptools python-semantic-release
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # About project
A small wrapper over smartapi to backtest basic trading strategies. 
Easy installation and usage

# Installation
```
pip install alphatools_jv
```

# Usage
## Creating and running a strategy
```python
from alphatools.backtesting_app import BackTestingApp
from datetime import datetime

class TestSmartApiApp(BackTestingApp):

    def on_md(self, data_row):
        # your strat code goes here
        print("New row found: {}".format(data_row))


app = TestSmartApiApp('/Users/jaskiratsingh/projects/smart-api-creds.ini')
app.set_start_date(datetime.strptime('2022-12-20 11:39:00+05:30', '%Y-%m-%d %H:%M:%S%z'))
app.set_end_date(datetime.strptime('2022-12-29 11:39:00+05:30', '%Y-%m-%d %H:%M:%S%z'))
app.set_interval('ONE_MINUTE')
app.add_instrument(53825, "NFO")
app.add_instrument(48756, "NFO")
app.load_data()                     # Loads the data into a dataframe
app.get_candle_info_df()            # Returns the entire simulation dataframe
app.simulate()                      # Starts simulation from the beginning

# To place a trade, use trade api to send the orders to the pnl calculator. 
# Pnl calculator uses last tick prices to calculate the observed Pnl
app.trade(53825, 1)     # Buys 1 unit for token 53825
app.trade(53825, -3)    # Sells 3 units for token 53825
app.get_total_pnl()     # Returns pnl after all trades are made
```

## Helper for instruments
```python
from alphatools.utils.token_manager import TokenManager

tok = TokenManager()

# Refer documentation for more overrides
info = tok.get_instrument(53825) # Returns instrument info
info = tok.get_instrument('NIFTY23FEB23FUT') # Returns instrument info
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jaskirat1208/backtest-platform",
    "name": "alphatools-jv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jaskirat Singh",
    "author_email": "jaskiratsingh1208@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ee/3c/d52ba8e78352533f64d560231b33c5a82dd4829ad1175ffc7c152dc6ec51/alphatools_jv-3.4.1.tar.gz",
    "platform": null,
    "description": "# About project\nA small wrapper over smartapi to backtest basic trading strategies. \nEasy installation and usage\n\n# Installation\n```\npip install alphatools_jv\n```\n\n# Usage\n## Creating and running a strategy\n```python\nfrom alphatools.backtesting_app import BackTestingApp\nfrom datetime import datetime\n\nclass TestSmartApiApp(BackTestingApp):\n\n    def on_md(self, data_row):\n        # your strat code goes here\n        print(\"New row found: {}\".format(data_row))\n\n\napp = TestSmartApiApp('/Users/jaskiratsingh/projects/smart-api-creds.ini')\napp.set_start_date(datetime.strptime('2022-12-20 11:39:00+05:30', '%Y-%m-%d %H:%M:%S%z'))\napp.set_end_date(datetime.strptime('2022-12-29 11:39:00+05:30', '%Y-%m-%d %H:%M:%S%z'))\napp.set_interval('ONE_MINUTE')\napp.add_instrument(53825, \"NFO\")\napp.add_instrument(48756, \"NFO\")\napp.load_data()                     # Loads the data into a dataframe\napp.get_candle_info_df()            # Returns the entire simulation dataframe\napp.simulate()                      # Starts simulation from the beginning\n\n# To place a trade, use trade api to send the orders to the pnl calculator. \n# Pnl calculator uses last tick prices to calculate the observed Pnl\napp.trade(53825, 1)     # Buys 1 unit for token 53825\napp.trade(53825, -3)    # Sells 3 units for token 53825\napp.get_total_pnl()     # Returns pnl after all trades are made\n```\n\n## Helper for instruments\n```python\nfrom alphatools.utils.token_manager import TokenManager\n\ntok = TokenManager()\n\n# Refer documentation for more overrides\ninfo = tok.get_instrument(53825) # Returns instrument info\ninfo = tok.get_instrument('NIFTY23FEB23FUT') # Returns instrument info\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Wrapper over angel broking smartapi to read cached options market data",
    "version": "3.4.1",
    "project_urls": {
        "Homepage": "https://github.com/jaskirat1208/backtest-platform"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b194a695b8074432146d0a4dad3f76279e20e67dee2fbce311ee975ae57907ec",
                "md5": "e796b1483ab15c9e2b4aaf299e7c3002",
                "sha256": "edb12b5ec254119c9b31daa651bd472b689ac6e7a517e293d336b2b042fd93fe"
            },
            "downloads": -1,
            "filename": "alphatools_jv-3.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e796b1483ab15c9e2b4aaf299e7c3002",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14762,
            "upload_time": "2023-07-17T23:53:34",
            "upload_time_iso_8601": "2023-07-17T23:53:34.978711Z",
            "url": "https://files.pythonhosted.org/packages/b1/94/a695b8074432146d0a4dad3f76279e20e67dee2fbce311ee975ae57907ec/alphatools_jv-3.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee3cd52ba8e78352533f64d560231b33c5a82dd4829ad1175ffc7c152dc6ec51",
                "md5": "edc078220cddc43c27d3303c3ed99eae",
                "sha256": "72484d43ebe8c4b56b7b0b9664300c49695f942b75d0ef5eebe6d3715b63704b"
            },
            "downloads": -1,
            "filename": "alphatools_jv-3.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "edc078220cddc43c27d3303c3ed99eae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11340,
            "upload_time": "2023-07-17T23:53:36",
            "upload_time_iso_8601": "2023-07-17T23:53:36.608049Z",
            "url": "https://files.pythonhosted.org/packages/ee/3c/d52ba8e78352533f64d560231b33c5a82dd4829ad1175ffc7c152dc6ec51/alphatools_jv-3.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-17 23:53:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaskirat1208",
    "github_project": "backtest-platform",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "wheel",
            "specs": []
        },
        {
            "name": "smartapi-python",
            "specs": []
        },
        {
            "name": "websocket-client",
            "specs": []
        },
        {
            "name": "multipledispatch",
            "specs": [
                [
                    "~=",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "mintotp",
            "specs": [
                [
                    "~=",
                    "0.3.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "~=",
                    "2.28.1"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "~=",
                    "1.5.2"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "65.5.1"
                ]
            ]
        },
        {
            "name": "python-semantic-release",
            "specs": [
                [
                    "==",
                    "7.19.2"
                ]
            ]
        }
    ],
    "lcname": "alphatools-jv"
}
        
Elapsed time: 0.09520s