Code Monkey home page Code Monkey logo

lunchmoney-assets's Introduction

Update Real Estate & Car Values in LunchMoney

Tool to update real estate and car values in LunchMoney. Supports scraping values from Zillow, Redfin, and Kelly Bluebook.

Why build this tool rather than the existing scripts out there?

  • The Kelly Bluebook page structure changed and the existing logic wasn't working for me
  • I wanted a single tool to manage both real estate and cars
  • Wanted a good excuse to play around with puppeteer

Usage

I wrote this using node 17, but I imagine it will work with much older versions. Use asdf install to setup node if you haven't already.

cp .env-example .env
# generate a API key and add it to .env

touch assets.json
# add your assets to assets.json

npm install
node dist/index.js

Or, if you have a docker container setup, you can run it directly:

docker exec -i ca32c16fa00e node dist/index.js

assets.json Structure

Specify the assets to be updated in the assets.json file. The key of the hash is the LunchMoney asset ID.

{
  "23760": {
    "__comment": "you can specify a zillow and redfin link to set the balance as the average of the two",
    "url": "https://www.zillow.com/homes/your-home/123/",
    "redfin": "https://www.redfin.com/STATE/CITY/yourhome/home/123"
  },
  "23759": {
    "__comment": "kelly blue book link",
    "url": "https://www.kbb.com/your/car/year/model/?condition=good&intent=trade-in-sell&mileage=100000&modalview=false&options=6763005%7ctrue&pricetype=private-party"
  },
  "23759": {
    "__comment": "a car that is more damaged than it looks",
    "url": "https://www.kbb.com/your/car/year/model/?condition=good&intent=trade-in-sell&mileage=100000&modalview=false&options=6763005%7ctrue&pricetype=private-party",
    "adjustment": -500
  }
}

Docker Deployment

https://hub.docker.com/r/iloveitaly/lunchmoney-assets

Here's the docker-compose file I use:

lunchmoney_assets:
  container_name: lunchmoney-assets
  image: iloveitaly/lunchmoney-assets:latest
  restart: unless-stopped
  environment:
    - SCHEDULE=@monthly
    - LUNCH_MONEY_API_KEY=THE_KEY

Copy your assets config into the container:

docker compose cp ./lunch-money-assets.json lunchmoney_assets:./app/assets.json

Or, if you are using docker without compose:

docker cp ./lunch-money-assets.json lunchmoney_assets:./app/assets.json

Set a SCHEDULE environment variable when starting the container to update the assets at a regular interval. The value should be a cron expression.

docker run -d --name lunchmoney-assets -e SCHEDULE="0 0 * * *" iloveitaly/lunchmoney-assets

Development

Setup your env (I use direnv):

cp .envrc-example .envrc

Compile typescript:

npm run dev

Get a list of all accounts in your lunchmoney account:

http GET https://dev.lunchmoney.app/v1/assets -A bearer -a $LUNCH_MONEY_API_KEY | jqp

# or match against a specific account
http GET https://dev.lunchmoney.app/v1/assets -A bearer -a $LUNCH_MONEY_API_KEY | jq '.assets | map(select(.name == "Camry"))'

TODO

  • throw a user-friendly error if assets.json is not defined
  • It seems as though the KBB logic only works for private party priced URLs. Not sure why.
  • Automatically calculate additional mileage based on time passed

lunchmoney-assets's People

Contributors

dependabot[bot] avatar iloveitaly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tpaulus

lunchmoney-assets's Issues

Docker Container Fails to Start

Hi there,

I build and launched a Docker Container from the Dockerfile provided, but it seems that a file, specifically cron.sh is missing from the Repo.

Logs from Docker:

bash: cron.sh: No such file or directory

Cheers,
Tom

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.