All reference chapters

8. Account

The account is the root object of every run: every handle other than a market adapter is created from it, and every result is read back through it. This chapter covers the account's own surface — creation and destruction, the portfolio and its exposure snapshots, risk policies, reading and booking trades, result summaries, position resets, and the account-level equity and mode inputs. Throughout, C functions return TseStatus (tse_ok / tse_error) and report detail via tse_last_error(account); the C++ wrapper throws tse::Error carrying that text; the Python wrapper raises tse.TseError.

Lifecycle

An account is created with a label, a storage regime, a currency and a core id. All four are required at the C surface.

The account is the owner of everything created from it. Contracts are the one thing it does not own: tse_add_contract declares a contract in the library itself, needs no account, and returns a handle that stays good until the process ends, so one contract may be wired into any number of accounts. Everything else — the executions and the books — dies with the account. Nothing you hold has to outlive the account, and no handle taken from it stays valid past its destruction — child handles are borrowed views, not owners.

The storage regime selects the backend of the account's trade blotter — the store every executed trade is journaled into and every summary and trade query is folded over.

C constantC++PythonValueBackend
tse_storage_regime_dbStorageRegime::dbStorageRegime.Db1on-disk database store
tse_storage_regime_memStorageRegime::memStorageRegime.Mem2in-memory store

tse_storage_regime_undefined (0) exists in all three surfaces but is not a usable regime. The currency is the account's reporting currency, named by its three-letter code as a zero-terminated string: "USD", "EUR", "JPY" and every other row of the engine's currency table. A code that names no row is refused. Each account has its own reporting currency, and accounts of different reporting currencies work side by side in one run. A contract of any currency may be wired into any account: its money is brought to the account's reporting currency by the exchange rate table. coreId governs the account's blotter thread: a non-negative value pins the blotter thread to that core, a negative value runs the blotter without a separate thread.

The account owns its single execution and its books. Those child handles (TseExecHandle, TseBookHandle) are borrowed views into the account and become invalid the moment the owning account is destroyed — destroy the account last. A book is the one child a caller may also release on its own, with tse_book_destroy, and the handle dies at that call rather than with the account; the book chapter states the rule. The one exception is the ex-post handle, which the caller owns and destroys explicitly, but which still borrows the account it was created from. A market adapter is not a child handle at all: it is created on its own with tse_market_create, and the handle that created it shares it with every account it is handed to — by an input builder, by tse_portfolio_subscribe, by tse_portfolio_unsubscribe or by tse_bind_input. tse_market_destroy releases only the caller's share; the adapter lives until its last holder is gone, so the adapter and the accounts that use it may be destroyed in any order. An adapter may be handed to any number of accounts, whatever their reporting currencies: an adapter carries no currency of its own.

Contracts are declared before anything that uses them, and they stay for the whole life of the process. Every input, rule, portfolio registration, booking call and trade query names a contract by the handle tse_add_contract returned: a null handle is an error. There is no call that removes a declared contract.

The same deadline covers everything else the account owns. Its composition is fixed by its first start: market adapters, the execution, inputs, patterns, rules, robots and the feeds they need are handed over before the first tse_start, and the account takes no further declarations once a robot has started.

TseAccountHandle tse_account_create(char const* accountLabel, TseStorageRegime regime,
                                    char const* currency, int coreId);
void tse_account_destroy(TseAccountHandle account);
explicit tse::Account(std::string accountLabel, StorageRegime regime,
                      std::string currency = "USD", int coreId = -1);
~Account();   /* move-only; the destructor destroys the underlying handle */
account = tse.Account(account_label, regime, currency="USD", core_id=-1, lib_path=None)
account.close()   # also called by __del__

The blotter file of one account

An account in the db regime journals its trades into a file. Where that file goes is decided once, when the account is built, and it can be decided in two ways.

Left alone, the engine derives the file from the account label: the name is the label followed by _Blotter_retained_trades.sqlite3.db, and the folder is the one configured through TseInitialParams.dataFolderPath, or the folder of the running executable when no data folder has been configured. That folder is a property of the process, so every account of the process shares it.

One blotter file belongs to one account. The engine keeps no register of open files and will not stop you: two accounts given the same path, or two accounts whose labels derive the same path, both open the file and both write into it. The one case it does refuse is a second account whose reporting currency differs from the one the file already carries. Where the currencies agree, both accounts write, and each then answers only for the trades it journaled itself: a trade query that names a contract the other account traded returns nothing and says so only in the log, while a query that names no contract folds over every row in the file, including the other account's. Keeping one file to one account is therefore yours to do, and a shared file does not fail loudly - it reports less than the file holds.

