25 m.doc() =
"Financial simulation C++ models";
28 py::enum_<ExecutionTiming>(m,
"ExecutionTiming")
29 .value(
"StartOfPeriod", ExecutionTiming::StartOfPeriod)
30 .value(
"EndOfPeriod", ExecutionTiming::EndOfPeriod);
32 py::class_<Schedule>(m,
"Schedule")
40 py::class_<Event, std::shared_ptr<Event>>(m,
"Event")
46 py::class_<IncomeEvent, Event, std::shared_ptr<IncomeEvent>>(m,
"IncomeEvent")
47 .def(py::init<SimTime, std::string, double, std::string, std::string>(),
48 py::arg(
"timestamp"), py::arg(
"source_id"), py::arg(
"amount"),
49 py::arg(
"category"), py::arg(
"target_account") =
"")
54 py::class_<ExpenseEvent, Event, std::shared_ptr<ExpenseEvent>>(m,
"ExpenseEvent")
55 .def(py::init<SimTime, std::string, double, std::string, std::string>(),
56 py::arg(
"timestamp"), py::arg(
"source_id"), py::arg(
"amount"),
57 py::arg(
"category"), py::arg(
"target_account") =
"")
62 py::class_<AssetEvent, Event, std::shared_ptr<AssetEvent>>(m,
"AssetEvent")
63 .def(py::init<SimTime, std::string, std::string, double, double>())
68 py::class_<LiabilityEvent, Event, std::shared_ptr<LiabilityEvent>>(m,
"LiabilityEvent")
69 .def(py::init<SimTime, std::string, std::string, double, double>())
74 py::class_<AccountEvent, Event, std::shared_ptr<AccountEvent>>(m,
"AccountEvent")
75 .def(py::init<SimTime, std::string, std::string, double, double, std::string>(),
76 py::arg(
"timestamp"), py::arg(
"source_id"), py::arg(
"account_id"),
77 py::arg(
"balance"), py::arg(
"delta"), py::arg(
"reason"))
83 py::class_<TransferEvent, Event, std::shared_ptr<TransferEvent>>(m,
"TransferEvent")
84 .def(py::init<SimTime, std::string, std::string, std::string, double, std::string>(),
85 py::arg(
"timestamp"), py::arg(
"source_id"), py::arg(
"from_account"),
86 py::arg(
"to_account"), py::arg(
"amount"), py::arg(
"reason"))
93 py::class_<EventBus>(m,
"EventBus")
102 py::class_<Model, std::shared_ptr<Model>>(m,
"Model")
112 py::class_<IncomeBase, Model, std::shared_ptr<IncomeBase>>(m,
"IncomeBase")
113 .def(py::init<std::string, std::string, Schedule>());
115 py::class_<CareerJob, IncomeBase, std::shared_ptr<CareerJob>>(m,
"CareerJob")
116 .def(py::init<std::string, std::string, double, SimTime>(),
117 py::arg(
"id"), py::arg(
"name"), py::arg(
"annual_salary"), py::arg(
"start_day") = 0.0)
121 py::class_<ExpensesBase, Model, std::shared_ptr<ExpensesBase>>(m,
"ExpensesBase")
122 .def(py::init<std::string, std::string, Schedule>());
124 py::class_<AssetsBase, Model, std::shared_ptr<AssetsBase>>(m,
"AssetsBase")
125 .def(py::init<std::string, std::string, Schedule>());
127 py::class_<LiabilitiesBase, Model, std::shared_ptr<LiabilitiesBase>>(m,
"LiabilitiesBase")
128 .def(py::init<std::string, std::string, Schedule>());
131 py::enum_<LogLevel>(m,
"LogLevel")
132 .value(
"DEBUG", LogLevel::DEBUG)
133 .value(
"INFO", LogLevel::INFO)
134 .value(
"WARN", LogLevel::WARN)
135 .value(
"ERROR", LogLevel::ERROR);
137 py::class_<LogWriter, LogWriterPtr>(m,
"LogWriter")
141 py::class_<ConsoleWriter, LogWriter, std::shared_ptr<ConsoleWriter>>(m,
"ConsoleWriter")
144 py::class_<JsonWriter, LogWriter, std::shared_ptr<JsonWriter>>(m,
"JsonWriter")
145 .def(py::init<const std::string&>(), py::arg(
"filename"));
147 py::class_<Logger>(m,
"Logger")
165 py::class_<AccountBase, Model, std::shared_ptr<AccountBase>>(m,
"AccountBase")
166 .def(py::init<std::string, std::string, std::string, double, Schedule>(),
167 py::arg(
"id"), py::arg(
"name"), py::arg(
"routing_tag"),
168 py::arg(
"initial_balance") = 0.0,
173 py::class_<CheckingAccount, AccountBase, std::shared_ptr<CheckingAccount>>(m,
"CheckingAccount")
174 .def(py::init<std::string, std::string, double, std::string, Schedule>(),
175 py::arg(
"id"), py::arg(
"name"),
176 py::arg(
"initial_balance") = 0.0,
177 py::arg(
"routing_tag") =
"default",
180 py::class_<SavingsAccount, AccountBase, std::shared_ptr<SavingsAccount>>(m,
"SavingsAccount")
181 .def(py::init<std::string, std::string, double, double, std::string, Schedule>(),
182 py::arg(
"id"), py::arg(
"name"), py::arg(
"apy"),
183 py::arg(
"initial_balance") = 0.0,
184 py::arg(
"routing_tag") =
"savings",