Coder Social home page Coder Social logo

cartera's Introduction

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

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:

cartera's People

Contributors

balupton avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.