Given a path, the engine uses it instead. This is the way to put one account's trades somewhere of your own choosing, and the way to keep two accounts of one process apart. Three things are worth knowing about a given path.

WhatBehaviour
The folderKept exactly as given. The configured data folder plays no part, and the engine does not create the folder: a folder that does not exist, or one you may not write to, is a refusal.
The file nameThe ending _retained_trades.sqlite3.db is appended when the name does not already carry it. The file the account actually works with is therefore not always the path you passed; read it back with tse_account_blotter_db_path.
The regimeA given path requires tse_storage_regime_db. The mem regime keeps no file of its own, so a path handed to it is a contradiction and the call refuses.

A refusal returns no handle. The reason is readable through tse_last_init_error, which carries either the engine's own message or the reason the call refused before reaching the engine. The C++ and Python wrappers turn the same text into tse::Error and tse.TseError.

Reading the file back works for either way of deciding it, so it is also how you learn where a derived file landed. An account in the mem regime has no file and the call refuses.

TseAccountHandle tse_account_create_at_path(char const* accountLabel, TseStorageRegime regime,
                                           char const* currency, int coreId,
                                           char const* blotterDbFilePath);

TseStatus tse_account_blotter_db_path(TseAccountHandle account, char* outPath,
                                      size_t capacity, size_t* outLength);
explicit tse::Account(std::string accountLabel, StorageRegime regime, std::string currency,
                      int coreId, std::string blotterDbFilePath);

std::string blotterDbPath() const &;
account = tse.Account(account_label, regime, currency="USD", core_id=-1,
                      blotter_db_path=None, lib_path=None)
path = account.blotter_db_path()

outLength receives the length of the path without the terminating zero. When outPath is given and capacity is not zero, the path is copied into it and terminated, truncated to the capacity if it does not fit; passing a null outPath asks for the length alone.

Starting from an already-open position

A desk that already holds a position starts the run holding it. Both creation entries have a seeding form that takes the open positions as an array and builds them into the account's exposure at the moment the account is created, before any market data and before any trade. Nothing is executed and nothing is journaled: the positions are simply there, readable through tse_get_position_state the instant the handle is returned, and the contracts they name are registered in the portfolio by the act of seeding, so tse_portfolio_add_contract is not needed for them.

One record describes one position.

FieldType
contractTseContractHandle
quantitydouble
acquisitionPriceTsePrice
acquisitionPriceTsNanosecondsint64_t
marketPriceTsePrice
marketPriceTsNanosecondsint64_t
sideTseSide

Four things are fixed about that record. The contract is named by its handle, so it must have been declared with tse_add_contract first. The library raises the market-price flag of the position itself, so the market price given here is the position's mark until the first quote arrives. The highest and the lowest price the position has seen are not seedable: the record has no field for them, and a trailing protective order placed on a seeded position therefore measures from the first price that arrives rather than from a past the engine cannot verify. There is no field for the unrealized result, because the engine computes it from the two prices, the quantity and the contract's multiple.

The set is taken whole or refused whole. A record whose contract is null refuses the account and the reason names the position of that record in the array; a contract that appears twice refuses the account and the reason names the contract; a side and a quantity that contradict each other — a long or short side with a zero quantity, a neutral side with a non-zero one, or the undefined side — refuse the account as an incongruent snapshot. In every case no account is created and the reason is readable through tse_last_init_error, exactly as for tse_account_create_at_path. A seed count of zero is not an error: it creates an ordinary account, and with a count of zero the array pointer may be null.

What the seeded account does not carry is as fixed as what it does. The seeded position reaches neither the trade journal nor the save recipe: tse_get_trades over a freshly seeded account returns nothing, a summary over it reads as a summary over an empty account, and a robot saved from it and loaded elsewhere comes back flat while the contract descriptions survive. Seeding states a position; it does not account for a transaction. Where the transaction accounting and the booked profit and loss are the subject, the booking calls below are the entry points.

TseAccountHandle tse_account_create_seeded(char const* accountLabel, TseStorageRegime regime,
                                           char const* currency, TseSeededPosition const* seeds,
                                           size_t seedCount, int coreId);

