moneycounter


Namemoneycounter JSON
Version 1.3.1 PyPI version JSON
download
home_page
SummaryPortfolio Analytics Utilities
upload_time2023-05-03 16:50:49
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords risk fifo money investments
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Money Counter
*Portfolio analytics utilities*



This is the beginning of a work in progress.
I expect it will be in pretty good shape early in
2023 and then evolve from there.

This is a supporting package for a larger project I am working on and should be useful to others as is.

### Installation

[PyPI Page](https://pypi.org/search/?q=moneycounter)

```shell
$ pip install moneycounter 
```

### Prerequisite Trades Data Frame

A trades dataframe has these columns:

`columns = Index(['dt', 'q', 'p', 'cs', 't', 'a'], dtype='object')`

It must be ordered by dt.

Where:

| Column |                   Description                   |
|:------:|:-----------------------------------------------:|
|  `dt`  |       execution time as datetime.datetime       |
|  `q`   | quantity traded, signed with negative as a sale |
| `p`    |                 execution price                 |
|  `cs`  |          contract size, typically 1.0           |
|  `t`   |                     ticker                      |
|  `a`   |                     account                     |


### Example Calculations

```python
from datetime import date
from moneycounter import pnl, realized_gains, wap_calc

# Calculate realized, unrealized and total pnl from trades dataframe.
realized, unrealized, total = pnl(df, price=price)

# Calculate weighted average price of open positions from trades data frame.
wap = wap_calc(df)

# Calculate realized gains from trades data frame.
realized = realized_gains(df)

$` \phi = c * Q * (p - p_wap) `$

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "moneycounter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Marc Schwarzschild <ms@TheBrookhavenGroup.com>",
    "keywords": "risk,fifo,money,investments",
    "author": "",
    "author_email": "Marc Schwarzschild <ms@TheBrookhavenGroup.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/62/c0271a5e947ebaf5d9ff2969e6ebe8766328a6ae992b6924cbec53e3d137/moneycounter-1.3.1.tar.gz",
    "platform": null,
    "description": "# Money Counter\n*Portfolio analytics utilities*\n\n\n\nThis is the beginning of a work in progress.\nI expect it will be in pretty good shape early in\n2023 and then evolve from there.\n\nThis is a supporting package for a larger project I am working on and should be useful to others as is.\n\n### Installation\n\n[PyPI Page](https://pypi.org/search/?q=moneycounter)\n\n```shell\n$ pip install moneycounter \n```\n\n### Prerequisite Trades Data Frame\n\nA trades dataframe has these columns:\n\n`columns = Index(['dt', 'q', 'p', 'cs', 't', 'a'], dtype='object')`\n\nIt must be ordered by dt.\n\nWhere:\n\n| Column |                   Description                   |\n|:------:|:-----------------------------------------------:|\n|  `dt`  |       execution time as datetime.datetime       |\n|  `q`   | quantity traded, signed with negative as a sale |\n| `p`    |                 execution price                 |\n|  `cs`  |          contract size, typically 1.0           |\n|  `t`   |                     ticker                      |\n|  `a`   |                     account                     |\n\n\n### Example Calculations\n\n```python\nfrom datetime import date\nfrom moneycounter import pnl, realized_gains, wap_calc\n\n# Calculate realized, unrealized and total pnl from trades dataframe.\nrealized, unrealized, total = pnl(df, price=price)\n\n# Calculate weighted average price of open positions from trades data frame.\nwap = wap_calc(df)\n\n# Calculate realized gains from trades data frame.\nrealized = realized_gains(df)\n\n$` \\phi = c * Q * (p - p_wap) `$\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Portfolio Analytics Utilities",
    "version": "1.3.1",
    "project_urls": {
        "documentation": "https://github.com/schwarzschild/moneycounter",
        "homepage": "https://github.com/schwarzschild/moneycounter",
        "repository": "https://github.com/schwarzschild/moneycounter"
    },
    "split_keywords": [
        "risk",
        "fifo",
        "money",
        "investments"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b6c773f352e86e3573e39a40c0e822728ffa2542d1791da6073d260292e5efa",
                "md5": "68d167e098176d2444610ffa25a35014",
                "sha256": "7f912b27d9836941eb9073d6fa415b52cc4600dcc8935bc3ad00b016742b52d9"
            },
            "downloads": -1,
            "filename": "moneycounter-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "68d167e098176d2444610ffa25a35014",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4487,
            "upload_time": "2023-05-03T16:50:47",
            "upload_time_iso_8601": "2023-05-03T16:50:47.400376Z",
            "url": "https://files.pythonhosted.org/packages/5b/6c/773f352e86e3573e39a40c0e822728ffa2542d1791da6073d260292e5efa/moneycounter-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb62c0271a5e947ebaf5d9ff2969e6ebe8766328a6ae992b6924cbec53e3d137",
                "md5": "45024cffe803f8e4ba3e6b587e58bff1",
                "sha256": "6c10145bf3a47291bd3477bbefcd9c39220b71dd12867b796afad233141e92f0"
            },
            "downloads": -1,
            "filename": "moneycounter-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "45024cffe803f8e4ba3e6b587e58bff1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8509,
            "upload_time": "2023-05-03T16:50:49",
            "upload_time_iso_8601": "2023-05-03T16:50:49.065257Z",
            "url": "https://files.pythonhosted.org/packages/cb/62/c0271a5e947ebaf5d9ff2969e6ebe8766328a6ae992b6924cbec53e3d137/moneycounter-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-03 16:50:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "schwarzschild",
    "github_project": "moneycounter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "moneycounter"
}
        
Elapsed time: 1.51885s