Author Topic: cFIREsim Open Source Project  (Read 7435 times)

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
cFIREsim Open Source Project
« on: December 12, 2014, 07:03:45 PM »
I haven't been very active on these forums lately, because I've been deep into the obsession of learning to code with Javascript, and have been working on a turn-based strategy game using those skills.  It's been a lot of fun.  But, I hope to be more active around here again because...

I'm announcing a new project to completely rewrite the cFIREsim codebase in Javascript, to do it completely open source, and to hopefully get some people from this community involved in the project.

Goals:
  • Complete transparency of code. Lots of people ask about this, and here I am to deliver.
  • Improvement of code. I wrote cFIREsim before I had a grasp on a lot of organizational concepts (that's a nice way of saying it's a clusterfuck under the hood).
  • I want to include Unit Testing (http://en.wikipedia.org/wiki/Unit_testing) this time around to ensure the accuracy of the code, and that mistakes don't happen over and over again.
  • I wanted to include members of the MMM/FIRE community that have been itching to help.

What can you do?

- Head to the cFIREsim Open Source Project forum to help start organize our thoughts. Talk about new ways of doing things, possible new features we can add along the way, and anything else that bugs you about cFIREsim that we could change. (http://www.cfiresim.com/phpBB3/viewforum.php?f=6)
- Take a look at my Github repo and look at the stub data that I've included. I currently only have an extremely basic data set, form, and iteration function that shows how to move through the data set.  https://github.com/boknows/cFIREsim-open
- Even if you're a relative beginner to Javascript, feel free to join in!

Note: One thing that I would kill for is someone who likes to do UI work.  That is one aspect of cFIREsim that has caused me a lot of grief in the past.

Caveats:
I have a full-time job, and I still want to work on my game project. I mat have been fairly new to programming, but it took me months to reverse-engineer what some of the popular retirement calculators were doing, and recreate it in code. I don't expect this to be a fast process, but it might be improve if more people are working on it.  Also, I've never actually managed an open source project, so bear with me.

arebelspy

  • Administrator
  • Senior Mustachian
  • *****
  • Posts: 28444
  • Age: -997
  • Location: Seattle, WA
Re: cFIREsim Open Source Project
« Reply #1 on: December 13, 2014, 10:38:31 PM »
You sir, are badass.

I know nothing that would allow me to contribute, but I just want to mention how much I appreciate what you've created.

I tip my hat to you.

I am a former teacher who accumulated a bunch of real estate, retired at 29, spent some time traveling the world full time and am now settled with three kids.
If you want to know more about me, this Business Insider profile tells the story pretty well.
I (rarely) blog at AdventuringAlong.com. Check out the Now page to see what I'm up to currently.

Dee18

  • Handlebar Stache
  • *****
  • Posts: 2216
Re: cFIREsim Open Source Project
« Reply #2 on: December 14, 2014, 05:59:41 AM »
I had to Google "ui work" to learn what it is, so I am obviously of no help with your project, but I join arebelspy with a big Thank You!

swashbucklinstache

  • Pencil Stache
  • ****
  • Posts: 630
  • Location: Midwest U.S.
Re: cFIREsim Open Source Project
« Reply #3 on: December 15, 2014, 07:43:41 PM »
I know so little about javascript and web development that it is comical, but I might like to (try and) help, at least at some point. I've got some SQL, some c#/c++, a bit of R experience, and just a taste of javascript/nodejs experience. I'll mostly try to stay out of your way :) and may fork stuff over and try to get something running locally just to learn until I catch up somewhat. That might be awhile as I'll be neck-deep in c++ based data structures and algorithms class next semester along with work.

britgamer

  • 5 O'Clock Shadow
  • *
  • Posts: 1
Re: cFIREsim Open Source Project
« Reply #4 on: December 16, 2014, 05:10:54 AM »
I may be able to help with the UI.

I'm a C# web developer who's got a lot of time on his hands until January. I'll take a look at the code later on today an hopefully will have something to contribute to your forum soon.

CowboyAndIndian

  • Handlebar Stache
  • *****
  • Posts: 1942
  • Location: NJ, USA
Re: cFIREsim Open Source Project
« Reply #5 on: December 16, 2014, 07:11:47 AM »
I'm not a front end developer, more of a back end developer.

I can help you with the following
  • Amazon Cloud
  • Apache
  • Perl
  • MySql

I am good with the web, but average with web design (ie. putting the css/html together).
Would be glad to help.

Clever Name

  • Stubble
  • **
  • Posts: 141
Re: cFIREsim Open Source Project
« Reply #6 on: December 17, 2014, 07:41:11 PM »
Unfortunately I can't help much with Javascript, but if there's interest in making an iOS and/or Android version I would be glad to help with that.

AnonymousCoward

  • 5 O'Clock Shadow
  • *
  • Posts: 74
  • Location: San Francisco, CA
Re: cFIREsim Open Source Project
« Reply #7 on: December 18, 2014, 09:34:17 PM »
I just spent some time playing with the code to get a handle on it. I turned my tinkerings into a pull request, merge it if you like it :)