TseAccountHandle tse_account_create_at_path_seeded(char const* accountLabel, TseStorageRegime regime,
                                                   char const* currency, TseSeededPosition const* seeds,
                                                   size_t seedCount, int coreId,
                                                   char const* blotterDbFilePath);
explicit tse::Account(std::string accountLabel, StorageRegime regime, std::string currency,
                      int coreId, std::vector<SeededPosition> const& seeds);

explicit tse::Account(std::string accountLabel, StorageRegime regime, std::string currency,
                      int coreId, std::string blotterDbFilePath,
                      std::vector<SeededPosition> const& seeds);
account = tse.Account(account_label, regime, currency="USD", core_id=-1,
                      blotter_db_path=None, seeded_positions=None, lib_path=None)
seed = tse.make_seeded_position(contract.handle, quantity, acquisition_price,
                                acquisition_price_ts_nanoseconds, market_price,
                                market_price_ts_nanoseconds, side)

Python folds all four cases into the one constructor: neither a path nor a set gives the plain account, a set alone gives the seeded one, a path alone gives the at-path one, and both give the at-path seeded one. A set given as an empty sequence is still a set, and is distinct from no set at all.

Portfolio and exposure

The portfolio tracks one exposure node per contract plus an account-wide aggregate. Which (adapter, contract) pairs are marked to market is an explicit selection: a robot's traded contracts are auto-subscribed when the robot starts, and the subscribe calls exist for extra, non-traded contracts you also want marked. Subscribing registers the contract on the adapter. tse_portfolio_add_contract registers a declared contract's position in the portfolio without any market adapter: the position exists and can be moved by manual booking, but it is not marked to market. Registration is idempotent.

Both levels can be snapshotted at any time after the account has processed data.

tse_get_position_state returns tse_error for an unknown contract. isEmpty is not a flatness flag: it marks the sentinel of an absent exposure node — a placeholder position that has never carried state. Whether a position is flat is read from realizedQuantity and realizedSide. In the same placeholder case the multiple field carries TSE_ABSENT_MULTIPLE (0, mirrored as tse.ABSENT_MULTIPLE in Python), so a consumer needs one check, not two. The two market values of a position differ in sign as well as in coverage: realizedMarketValue carries the sign of the price the position is marked at, so a negative mark makes it negative, while combinedMarketValue is always a magnitude.

Both snapshots report two views of the same book. The realized view is what has actually been filled: realizedQuantity, realizedMarketValue and realizedSide move on fills alone. The combined view is the filled part together with the intentions of orders that have not finished: while an order rests, the engine holds a reservation for it, and combinedQuantity, combinedMarketValue and combinedSide carry that reservation alongside the fills. The two views agree whenever nothing is resting and part ways the moment something is — a short position of 7 under a resting buy of 9 reads short 7 on the realized view and long 2 on the combined one. Read the realized view to learn what the account owns; read the combined view to learn what the account has already committed, which is what a pre-trade gate, an inventory band or a quoting decision has to weigh the next order against. At portfolio level both market values are magnitudes and the side of the realized market value is not reported: realizedSide there is the side of the acquisition value. The portfolio aggregate carries no quantity at all, because quantities of different instruments are not summable.

The account-wide aggregate is reported as a TsePortfolioState.

FieldType
realizedMarketValuedouble
combinedMarketValuedouble
acquisitionValuedouble
unrealizedPLdouble
realizedSideTseSide
combinedSideTseSide
latestUpdateNanosecondsint64_t

One contract's position is reported as a TsePositionState.

FieldType
realizedQuantitydouble
combinedQuantitydouble
realizedMarketValuedouble
combinedMarketValuedouble
acquisitionValuedouble
unrealizedPLdouble
acquisitionPriceTsePrice
acquisitionPriceTsNanosecondsint64_t
marketPriceTsePrice
marketPriceTsNanosecondsint64_t
realizedSideTseSide
combinedSideTseSide
multipleuint32_t
isEmptyint32_t
TseStatus tse_portfolio_subscribe(TseAccountHandle, TseMarketHandle market, TseContractHandle contract);
TseStatus tse_portfolio_unsubscribe(TseAccountHandle, TseMarketHandle market, TseContractHandle contract);
TseStatus tse_portfolio_add_contract(TseAccountHandle, TseContractHandle contract);

