Skip to content

Instantly share code, notes, and snippets.

htrajan

Block or report user

Report or block htrajan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View action-required.json
{
"actionType": "ACTION",
"title": "Check your credentials",
"subtitle": "Looks like an incorrect username or password for Vanguard.",
"cta": "Try again"
}
View all-on-backend.json
{
"banner": {"institutions": ["CHASE"], "text": "Linking in progress", "button": "Link more"},
"hub": [{"institution": "CHASE", "title": "Linking in progress", "subtitle": "This usually takes about 1 minute for Chase."}]
}
View builder.java
Account realisticRetirementAccount = RetirementAccount.builder()
.withInvestedBalance(34_332.67)
.withCashBalance(2_190.95)
.withType(Type.R_401_K)
.withExpectedAccountReturn(0.057)
.build();
View integration.java
public class AccountSavingsRecommenderIntegrationTest {
private static final LocalDate today = new LocalDate(2018, 6, 25);
private AccountSavingsRecommender getRecommender() {
AccountSavingsRecommender recommender = new AccountSavingsRecommender();
RetirementGoalSavingsAllocator retirementAllocator = new RetirementGoalSavingsAllocator();
retirementAllocator.today = today;
RetirementAccountSelector accountSelector = new RetirementAccountSelector();
View mock.java
public class AccountSavingsRecommenderTest {
private final Mockery mockery = new Mockery();
private final RetirementGoalSavingsAllocator retirementAllocator = mockery.mock(RetirementGoalSavingsAllocator.class);
@Test
public void computePvByGoal_retirement() {
Account retirementAccount = TestAccountFactory.exampleRetirementAccount();
mockery.checking(new Expectations() {{
oneOf(retirementAllocator).getAccountForPvCalculation();
View visibleForTesting.java
public class AccountSavingsRecommender {
@Inject RetirementGoalSavingsAllocator retirementAllocator;
@VisibleForTesting
Map<Goal, Double> computePvByGoal(Collection<Goal> goals) {...}
……
@VisibleForTesting
View savings-reco-api.java
Map<Account, Double> getSavingsRecommendations(
double savingsToAllocate,
Collection<Account> accounts,
Collection<Goal> goals);
@htrajan
htrajan / homeAffordability
Last active Feb 12, 2018
Home Affordability
View homeAffordability
{
“affordability”: “MANAGEABLE”,
“mortgageAffordability”: “MEDIUM”,
“dtiRatio”: 0.32,
“desiredDtiRatio”: 0.29,
“downPaymentRatio”: 0.2,
“desiredDownPaymentRatio”: 0.15,
“retirementImpact”: “NONE”,
“mortgageWillForeclose”: false
}
@htrajan
htrajan / search.java
Created Feb 12, 2018
Binary Home Searching
View search.java
@Inject BinarySearchSolver solver;
...
Function<Double, Affordability> affordabilityFn ...; // our mapping function that takes a number and returns an affordability
Function<Affordability, Boolean> manageableTargetTest = affordability -> affordability.getOrdinal() <= MANAGEABLE.getOrdinal();
double maxManageablePrice = solver.solveForMaxValuePassingTargetTest(
lowerBound,
You can’t perform that action at this time.