I'm not a JS expert but I'm supposed to be learning it for work so this seems like a good opportunity. I do have experience with unit testing. I'm not big on UI but I can try.

Also how do I access the forum? I get a 404 when I go to it.Never mind, I got it :)
« Last Edit: December 18, 2014, 09:36:07 PM by pmallory »

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
Re: cFIREsim Open Source Project
« Reply #8 on: February 10, 2015, 12:59:28 PM »
The first time that I posted about a completely Open-Source version of cFIREsim, I was woefully unprepared.  I didn't have any code at the time to build off of, and I think that hindered collaboration.  I did get a few kind folks to contribute a shiny new AngularJS user interface, and some other data-related functions, which I appreciate.  However, I now have enough code re-done to put it out there for consumption and testing... which I hope spawns some more interest in coding contributions.

Warning: This code is still not ready for prime-time. I'm putting this out on the basis that folks will help debug and/or suggest new features. Some of the features from cFIREsim legacy are not fully working, but may be still visible (portfolio rebalancing options is one big example).  Also, Saving/Loading simulations is not currently available, but after posting this publicly, I'm going to work on that feature next so that testing can be done a little easier. In the original discussions on cFIREsim-open, people suggested that users be able to save files containing their simulations, and be able to load them without saving anything to a DB, or without any accounts. I'm not sure if that is possible given the security constraints of modern browsers, but I'm open to ideas. I'm not entirely sure if the output graph/chart, as it stands now, will look good on an iPad or Mobile device.

New Test Site: http://www.cfiresim.com/open/input.htm
Github Repo: https://github.com/boknows/cFIREsim-open/
Submit issues/suggestions (requires github account): https://github.com/boknows/cFIREsim-open/issues

How to test/use:

Right now, the best way to help test cFIREsim-open is by doing the following:
- Input your scenarios into the input page.
- Click "Run Simulation"
- Watch at the bottom of the page as the output charts appear, along with a link to a CSV file.
- Use the CSV file, and the Javascript Console in your browser to verify data
- To access the javascript console in Firefox/Chrome: Control+Shift+I (then click the "console" tab)

After running a simulation, the javascript console will show:
- "Form Data" - clicking the "Object" will show on the side all of the form inputs and their names/values
- "Results" - clicking the "Object" will show an array of every simulation cycle. Inside each cycle is an array of each year of that cycle. Inside of each year is all of the relevant data for that year (spending, inflation, SS, pensions, etc etc)
- "Failed X out of Y cycles. " - A message showing the standard cFIREsim failure rate.
- "Final Stats" - clicking the "Object" will show a list of all of the statistics that make up the cFIREsim legacy output chart (Average ending portfolio, all of the withdrawal analysis, etc)