TseStatus tse_get_portfolio_state(TseAccountHandle, TsePortfolioState* out);
TseStatus tse_get_position_state(TseAccountHandle, TseContractHandle contract, TsePositionState* out);
PortfolioState getPortfolioState() const &;
PositionState  getPositionState(Contract const& contract) const &;   /* isEmpty is a bool here */
state = account.get_portfolio_state()            # TsePortfolioState
pos   = account.get_position_state(contract)     # TsePositionState

Risk policies

A risk policy is a named, account-attached constraint checked by the engine before an order that would increase exposure is allowed out. Three kinds exist:

C constantC++PythonValueMeaning
tse_risk_policy_valueRiskPolicy::valueRiskPolicy.Value0limit on position/portfolio market value
tse_risk_policy_quantityRiskPolicy::quantityRiskPolicy.Quantity1limit on position quantity (per-contract)
tse_risk_policy_time_periodRiskPolicy::time_periodRiskPolicy.TimePeriod2trading window

A threshold policy holds while <metric> <comparison> threshold. The value policy compares market value; the quantity policy compares position quantity and is per-contract only — attached portfolio-wide it never holds. Scope is chosen by the contract: passing contract = NULL (C), nullptr (C++), or None (Python) makes the policy portfolio-wide; a contract handle makes it per-contract. Note the C parameter order: contract precedes threshold and comparison.

The time-period policy is a trading window on a repeating cycle: cyclePeriodNs is the cycle length, offsetNs the window start inside the cycle, activeDurationNs the window length — all in nanoseconds. The policy holds while the local wall-clock time falls inside the active window. The cycle and the active duration must be positive, the active duration must not exceed the cycle, and the offset is normalized into the cycle. timeZoneName is an IANA zone name ("America/New_York"); NULL or an empty string selects the host machine's current time zone, and an unknown name fails the call with a diagnostic.

While any attached policy does not hold, order submissions and amendments that would increase exposure are refused: the transaction is rolled back, never reaches the execution, and the refusal is logged with the policy's diagnostic. Transactions that do not increase exposure — reductions and closes — are not blocked, so a robot can always trade out of a position that a policy has capped.

TseStatus tse_add_risk_policy(TseAccountHandle, char const* label, TseRiskPolicyType policyType,
                              TseContractHandle contract, double threshold, TseCmp comparison);
TseStatus tse_add_risk_policy_time_period(TseAccountHandle, char const* label, TseContractHandle contract,
                                          int64_t cyclePeriodNs, int64_t offsetNs,
                                          int64_t activeDurationNs, char const* timeZoneName);
TseStatus tse_remove_risk_policy(TseAccountHandle, char const* label, TseContractHandle contract);
/* note: the contract moves to the last position and may be omitted */
void addRiskPolicy(std::string label, RiskPolicy policyType, double threshold, Cmp comparison,
                   Contract const* contract) &;
void addRiskPolicyTimePeriod(std::string label, Contract const* contract,
                             std::int64_t cyclePeriodNs, std::int64_t offsetNs,
                             std::int64_t activeDurationNs, std::string timeZoneName = std::string()) &;
void removeRiskPolicy(std::string label) &;
void removeRiskPolicy(std::string label, Contract const* contract) &;
account.add_risk_policy(label, tse.RiskPolicy.Value, threshold, tse.Cmp.Le, contract=None)
account.add_risk_policy_time_period(label, contract, cycle_period_ns, offset_ns,
                                    active_duration_ns, time_zone_name="")
account.remove_risk_policy(label, contract=None)

Trades: reading and booking

Every executed trade is journaled into the blotter as a TseTrade record: the identifiers and labels, the transaction itself, and two exposure snapshots taken at booking time — the contract exposure (ce* fields) and the portfolio exposure (pe* fields).

FieldType
clientOrderIdchar[32]
brokerOrderIdchar[32]
symbolchar[32]
ruleLabelchar[64]
robotLabelchar[64]
tsMktEventNanosecondsint64_t
tsExecutionNanosecondsint64_t
priceTsePrice
quantitydouble
feedouble
bookedPLdouble
txnSideTseSide
posSideTseSide
bookModeint32_t
executionint32_t
ceQuantitydouble
ceUnrealizedPLdouble
ceAcquisitionPriceTsePrice
ceAcquisitionPriceTsNanosecondsint64_t
ceMarketPriceTsePrice
ceMarketPriceTsNanosecondsint64_t
ceHighTsePrice
ceHighTsNanosecondsint64_t
ceLowTsePrice
ceLowTsNanosecondsint64_t
ceSideTseSide
peAcquisitionValuedouble
peMarketValuedouble
peUnrealizedPLdouble
peSideTseSide

