cartera

2.1.0 • Public • Published

cartera

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Patreon donate button Open Collective donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button
Slack community badge

cartera is portfolio in Catalan

investment portfolio

Install

NPM

  • Install: npm install --global cartera
  • Executable: cartera
  • Editions

    This package is published with the following editions:

    • cartera aliases cartera/source/index.js
    • cartera/source/index.js is Source + ESNext + Require

    Older environments may need Babel's Polyfill or something similar.

    Usage

    Cartera portfolios are JSON files like this:

    {
      "portfolio": [
        {
          "currency": "BCH",
          "open": {
            "when": "2017-08-01",
            "bought": {
              "amount": 2
            }
          },
          "close": {
            "when": "2018-06-20T05:00:00.000Z"
          }
        },
        {
          "currency": "ETH",
          "open": {
            "when": "2017-08-01",
            "bought": {
              "amount": 2
            }
          },
          "close": {
            "when": "2018-06-20T05:00:00.000Z"
          }
        }
      ]
    }

    The default portfolio location is ~/Documents/Cartera/portfolio.json and you can specify a custom path via cartera --path <path/file.json>.

    Running cartera with the above will output a result that looks like this:

    {
      items: [
        {
          currency: 'BCH',
          open: {
            when: '8/1/2017, 8:00:00 AM',
            bought: {
              amount: 2,
              currency: 'BCH',
              price: 0.002276504200150249
            },
            sold: {
              currency: 'USD',
              amount: 878.54,
              price: 439.27
            },
            market: {
              USD: {
                USD: 1,
                BCH: 0.002277
              },
              BCH: {
                USD: 439.27,
                BCH: 1
              }
            },
            value: {
              USD: 878.54,
              BCH: 2
            }
          },
          close: {
            when: '6/20/2018, 1:00:00 PM',
            bought: {
              currency: 'USD',
              amount: 1800.34,
              price: 900.17
            },
            sold: {
              currency: 'BCH',
              amount: 2,
              price: 0.0011109012742037616
            },
            market: {
              USD: {
                USD: 1,
                BCH: 0.001111
              },
              BCH: {
                USD: 900.17,
                BCH: 1
              }
            },
            value: {
              USD: 1800.34,
              BCH: 4.0984815716985
            },
            changes: {
              USD: {
                amount: 921.8,
                difference: '104.92%',
                remaining: '204.92%'
              },
              BCH: {
                amount: 2.0984815716984997,
                difference: '104.92%',
                remaining: '204.92%'
              }
            }
          }
        },
        {
          currency: 'ETH',
          open: {
            when: '8/1/2017, 8:00:00 AM',
            bought: {
              amount: 2,
              currency: 'ETH',
              price: 0.004426737494466578
            },
            sold: {
              currency: 'USD',
              amount: 451.8,
              price: 225.9
            },
            market: {
              ETH: {
                USD: 225.9,
                ETH: 1
              },
              USD: {
                USD: 1,
                ETH: 0.004427
              }
            },
            value: {
              USD: 451.8,
              ETH: 2
            }
          },
          close: {
            when: '6/20/2018, 1:00:00 PM',
            bought: {
              currency: 'USD',
              amount: 1072.38,
              price: 536.19
            },
            sold: {
              currency: 'ETH',
              amount: 2,
              price: 0.0018650105373095357
            },
            market: {
              ETH: {
                USD: 536.19,
                ETH: 1
              },
              USD: {
                USD: 1,
                ETH: 0.001865
              }
            },
            value: {
              USD: 1072.38,
              ETH: 4.74714475431607
            },
            changes: {
              USD: {
                amount: 620.5800000000002,
                difference: '137.36%',
                remaining: '237.36%'
              },
              ETH: {
                amount: 2.7471447543160696,
                difference: '137.36%',
                remaining: '237.36%'
              }
            }
          }
        }
      ],
      totals: {
        currency: 'USD',
        open: '$1330.34',
        close: '$2872.72',
        change: '$1542.38',
        difference: '115.94%',
        remaining: '215.94%'
      }
    }

    You can generate JSON output by using the --json flag:

    {
      "items": [
        {
          "currency": "BCH",
          "open": {
            "when": "2017-08-01T00:00:00.000Z",
            "bought": {
              "amount": 2,
              "currency": "BCH",
              "price": 0.002276504200150249
            },
            "sold": {
              "currency": "USD",
              "amount": 878.54,
              "price": 439.27
            },
            "market": {
              "USD": {
                "USD": 1,
                "BCH": 0.002277
              },
              "BCH": {
                "USD": 439.27,
                "BCH": 1
              }
            },
            "value": {
              "USD": 878.54,
              "BCH": 2
            }
          },
          "close": {
            "when": "2018-06-20T05:00:00.000Z",
            "bought": {
              "currency": "USD",
              "amount": 1800.34,
              "price": 900.17
            },
            "sold": {
              "currency": "BCH",
              "amount": 2,
              "price": 0.0011109012742037616
            },
            "market": {
              "USD": {
                "USD": 1,
                "BCH": 0.001111
              },
              "BCH": {
                "USD": 900.17,
                "BCH": 1
              }
            },
            "value": {
              "USD": 1800.34,
              "BCH": 4.0984815716985
            },
            "changes": {
              "USD": {
                "amount": 921.8,
                "difference": 104.92407858492498,
                "remaining": 204.92407858492498
              },
              "BCH": {
                "amount": 2.0984815716984997,
                "difference": 104.92407858492498,
                "remaining": 204.92407858492498
              }
            }
          }
        },
        {
          "currency": "ETH",
          "open": {
            "when": "2017-08-01T00:00:00.000Z",
            "bought": {
              "amount": 2,
              "currency": "ETH",
              "price": 0.004426737494466578
            },
            "sold": {
              "currency": "USD",
              "amount": 451.8,
              "price": 225.9
            },
            "market": {
              "USD": {
                "USD": 1,
                "ETH": 0.004427
              },
              "ETH": {
                "USD": 225.9,
                "ETH": 1
              }
            },
            "value": {
              "USD": 451.8,
              "ETH": 2
            }
          },
          "close": {
            "when": "2018-06-20T05:00:00.000Z",
            "bought": {
              "currency": "USD",
              "amount": 1072.38,
              "price": 536.19
            },
            "sold": {
              "currency": "ETH",
              "amount": 2,
              "price": 0.0018650105373095357
            },
            "market": {
              "USD": {
                "USD": 1,
                "ETH": 0.001865
              },
              "ETH": {
                "USD": 536.19,
                "ETH": 1
              }
            },
            "value": {
              "USD": 1072.38,
              "ETH": 4.74714475431607
            },
            "changes": {
              "USD": {
                "amount": 620.5800000000002,
                "difference": 137.35723771580348,
                "remaining": 237.35723771580348
              },
              "ETH": {
                "amount": 2.7471447543160696,
                "difference": 137.35723771580348,
                "remaining": 237.35723771580348
              }
            }
          }
        }
      ],
      "totals": {
        "currency": "USD",
        "open": 1330.34,
        "close": 2872.7200000000003,
        "change": 1542.38,
        "difference": 115.93878256686263,
        "remaining": 215.93878256686264
      }
    }

    The default currency (which is also used for reporting) is USD and can be customised via cartera --currency <EUR>.

    History

    Discover the release history by heading on over to the HISTORY.md file.

    Contribute

    Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

    Backers

    Maintainers

    No maintainers yet! Will you be the first?

    Sponsors

    No sponsors yet! Will you be the first?

    Patreon donate button Open Collective donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

    Contributors

    These amazing people have contributed code to this project:

    Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

    License

    Unless stated otherwise all works are:

    and licensed under:

    Package Sidebar

    Install

    npm i cartera

    Weekly Downloads

    0

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    28.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • bevryme