Folks who program:  If you want to specifically play with Spending Methods (like Guyton Klinger, Hebelers Autopilot) or make up your own spending method, the spendingModule.js contains all the relevant documents. (https://github.com/boknows/cFIREsim-open/blob/master/js/spendingModule.js)

Play around with the tool. Record issues on Github.  Record suggestions on Github.  Discuss possible enhancements here or on cFIREsim forums. Contribute code if you wish.

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
Re: cFIREsim Open Source Project
« Reply #9 on: February 10, 2015, 01:00:29 PM »
For clarification, my current priorities are:

- Save/Load functionality with a database
- Recreate VPW Spending Method
- Create a Generalized PMT Method based on VPW

freeedom

  • 5 O'Clock Shadow
  • *
  • Posts: 92
Re: cFIREsim Open Source Project
« Reply #10 on: February 11, 2015, 10:29:21 PM »
Software engineer here...

Although I don't do much Javascript, this is a skill gap I've been wanting to fill, so I'm in.

innkeeper77

  • Bristles
  • ***
  • Posts: 361
Re: cFIREsim Open Source Project
« Reply #11 on: February 11, 2015, 10:35:47 PM »
In the original discussions on cFIREsim-open, people suggested that users be able to save files containing their simulations, and be able to load them without saving anything to a DB, or without any accounts. I'm not sure if that is possible given the security constraints of modern browsers, but I'm open to ideas

I'm sorry for not knowing what exactly you are talking about, but I am interested. What security constraints are you referring to? (I'm not the most knowlagable on the subject, and my coding is generally constrained to my personal use, and I've never written any real web code) However, from my simple point of view, I would think you could export all data needed to a csv, even if it is nonstandard and clunky, then have the user download that. Add in an upload feature to re-fill out all the fields using said csv, and there you go. What in modern browsers prevents this?

AnonymousCoward

  • 5 O'Clock Shadow
  • *
  • Posts: 74
  • Location: San Francisco, CA
Re: cFIREsim Open Source Project
« Reply #12 on: February 12, 2015, 01:12:11 AM »
It's too bad I can't contribute much to this, I've got too much going on right now. I did however write some code to do local storage last time you posted about this. It's in a branch on my fork, see https://github.com/pmallory/cFIREsim-open/blob/localstorage/js/cFIREsimOpen.js#L58. It saves a jsonifiable object by name in the user's local storage.

It works like this:
SettingsSave.saveInputSettings("save name", {"simulatorsettings":{"foo":"bar"}});
SettingsSave.loadInputSetting("save name"); // returns  {"simultorsettings":{"foo":"bar"}}
SettingsSave.listSaveNames(); // returns ["save name"]


I imagined it being hooked up to a select box that lists the existing saves (with listSaveNames()) to be loaded, and a corresponding text field for naming a save of the current settings. If that still sounds useful feel free to take the code.

edit: omg typos
« Last Edit: February 12, 2015, 01:14:50 AM by pmallory »

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
Re: cFIREsim Open Source Project
« Reply #13 on: February 12, 2015, 08:52:50 AM »
It's too bad I can't contribute much to this, I've got too much going on right now. I did however write some code to do local storage last time you posted about this. It's in a branch on my fork, see https://github.com/pmallory/cFIREsim-open/blob/localstorage/js/cFIREsimOpen.js#L58. It saves a jsonifiable object by name in the user's local storage.

It works like this:
SettingsSave.saveInputSettings("save name", {"simulatorsettings":{"foo":"bar"}});
SettingsSave.loadInputSetting("save name"); // returns  {"simultorsettings":{"foo":"bar"}}
SettingsSave.listSaveNames(); // returns ["save name"]


I imagined it being hooked up to a select box that lists the existing saves (with listSaveNames()) to be loaded, and a corresponding text field for naming a save of the current settings. If that still sounds useful feel free to take the code.

edit: omg typos

I'll check it out, and possibly merge it to the master.  Thanks!

freeedom

  • 5 O'Clock Shadow
  • *
  • Posts: 92
Re: cFIREsim Open Source Project
« Reply #14 on: February 12, 2015, 04:45:37 PM »
Bo...

Just got the code, any ideas what needs working on?

How about I get acclimated to the codebase with some bugs?

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
Re: cFIREsim Open Source Project
« Reply #15 on: February 12, 2015, 06:51:03 PM »
Bo...

Just got the code, any ideas what needs working on?

How about I get acclimated to the codebase with some bugs?

I think there aren't that many bugs, mostly just missing features from the legacy code.

Everything derives from clicking the "Run Simulation" Button, which kicks off the runSimulation() function inside of cFIREsimOpen.js. From there, it determines the simulation length, figures out each cycle length, populates the this.sim array with placeholder data, then calls the major calculation functions (calcStartPortfolio, calcMarktGains, calcSumOfAdjustments, etc).  Then the graph is created with the displayGraph() function, and statistics are computed with the statsModule.js.

Things you can work on (and please let me know what you choose and your github username and I'll formally assign it to you):

- Form validation (Is the Start Year before the End Year? Do any of the extra spending/income dates fall completely outside the simulation range? Did the user put numbers in and not letters?)
- Asset Allocation "glide paths" (which are hidden on the form right now)
- Save/load functionality (which I've had a couple of ideas given to me)

freeedom

  • 5 O'Clock Shadow
  • *
  • Posts: 92
Re: cFIREsim Open Source Project
« Reply #16 on: February 16, 2015, 11:37:10 AM »
Bo...

Just got the code, any ideas what needs working on?

How about I get acclimated to the codebase with some bugs?

I think there aren't that many bugs, mostly just missing features from the legacy code.

Everything derives from clicking the "Run Simulation" Button, which kicks off the runSimulation() function inside of cFIREsimOpen.js. From there, it determines the simulation length, figures out each cycle length, populates the this.sim array with placeholder data, then calls the major calculation functions (calcStartPortfolio, calcMarktGains, calcSumOfAdjustments, etc).  Then the graph is created with the displayGraph() function, and statistics are computed with the statsModule.js.

Things you can work on (and please let me know what you choose and your github username and I'll formally assign it to you):

- Form validation (Is the Start Year before the End Year? Do any of the extra spending/income dates fall completely outside the simulation range? Did the user put numbers in and not letters?)
- Asset Allocation "glide paths" (which are hidden on the form right now)
- Save/load functionality (which I've had a couple of ideas given to me)

I'll take the form validation feature. I'll message you my github username.

lauren_knows

  • Pencil Stache
  • ****
  • Posts: 846
  • Age: 42
  • Location: Annandale, VA, USA
  • Happiness is a choice
    • The Crowdsourced FIRE simulator
Re: cFIREsim Open Source Project
« Reply #17 on: August 31, 2015, 09:02:38 AM »
Just wanted to add to this thread that all of the contributions from community members on this project (as well as mine, obviously) have finally been pushed to the main cFIREsim.com website. There are already a few small bugs, and some missing features, but we've got a good base for transparency as to how this thing works.

Thank you all for your help and your ideas. Keep'em comin'.

Rubic

  • Handlebar Stache
  • *****
  • Posts: 1130
Re: cFIREsim Open Source Project
« Reply #18 on: August 31, 2015, 11:45:47 AM »
Just saw your post today and added your github project to my watch list.

TomTX

  • Walrus Stache
  • *******
  • Posts: 5345
  • Location: Texas
Re: cFIREsim Open Source Project
« Reply #19 on: September 05, 2015, 04:52:48 PM »
Thanks, bo!