Two sentinels mark a position that carries no observed extreme yet: TSE_ABSENT_HIGH_PRICE ({INT64_MIN, 0}) in ceHigh and TSE_ABSENT_LOW_PRICE ({INT64_MAX, 0}) in ceLow, with the matching timestamps written as zero; a field holds the marker when its significand equals the marker's significand. They are the neutral elements of the running-extreme accumulation, so they can never collide with a real price, whose significand at scale 6 carries at most about 9.22e12. The C++ wrapper exposes them as tse::absentHighPrice / tse::absentLowPrice, Python as tse.ABSENT_HIGH_PRICE / tse.ABSENT_LOW_PRICE.

Reading trades

The reader's boundary conventions are fixed as part of the ABI. A zero fromNanoseconds means one second past the 1970 epoch and a zero toNanoseconds means the 2100 epoch, so zero bounds mean "no bound" for every run whose trades carry real timestamps; a trade stamped inside that first second lies outside the window and is left out of the answer without a word. A NULL robotLabel (an empty or omitted label in C++ and Python) selects all robots. The buffer protocol is capacity-in / count-out: pass the capacity of outTrades in *inoutCount, and on return it holds the number actually written; when the capacity is smaller than the number of available trades the surplus is silently not written — query the required count first by passing a null outTrades. The C++ and Python wrappers run that two-call protocol internally and return the full list.

TseStatus tse_get_trades(TseAccountHandle, int64_t fromNanoseconds, int64_t toNanoseconds,
                         char const* robotLabel, TseTrade* outTrades, size_t* inoutCount);
std::vector<Trade> getTrades(std::int64_t fromNanoseconds = 0, std::int64_t toNanoseconds = 0,
                             std::string robotLabel = std::string()) const &;
trades = account.get_trades(from_nanoseconds=0, to_nanoseconds=0, robot_label=None)

Booking external trades

Externally executed trades enter the account through the booking functions declared in tse_trades.h. Their input record is TseRetained, defined in tse_retained.h — the same retained-trade record that crosses the boundary in the executed market-data feed. No field of it is defaulted by the library: the caller answers for bookMode, execution and priorityType exactly as for price and quantity. Label capacity is 64 bytes (63 useful characters), identifier and symbol capacity is 32 bytes (31 useful characters); longer values are rejected on input with a diagnostic. The record addresses its contract by the contract handle; a null handle is rejected.

The two modes differ in what they touch. tse_book_trade moves the position: the contract must already be in the portfolio (registered with tse_portfolio_add_contract or subscribed with tse_portfolio_subscribe), and the library snapshots the exposure before the change, applies the trade to the portfolio, then journals it. The trade's posSide field is ignored — the library substitutes the actual side of the position. outBookedPL receives the P&L booked by the journal; on a position reversal it covers the closing leg only.

tse_book_trade_with_exposure is a pure P&L calculator with a journal write: the caller supplies both exposure snapshots (TseContractExposure and TsePortfolioExposure, both declared in tse_trades.h), the portfolio is not touched, and the function is therefore usable for a contract that is not in the portfolio at all. In this mode the trade's posSide is taken exactly as passed and must be definite, as must the side fields of both snapshots. Python folds both modes into the single book_trade method: no snapshots selects the moving mode, both snapshots select the calculator, and exactly one snapshot raises TseError. Python builds the inputs with the tse.make_retained, tse.make_contract_exposure and tse.make_portfolio_exposure helpers.

TseStatus tse_book_trade(TseAccountHandle, TseRetained const* trade, double* outBookedPL);
TseStatus tse_book_trade_with_exposure(TseAccountHandle, TseRetained const* trade,
                                       TseContractExposure const* contractExposure,
                                       TsePortfolioExposure const* portfolioExposure,
                                       double* outBookedPL);
double bookTrade(Retained const& trade) &;
double bookTradeWithExposure(Retained const& trade, ContractExposure const& contractExposure,
                             PortfolioExposure const& portfolioExposure) &;
pl = account.book_trade(trade)                                       # moves the position
pl = account.book_trade(trade, contract_exposure, portfolio_exposure)  # pure P&L calculator

A position the engine did not open

A position that is already there when a robot starts — seeded at account creation, or moved into place by tse_book_trade — is a real position to the engine, and the order state machine is told so. Each robot keeps one order pool per contract it trades, and that pool is created when the robot is created. At that moment the engine reads the contract's position and, if the position has a side, starts the pool in the open state instead of the undefined one.

