turtle-trading


Nameturtle-trading JSON
Version 3.5.1 PyPI version JSON
download
home_page
SummaryA collection of investment tools used by the Turtle Traders.
upload_time2024-02-07 19:01:53
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Gabe Kutner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords investing python trading turtle turtle-trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # turtle-trading
<br>

A Python Package containing a collection of investing tools using the Turtle Traders Original Rules. All code is based on the ideas in [_The Original Turtle Trading Rules_](https://oxfordstrat.com/coasdfASD32/uploads/2016/01/turtle-rules.pdf). 

Download using pip:

```batch
pip install turtle-trading
```

__USAGE__: First, initialize a `DataFrameLoader` class to pass as an argument to most `turtle_trading` functions as shown below.
```python
from turtle_trading import DataFrameLoader

ticker = 'aapl'
dataframe = DataFrameLoader(ticker)
```

### `position_sizing` module
```python
""" using the position_sizing module """
from turtle_trading.position_sizing import getn, getunits

import datetime
date = datetime.date(2023, 11, 10)

getn(dataframe) # >>> 2.7421
getn(dataframe, date=date) # >>> 2.9932

getunits(dataframe=dataframe, account=1000000, n=2.7421) # >>> 20.0475
getunits(dataframe=dataframe, account=1000000, date=date) # >>> 17.9233
```

### `entries` module
```python
""" using the entries module """
from turtle_trading.entries import getentry, addunits

getentry(dataframe=dataframe, system=1) # >>> True
getentry(dataframe=dataframe, system=2) # >>> True

addunits(orig_breakout=310, orig_n=2.50) # >>> [310, 311.25, 312.5, 313.75]
addunits(orig_breakout=310, orig_n=2.50, number_of_units=6) # >>> [310, 311.25, 312.5, 313.75, 315.0, 316.25]

# DISCLAIMER: In the rules, no more than 4 more units are allowed for a single position.
```

### `stops` module
```python 
""" using the stops module """
from turtle_trading.entries import addunits
from turtle_trading.stops import getstops

units = addunits(orig_breakout=28.30, orig_n=1.20) # >>> [28.3, 28.9, 29.5, 30.1]

getstops(stop_system="regular", unit_list=units, orig_n=1.20) # >>> [27.7, 27.7, 27.7, 27.7]
getstops(stop_system="whipsaw", unit_list=units, orig_n=1.20) # >>> [27.7, 28.3, 28.9, 29.5]


gapped_units = [28.3, 28.9, 29.5, 30.8]

getstops(stop_system="regular", unit_list=gapped_units, orig_n=1.20) # >>> [27.7, 27.7, 27.7, 28.4]
getstops(stop_system="whipsaw", unit_list=gapped_units, orig_n=1.20) # >>> [27.7, 28.3, 28.9, 30.2]
```

### `exits` module
```python
import datetime
from turtle_trading.exits import getexit

getexit(dataframe=dataframe, system=1, pos_direction=True) # >>> True

getexit(dataframe=dataframe, system=1, pos_direction=True, date=datetime.date(2023, 11, 10)) # >>> False
```

Official documentation coming soon...

For issues, look [here](https://github.com/gabekutner/turtle-trading/blob/main/.github/ISSUE_TEMPLATE.md).
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "turtle-trading",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "investing,python,trading,turtle,turtle-trading",
    "author": "",
    "author_email": "Gabe Kutner <gabekutner1@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ac/59/fc7a42dee97e009a4496b19990a01790d95bbc4237931ad43de66366c3a6/turtle_trading-3.5.1.tar.gz",
    "platform": null,
    "description": "# turtle-trading\n<br>\n\nA Python Package containing a collection of investing tools using the Turtle Traders Original Rules. All code is based on the ideas in [_The Original Turtle Trading Rules_](https://oxfordstrat.com/coasdfASD32/uploads/2016/01/turtle-rules.pdf). \n\nDownload using pip:\n\n```batch\npip install turtle-trading\n```\n\n__USAGE__: First, initialize a `DataFrameLoader` class to pass as an argument to most `turtle_trading` functions as shown below.\n```python\nfrom turtle_trading import DataFrameLoader\n\nticker = 'aapl'\ndataframe = DataFrameLoader(ticker)\n```\n\n### `position_sizing` module\n```python\n\"\"\" using the position_sizing module \"\"\"\nfrom turtle_trading.position_sizing import getn, getunits\n\nimport datetime\ndate = datetime.date(2023, 11, 10)\n\ngetn(dataframe) # >>> 2.7421\ngetn(dataframe, date=date) # >>> 2.9932\n\ngetunits(dataframe=dataframe, account=1000000, n=2.7421) # >>> 20.0475\ngetunits(dataframe=dataframe, account=1000000, date=date) # >>> 17.9233\n```\n\n### `entries` module\n```python\n\"\"\" using the entries module \"\"\"\nfrom turtle_trading.entries import getentry, addunits\n\ngetentry(dataframe=dataframe, system=1) # >>> True\ngetentry(dataframe=dataframe, system=2) # >>> True\n\naddunits(orig_breakout=310, orig_n=2.50) # >>> [310, 311.25, 312.5, 313.75]\naddunits(orig_breakout=310, orig_n=2.50, number_of_units=6) # >>> [310, 311.25, 312.5, 313.75, 315.0, 316.25]\n\n# DISCLAIMER: In the rules, no more than 4 more units are allowed for a single position.\n```\n\n### `stops` module\n```python \n\"\"\" using the stops module \"\"\"\nfrom turtle_trading.entries import addunits\nfrom turtle_trading.stops import getstops\n\nunits = addunits(orig_breakout=28.30, orig_n=1.20) # >>> [28.3, 28.9, 29.5, 30.1]\n\ngetstops(stop_system=\"regular\", unit_list=units, orig_n=1.20) # >>> [27.7, 27.7, 27.7, 27.7]\ngetstops(stop_system=\"whipsaw\", unit_list=units, orig_n=1.20) # >>> [27.7, 28.3, 28.9, 29.5]\n\n\ngapped_units = [28.3, 28.9, 29.5, 30.8]\n\ngetstops(stop_system=\"regular\", unit_list=gapped_units, orig_n=1.20) # >>> [27.7, 27.7, 27.7, 28.4]\ngetstops(stop_system=\"whipsaw\", unit_list=gapped_units, orig_n=1.20) # >>> [27.7, 28.3, 28.9, 30.2]\n```\n\n### `exits` module\n```python\nimport datetime\nfrom turtle_trading.exits import getexit\n\ngetexit(dataframe=dataframe, system=1, pos_direction=True) # >>> True\n\ngetexit(dataframe=dataframe, system=1, pos_direction=True, date=datetime.date(2023, 11, 10)) # >>> False\n```\n\nOfficial documentation coming soon...\n\nFor issues, look [here](https://github.com/gabekutner/turtle-trading/blob/main/.github/ISSUE_TEMPLATE.md).",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Gabe Kutner  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A collection of investment tools used by the Turtle Traders.",
    "version": "3.5.1",
    "project_urls": {
        "Homepage": "https://github.com/gabekutner/turtle-trading/"
    },
    "split_keywords": [
        "investing",
        "python",
        "trading",
        "turtle",
        "turtle-trading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed65fe5012d7f768987e19618d15ea92f8d6a61017439d0701bda47b1a0f01ad",
                "md5": "18b4c1c5840262f84425f4e7866e4b4c",
                "sha256": "0368bf7605fa451a8e1b58c3143dee6d0507ea0f47542b4647c0de5cf83fb209"
            },
            "downloads": -1,
            "filename": "turtle_trading-3.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "18b4c1c5840262f84425f4e7866e4b4c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17052,
            "upload_time": "2024-02-07T19:01:48",
            "upload_time_iso_8601": "2024-02-07T19:01:48.639213Z",
            "url": "https://files.pythonhosted.org/packages/ed/65/fe5012d7f768987e19618d15ea92f8d6a61017439d0701bda47b1a0f01ad/turtle_trading-3.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac59fc7a42dee97e009a4496b19990a01790d95bbc4237931ad43de66366c3a6",
                "md5": "622d52b783d3851932532384a31d22e4",
                "sha256": "b785eade97f40fcfcc95f42f2c530be61b748a3384be251c2ad879823815e5b2"
            },
            "downloads": -1,
            "filename": "turtle_trading-3.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "622d52b783d3851932532384a31d22e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 2887232,
            "upload_time": "2024-02-07T19:01:53",
            "upload_time_iso_8601": "2024-02-07T19:01:53.265004Z",
            "url": "https://files.pythonhosted.org/packages/ac/59/fc7a42dee97e009a4496b19990a01790d95bbc4237931ad43de66366c3a6/turtle_trading-3.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 19:01:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gabekutner",
    "github_project": "turtle-trading",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "turtle-trading"
}
        
Elapsed time: 0.23028s