This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-3.2$ time curl -H "Accept: text/html" http://localhost:8002/forecast/214/1116543?use_item_assumptions=true > /tmp/goo.html | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 321k 100 321k 0 0 168k 0 0:00:01 0:00:01 --:--:-- 168k | |
real 0m1.921s | |
user 0m0.008s | |
sys 0m0.006s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct Account { | |
/// Identifier for the account | |
pub id: String, | |
/// Type of account, important for determining treatment of gains. | |
/// | |
/// Note: Unlike _Growth Item_ categorization, this is not used to make | |
/// _categorical_ growth assumptions. | |
/// | |
pub account_type: AccountType, | |
/// Holdings in the account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Resolve assumptions. | |
/// | |
/// For each `Worth`, `Holding` and `FlowSpec` finds the appropriate | |
/// `GrowthAssumption` by looking within the item if `use_item_assumptions` | |
/// or looking in the `growth_mapping` for the categorized growth. | |
/// | |
/// * `use_item_assumptions` - If true will prefer `GrowthAssumption`s stored in `Dossier` | |
/// * `growth_mapping` - Maps `growth_item` to growth characteristics | |
/// * _return_ - One `AssumptionDetails` instance per each `Worth`, `Holding`, `FlowSpec | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn roll_worksheet(&mut self) -> () { | |
let tax_bill = self.worksheet.fed_tax_statement.total_tax_bill; | |
if let Some(ref mut forecast_details) = self.forecast_details { | |
forecast_details.worksheets.push(self.worksheet.clone()); | |
} | |
let worksheet = self.worksheet; | |
let mut liquidation_summary = worksheet.liquidation_summary; | |
liquidation_summary.clear(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TestFunction = | |
for<'r> fn(&'r ForecastTester<'r>, forecast_test: &ForecastTest) -> TestResult; | |
type TestFunctionMap = HashMap<String, TestFunction>; | |
// --- module struct definitions --- | |
/// Reads forecast from filesystem, forecasts on them, and reports on results | |
struct ForecastTester<'a> { | |
/// Tests read from filesystem requiring validation | |
forecast_tests: &'a ForecastTestMap, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn read_from_yaml_file<T>( | |
yaml_path: &::std::path::Path | |
) -> ::std::result::Result<T, ::failure::Error> | |
where | |
for<'de> T: Deserialize<'de> + Serialize, | |
{ | |
//... | |
} | |
pub fn read_from_yaml_file<'de, T>( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '../../../codegen/rocket_gen/rocket_gen.dart'; | |
final rocketRoutes = [ | |
get('dossier') | |
..doc = 'Get a dossier' | |
..requiresDataAccess = true | |
..dynamicSegments = [ | |
dynamicSegment('dossier_id', 'i32')..doc = 'Id of `Dossier` being queried', | |
], | |
get('user') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error_chain!{ | |
errors { | |
DieselPgError(diesel_pg_action: DieselPgAction) { | |
description("Failed interaction with postgresql via diesel"), | |
} | |
} | |
} | |
// --- module enum definitions --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Wraps the `DataAccessLayer` and provides `Deref` for rocket conversion via `FromRequest` | |
pub struct DataLayer<'a> { | |
/// Underlying `DataAccessLayer` from plus_persist | |
pub data_access_layer: DataAccessLayer<'a>, | |
} | |
// --- module impl definitions --- | |
/// Implementation of trait `Deref` for type `DataLayer<'a>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use conversion::rate_curve_to_time_series; | |
use grid_return_generator::{GridReturnGenerator, return_generator_type}; | |
use item_wrappers::*; | |
use log::LogLevel::{Info}; | |
use plus_core::{DistributionBreakdown, DistributionSpec, DistributionTreatment, Dossier, ForecastConfig, ForecastStyle, ForecastSummary, PeriodBalance, TaxablePosition, Worksheet, Year, YearRange}; | |
use plus_persist::pg::LookupPair; | |
use plus_persist::{ForecastAssumptions}; | |
use rand::{SeedableRng, XorShiftRng}; | |
use std; | |
use std::cmp::{max}; |