The consequence is the one that matters in practice: a closing, reducing or rebalancing rule aimed at such a position is accepted, where in the undefined state it would have been refused for naming an exit with nothing to exit from. The symmetry holds too — an entry rule against it is refused for requiring a flat position, exactly as it would be refused after a genuine fill. A contract whose position is flat, and a contract the portfolio does not carry at all, leave the pool in the undefined state, so an entry remains the only thing admitted there.

Two boundaries are worth stating. The pool belongs to a robot and a contract together, so a contract no rule of any robot names gets no pool at all, whatever its position. And the reading happens once, when the pool is created: a position established after the robot was created does not shift the state of a pool that already exists.

Summaries

A summary is a fold over booked trades. The whole-account form folds over everything; the per-robot form folds over that robot's trades only.

tsFirstNanoseconds and tsLastNanoseconds are the execution timestamps of the first and last transactions in the fold. maxEquity and minEquity are the running extremes of the equity curve seated on the account's starting equity (see the last section); returnOnAccount is the total net profit divided by the starting equity, and reads zero while the starting equity is zero. profitFactor reads 1 when the gross loss is zero. tse_get_summaries fills one TseSummary per robot, in the order the robots were added, with the same capacity-in / count-out protocol as tse_get_trades: pass a null outSummaries to query the robot count without writing.

The fold is reported as a TseSummary record.

FieldType
tsFirstNanosecondsint64_t
tsLastNanosecondsint64_t
totalNetProfitdouble
grossProfitdouble
grossLossdouble
totalNumberOfTradesint64_t
avgTradeNetProfitdouble
profitFactordouble
maxEquitydouble
minEquitydouble
maxDrawdowndouble
returnOnAccountdouble
TseStatus tse_get_summary(TseAccountHandle, TseSummary* outSummary);
TseStatus tse_get_robot_summary(TseAccountHandle, char const* robotLabel, TseSummary* outSummary);
TseStatus tse_get_summaries(TseAccountHandle, TseSummary* outSummaries, size_t* inoutCount);
Summary getSummary() const &;
Summary getRobotSummary(std::string robotLabel) const &;
std::vector<Summary> getSummaries() const &;
summary   = account.get_summary()
summary   = account.get_robot_summary(robot_label)
summaries = account.get_summaries()

Resetting positions

Two calls return exposure to a pristine state without rebuilding the account.

A reset position is equal to a freshly constructed one: the exposure node is replaced by a new node that carries only the contract's multiple, so quantities, values, prices and the observed-extreme history are all zeroed, and the sides return to neutral. The wiring survives — portfolio subscriptions and registered contracts are preserved, so data keeps flowing and the position can be moved again immediately. tse_reset_portfolio resets every contract node and zeroes the portfolio aggregate; tse_reset_position resets one contract and then recomputes the portfolio aggregates from scratch over the remaining positions, and returns tse_error for an unknown contract.

A reset is refused while a reservation is live, because replacing the node would drop a reservation the order management still holds, and the order's next amendment would then be rejected on a reservation nobody knows about. tse_reset_position returns tse_error when that contract carries a resting order; tse_reset_portfolio returns tse_error when any contract does, and in that case it changes nothing at all — no position is left half reset. The refusal text names the condition, and the log names the contract holding the reservation. Cancel the orders, or let them finish, and the reset passes.

TseStatus tse_reset_portfolio(TseAccountHandle);
TseStatus tse_reset_position(TseAccountHandle, TseContractHandle contract);
void resetPortfolio() &;                            /* throws tse::Error on failure */
void resetPosition(Contract const& contract) &;   /* throws tse::Error on failure */
account.reset_portfolio()
account.reset_position(contract)

Equity

Two account-level inputs feed the summary and scoring projections.

startingEquity drives returnOnAccount and seats the equity-curve baseline that maxEquity and minEquity are measured from; riskFreeRate feeds the Sharpe-family scores of the ex-post projections. Until the call is made both inputs read as zero, which in turn pins returnOnAccount at zero.

TseStatus tse_set_account_equity(TseAccountHandle, double startingEquity, double riskFreeRate);
void setAccountEquity(double startingEquity, double riskFreeRate) &;
account.set_account_equity(starting_equity, risk_free_rate)

Version 6.1.0.0. Also as Markdown: this chapter, the whole reference in one file, and the llms.txt map.