Reference / Trade execution

How Praxis and Nexus work

Praxis sends orders to a venue and keeps the record of what happened. Nexus decides what to send. One process runs both, and these short articles explain one piece each, in plain words.

Contents

How this wiki works

Each article has a word limit. One that outgrows it is split in two rather than made longer, which is why some titles are narrow. Every term is explained in the article that owns it, and linked from the others where it appears.

Both sides are the subject, and both are written. 710 articles exist. Of Praxis's own source files all 88 are accounted for in full, with none left untouched; and all 70 in Nexus are named, none untouched — 64 carry a row of their own, and 6 are reached by an article, a recorded finding, or a recorded exclusion, all six recorded as shapes with no behaviour to trace. Of the 64 Nexus modules carrying a row, all 64 are accounted for in full. What remains on both sides is depth rather than coverage.

  • The register — every topic, whether it is written yet, and everything found while reading the code.
  • The file ledger — which source files the wiki accounts for, and which it has not touched.
  • Which commits it describes — every article is written against one version of the code, and names it.
  • The article template — what every page must carry, including the word limit.

Start here

The work starts with a strategy and ends with a fill, and these seven articles follow it down that chain in order.

What a strategy must provide is what a strategy answers to. A strategy's decision is walked through the checks a decision passes before Praxis hears it, and partway down that walk Nexus sets money aside for what the trade would cost. What crosses to Praxis is named in Trades, requests and orders and belongs to an account. Praxis turns it into a send to the venue, and what comes back is reported as an outcome.

The groups below run in that same order: what Nexus decides, then what Praxis calls things and how it sends them, then what comes back, then the records, then running and replaying a host.

How a strategy decides

  • What a strategy's action is checked for — a strategy's answer is one record whose every field is weighed on its own first, and leaving a field out is never what the record refuses at that stage.
  • What each kind of action requires — once the fields are sound, the record checks what the kind of request needs, gathering every missing field into a single complaint rather than reporting them one attempt at a time.
  • When an entry may name a sum instead of a size — a request to open a position says how much either in coin or in money to spend, and the money form is allowed only for a plain purchase at whatever the market gives.
  • The two mappings an action reseals — the record copies each set of settings it is handed and puts it behind a read-only view, so neither side can write into one afterwards, though a value nested inside one stays shared.
  • What weighs a shutdown sale — an order the system approves itself still meets the guard comparing its price to the open market, and the check against the venue's own minimum size, though an order fed out in pieces misses the first of those entirely.
  • What the prediction loop's stop leaves running — the job that reads predictions and hands them to the strategies gathers its work first and then carries it out, so work gathered before the switch-off is still carried out, and can still reach a strategy and put its answer up for the usual checks.
  • Which prediction row is used — one row is taken out of a whole file of them: the unusable ones are dropped and the latest of what is left wins, whatever order the file held them in.
  • What the manifest must be — every turn starts by reading the file that says where the predictions live, and a file that is merely the wrong shape is complained about while one that is broken stops the turn by failing.
  • How a close is found for a prediction — a prediction says what to do and not at what price, so the price is looked up by an exact match on the moment, with no tolerance at all between the side that writes predictions and the side that writes prices.
  • What the cohort line records — the log says which trained cohort served each turn, and reports a change of cohort only once it has something to compare against.
  • What a failure partway through a turn leaves behind — the note of how far the loop got sits between handing a prediction to a strategy and sending what came back, so a failure before it has the work come round again and a failure after it does not.
  • How a value is made safe to log — a run of tests turns anything in a prediction into something a log line can carry, and what this loop actually sends it reaches only one of those tests.
  • Starting the loop, and one turn by hand — nothing is served at the moment of starting, and the same turn asked for directly reports a failure to its caller where the scheduled one only logs it.
  • The wrapper every strategy sits behind — each strategy is wrapped on its own, and that wrapper holds a lock which makes the strategy answer one thing at a time, while two different strategies can be answering at the same moment.
  • What a strategy must provide — what a strategy has to be able to do before it can be built at all, and the behaviour that is filled in for it — replaying what the log kept — whose filling throws away the record it is given.
  • What the router refuses — the names turned away when something asks for a strategy by name, and the mistakes that stop the whole set of strategies being assembled in the first place.
  • What a turn of a timer does — a timer fires once, and a turn of it checks whether the loop is still running before fetching what the strategy needs and again afterwards; a check that finds it stopped takes the turn no further, and the request for a successor builds nothing once the loop has stopped.
  • What a strategy is handed — the thing a strategy is given on the roads that hand it one is refused if the holdings are not a fixed run of them, if anything in that run is not a holding, if the money figure is not a finite decimal at or above nought, or if the mode is not a named one; once built, nothing on it can be swapped for something else.
  • What a strategy event is checked for — the record logged so a running loss tally can be rebuilt is rejected unless its strategy identifier and its kind are usable text and its timestamp carries the standard universal-time marker, and its profit-or-loss figure must be a decimal rather than a plain whole number, with no check comparing that figure against zero.
  • The empty reference a strategy event allows — one field of that record is rejected when it is blank but accepted when it is empty, because the test asks whether there is any content before trimming, and empty is the only way the record can say the field was not filled in.
  • What a predictor's signal is checked for — the output of a prediction is rejected unless its identifier is usable text, its payload is a dictionary with text keys, and its timestamp carries the standard universal-time marker, where whole, floating and decimal payload entries must be finite and entries of any other kind are not examined at all.
  • The sealing three records do — three records each copy a mapping they were given and lock the copy by one statement apiece, so the caller can no longer change which entries the record has, but the copy points at the same objects, so changing one of those objects in place does change what the record holds; shipping one of these records between processes unlocks and relocks it, running its checks a second time.
  • What a strategy's settings ask and answer — user-supplied configuration is rejected unless it is a dictionary, nothing inside it is examined, and asking for a setting it lacks returns whatever default the caller named.
  • What the loader asks of a path — a strategy file must be named by a relative path ending in the module suffix, and the path is resolved before being tested for staying inside the base directory, so both a path climbing out and a link pointing out are caught; past that, the file must exist.
  • What the loader asks of what it found — the module is run with any failure wrapped as one error naming the file, then it must export something under the expected name that is a class inheriting from the base and is not the base itself, and building the class wraps any failure as one error naming the strategy instead.
  • The name a strategy answers to — the base keeps the identifier stripped of surrounding whitespace and rejects a whitespace-only one, unlike the shared helper Praxis names its records by, and the router strips when filing and when looking up, so a call naming a strategy with padding still finds it.
  • Starting and stopping the timers — starting is ignored while the loop already runs and otherwise schedules one countdown per declared timer from a mapping copied at construction, stopping clears the flag and cancels every pending countdown, and a countdown already firing is never cancelled: it reads the flag itself, before it calls the strategy.
  • What each action is submitted inside — every action is handled inside a bound context carrying the strategy id and action type, plus trade and command ids where present but nothing naming the action itself; an abort forks away first, and a context builder raising an ordinary failure costs that action alone.
  • When a submission does not reach capital — converting a submission into a tracked order is skipped for a non-submitted status, a missing command id, or no reservation, which is the ordinary course for aborts, exits and amendments; but the reservation is taken before the send, so a skip never means the account was left alone.
  • What an abort and a modify answer with — an instruction that goes out without a command being built for it comes back refused, failed on the way out, or sent; a request to change an order already placed is refused for any of several missing pieces, where a request to stop one is refused only for a missing name.
  • How the walk over a strategy's actions ends each one — each instruction a strategy returns is dealt with in turn and leaves exactly one reply in a growing list, every route carrying its own reply rather than meeting at a common ending, and nothing is given back until the last one is done.
  • What Nexus does when a command does not get across — the money comes back on every road but one, and that one keeps it on purpose.

The checks a decision passes

  • The checks a decision passes — a given list walked in order until one refuses, and most of it skipped for an action that closes rather than commits.
  • What a check must answer with — two shapes an answer may take, and the answers the walk declines to interpret at all.
  • What the price check weighs — the check that looks at the market stops a trade for a number being absent as readily as for one being out of bounds.
  • What the price records refuse — the reading of the market and the record of limits each refuse what they are built from, and every field of the reading may be left out entirely.
  • The per-strategy caps, trimmed and sealed — a limit set for one strategy is filed under its name with the padding removed, and two names that become the same once trimmed are refused rather than one quietly winning.
  • How the price limits are built from the configuration — one field is converted from seconds to milliseconds, the rest are passed through unexamined, and the record they are handed to is what weighs them.
  • Who is told about a price refusal — a refusal is sorted into one of three groups that mark who should hear about it, and a reason nobody has sorted yet lands in the middle group by default.
  • What each check weighs — six checks stand between a strategy's decision and the venue, and they look at quite different things: the order itself, what the account has lost, and whether the venue is answering.
  • What the first stage weighs before the mode — a name with space around it, a request worth nothing, and a strategy whose whole allowance is nothing are each turned away before trading state is looked at, while a request to close or to alter an order is named as exempt from the amount test and the allowance test rather than having to clear them.
  • The cap on how fast entries may go in — a limit on how many entries this one check lets by in a second is shared by every strategy on one account, so a busy strategy can spend it all and leave the others turned away.
  • The window that turns a repeated entry away — a strategy sending the same labelled order twice inside a second has the later one refused, and labels are remembered against the strategy that sent them, so two strategies using one label do not collide.
  • The order the health stage's checks stand in — a figure offered to the checks on the trading side's condition is turned away for what kind of thing it is before its size is ever looked at, and a whole field is turned away for its shape before anything inside it is read.
  • The orderings the health stage's policy insists on — each measurement's alert, act and halt limits have to run one way, and which way depends on the measurement; leaving the middle limit out means the outer two are never put side by side.
  • What a risk limit must be — each configured limit may be omitted, and one that is supplied has to be a finite Decimal of zero or more; omitting a limit skips only its comparison, since every metric is computed and paired with its limit beforehand, and the comparison is strict, so a metric sitting exactly on its limit is allowed.
  • The levels the risk stage never reaches — the walk over the account's losses returns either a breach or nothing, never a warning or a halt, so the branch that converts a breach or a halt into a rejection has one arm that cannot fire here, though the identically written branch in the health stage has both live.
  • What the capital stage refuses — a reservation lifetime supplied to the stage has to be an integer above zero, with a boolean caught by a test of its own because the integer test would accept it, an omitted lifetime passing nothing on so the controller's default stands, and a denial whose reason is empty or blank being given a standing message.
  • What the walk is built from — the stage order must be a tuple holding every stage exactly once, the checks must be a mapping with a callable entry for each stage the order names, and entries the order does not name are never examined, so one that is uncallable is neither rejected nor retained.
  • What the platform's ceilings must be — the ceilings record and the figures record each walk their own fields, every one optional and any supplied one required to be a finite non-negative Decimal, with the utilization field in each held to a further ceiling of one by a test that runs after the walk.
  • The order the intake hooks stand in — a mode check runs before any hook, then the duplicate-window hook is built first and the reference hook second, with a resolved rate cap inserted ahead of both; each rejects a non-integer or non-positive figure at build time, and each ignores anything but an entry.
  • What the intake stage holds its hooks to — the first stage of checking throws an error rather than turning a trade away when a check it runs replies with the wrong sort of thing, and the stage's own approval is its own, not any check's.
  • What an intake hook keeps between calls — the checks that count events over a period build their tally and its lock once and share them across every call, read the clock a single time per call, and can be handed a clock of their own.
  • What the reference check asks of a change or a stop — a request to change an order is matched against a list that can be fetched fresh, while a request to stop one is matched against a list fixed when the check was built, so an order that became stoppable since then is unknown to one and known to the other.
  • What intake asks of an exit — an exit must be a SELL, name a trade with an open position, own that position, give a size above zero, and keep that size within what remains after already-pending exits, each asked only once the previous one passes.
  • What the halted mode turns away — while the system is coming down, a strategy's request to open, close or alter is refused by the usual checks, yet two kinds of order still go out, one of them closing positions by a route that skips those checks.
  • What a pending sale refuses — the cap on selling the same holding twice is applied by the first check a request meets, and the sales a host fires off as it shuts down never meet it.

Setting money aside

  • What becomes of money set aside — money held back for a trade that never happens stays held back until something else comes along and asks.
  • What a settling fee does to the figure — the gap between a guessed trading cost and what the report says it came to moves two balances in opposite directions, and can raise the money held against a strategy without anyone committing more.
  • When a reservation times out — money held for a trade that never went out is given back by a sweep at the start of a fresh request, and an order finding its own hold already expired hands the money back itself rather than waiting for that sweep.
  • Releasing an order whose record was lost — where the system knows an order by name but has lost everything else about it, the money behind it is given back from the name alone, and asking about an order that was never there is treated as success.
  • What a write of the whole state waits on — once the locks covering the account have been handed over, saving the whole picture takes whichever of them the money works under, so it waits on whichever of the money's own jobs is holding it; the job that sets money aside holds it from the moment it takes it until it answers.
  • What money held for an order is checked for — the record of capital set aside is rejected unless its own identifier and the requesting strategy's are both usable text, and unless each of its two amounts is a real number, with each amount check rejecting a figure below zero rather than one standing at it.
  • The two moments a hold carries — that record stores when it was created and when it lapses, each needing the standard universal-time marker, and the lapse must fall strictly later, so a record cannot lapse at the instant it was created.
  • What a hold is asked after it exists — once the record is built, two things are read off it: its amounts added together, worked out afresh each time and named by none of its own checks, and whether it has lapsed, which rejects a supplied time lacking the standard marker and answers yes exactly at the lapse.
  • What the record of an attempt must carry — the result of a request for capital must pair a yes with a filled record field and an empty explanation, or a no with a filled explanation and an empty record field, as four separate checks, none of which examines the type of any of its three fields.
  • What the capital record refuses — the pool must be finite and above zero, five further figures finite and zero or more, and the per-strategy mapping must be a mapping whose keys are non-blank strings and whose values are finite non-negative Decimals, the mapping being rebuilt and written back over the field it arrived in.
  • The key this record will not trim for you — a strategy id with surrounding whitespace is rejected by the capital record and by the strategy declaration, stripped and kept by the strategy base and the router, and carried as supplied by a command crossing the seam, so which record a padded name meets first decides its fate.
  • What a tracked order must be — its three identifiers must be strings with content after stripping, though it stores them unstripped; its three amounts must be finite non-negative Decimals with the unfilled part never exceeding the whole; its state must be either sent-and-unacknowledged or acknowledged-and-resting; and its timestamp must carry the UTC marker itself.
  • What the depth poller is built with — its poll interval and request span are compared against zero, its URL and token tested for truthiness alone, its depth floor asked only for finiteness and positivity with no type check, and its stuck-poll threshold required to be at least two while a not-a-number value passes and disables the check it feeds.
  • Starting and stopping the depth poller — starting raises while it already runs and otherwise clears the flag, opens a session and spawns the loop; stopping sets the flag and awaits the task, suppressing only the error a cancelled task raises, so another failure escapes with the task still held and the session still open.
  • What the feed demands of a depth payload — the reply must be an object and so must the part read from it, while the timestamp, the book version and each side of the book are looked up by key, so a missing field is reported by name and a wrong shape by what arrived.
  • What the feed keeps and what it waits on — it holds a stop signal and three tallies that all start at zero, and between requests it waits on that signal with the interval as a ceiling, so a stop lands at once rather than after the current interval.
  • What a strategy’s committed figure moves on — the money held against one strategy is raised on purpose only where it is set aside for a trade; the rest of what touches it is giving money back, except a settling fee that came in over its guess, which pushes it up in the ordinary way of things; a startup replaces it outright.
  • What a taking-out takes — releasing the money behind a sale removes what was asked for or as much as is there, and a strategy left with a sliver is dropped from the books entirely.
  • What the deployed figures out of step refuse — two records of committed money are kept, and while they disagree no new holding can be opened, though sales and cancellations go through untouched.
  • What a boot rebuilds from the positions — startup works out each strategy’s committed money again from the holdings it can see, and without that pass the first order of the new run is turned down and so is every one after it.
  • What a boot finds stranded — money the last run had committed with nothing left to give it back is written off at startup, at the risk of committing it twice.
  • What the fee reserve absorbs — trading costs are guessed before a trade and billed after it, and the account holds money back for the gap.
  • How Nexus sets money aside — a trade is weighed against its share of the pool, its strategy's budget, the free capital and a ceiling on everything deployed, and the fees are held with it.
  • What a strategy's budget is worked out from — a strategy's allowance is a slice of the pool, and where compounding is on, that slice plus whatever the strategy has made or lost, so a losing one gets less; the profit figure is checked for being usable only on the compounding road.
  • What a fill against a reservation refuses — unreadable figures throw before any lock is taken while figures that read but do not match the book come back as failures, and a working total left a hair either side of zero is snapped to zero.
  • How a rejection and a cancel mark the same failure — both do identical work to the money and label the same failures differently, one as a broken rule and the other as something to be expected, so a count of broken rules includes a race from one handler and not the other.
  • What the money keeper is built with — one figure is checked three ways as the keeper is built, the first complaint being about its type and the rest about its value; the clock it is given times everything afterwards, including the sweep a send asks for before it tracks anything.

Health and the mode

  • How far down the account is — losses are measured both from the best the account has ever been worth and from the best its closed trades have ever added up to, and those are different numbers.
  • The limits that may be left out — three configured risk limits may each be omitted and an omitted one is skipped before its own value is examined, while a limit that is supplied must be a finite decimal above zero, so zero is rejected and omission is the only way to leave one unset.
  • What a health snapshot refuses — the record of how the trading side is faring rejects a measurement that is not a real number of zero or more, caps each proportion it carries at one, and holds the consecutive-failure tally to a separate rule, where the latency and clock-drift figures have no upper bound at all.
  • What the health policy refuses — the configured limits are each rejected unless they are real numbers of zero or more, each measurement's limits must not decrease across alert, act and halt, equal limits are accepted, and the proportions are capped at one by a test that runs after the ordering ones.
  • How the mode is settled — the measurements are compared with their halting limits first and then with their acting limits, a measurement exactly at a limit counts as past it, and the answer is whichever measurement is doing worst rather than any combination of them.
  • The thresholds nothing weighs against — the alerting limit of each measurement is validated when the configuration is built and read by the ordering test, and then compared with no measurement anywhere, so changing one alters what configuration is accepted and nothing about what gets decided.
  • What the records of the mode refuse — a single hold needs a true-or-false flag, text for its reason and a timestamp or nothing, and may claim to be holding without saying since when; the mode record needs a recognised mode and a usable driver name; and the records that gather holds validate nothing at all.
  • The moments with no marker — the timestamp on the mode record and a hold’s own timestamp are each checked only for being timestamps, with no zone required and the mode record defaulting to the earliest possible instant, where the records crossing to the other side are rejected without the standard universal-time marker.
  • What stands where nothing was set — a signal hands a missing key back to the caller's own fallback, while the risk limits are simply empty until set so an unconfigured policy disables every breaker, and neither record notes anywhere that a default was taken.
  • What a recovery writes at the end — recovery finishes by setting the cumulative realized figure from the risk record's own per-strategy total, which recomputes the current drawdown while the high-water mark and the worst-ever drawdown are each kept at whichever is larger, restored or recomputed.
  • What the risk records refuse — each record sorts its figures in two: high-water marks, drawdowns and the starting capital must be finite and non-negative, while realized and unrealized P&L and the account's equity need only be finite, and the per-strategy mapping rejects a key disagreeing with the id inside its value.
  • The figures the account does not store — the day, week and month rolling-loss totals and the realized total are summed across the per-strategy records on each read rather than held, each reading one field so a change moves one total, and the sums shift when a strategy is added or dropped with no record having changed.
  • The two ways the signed figures change — each signed P&L figure has a setter that rejects a non-finite value and recomputes the drawdowns, but the record is a plain mutable dataclass, so a restore from the log writes both fields directly and leaves the drawdowns answering to the last setter call instead.

The loops Nexus runs

  • What stops a health turn — the interval between ticks is rejected at zero or below but let through for infinity or a not-a-number, because the test compares instead of asking for a real number; a failed loss refresh is logged and the tick continues, while a failed fetch or a failed evaluation abandons it and leaves the mode alone.
  • The two roads a turn's answer takes — without a controller the tick writes its answer straight through, doing nothing when the answer matches and otherwise replacing the whole record; with one, the answer is stored and the mode recomputed over every standing hold, so the result can differ from what the tick asked for.
  • The health loop's interval and mark — the interval must be an int or float and is compared against zero without ever being required to be finite, so a not-a-number interval is stored; starting is ignored while it runs, and the running flag is read three times per tick: at entry, again before anything is written, and again before the next countdown.
  • The turn that ignores the mark — a hand-driven turn skips the running-flag guard and schedules nothing, so a stopped loop still reads and applies; where a mode controller is wired the reading is arbitrated against holds and risk rather than written, and the comparison at the end suppresses only the transition log.
  • Starting and stopping the outcome loop — starting returns at once while a live worker is held and otherwise clears the stop flag and spawns one, stopping takes the worker under the lock, sets the flag, releases the lock and then waits five seconds unless told otherwise, and stopping a loop holding no worker returns before the flag is even set.
  • The stop that blocks a restart — a worker still alive when the join expires keeps its slot, which blocks a restart for exactly as long as it runs; the slot is cleared only if it still holds that same worker, while the single shared stop flag means a stop entering after a restart signals the new worker instead.
  • The lock the marking insists on — where a positions lock is supplied it must be the same object the risk record holds, or construction is refused; a record holding none fails the same test, while a loop given no lock is built without the question being asked at all.
  • The mark that ends a turn — symbols are read inside whatever guard the loop was given and the marks fetched outside it, and a mark that is missing or not a finite Decimal ends the entire turn at that point, leaving every position's unrealized figure as it stood and the later symbols unasked.
  • How the mark loop paces itself — each valuation round is scheduled by a fresh background timer made only after the previous round has finished, so the gap runs end to end and two rounds can never overlap; a stop part-way through lets the round in progress finish and schedules no other.
  • What a mark works out for each position — a holding's paper profit is the current price less the price paid, times the amount, with the direction of the trade deciding the sign; one walk builds the figure for each holding, each strategy and the whole, and nothing is written until all three are done.
  • What the mark loop leaves unguarded — the flag saying the round is on is read without the lock every write of it takes, a round can be asked for directly on a loop that was never started, and a round that throws is written to the log while the next is scheduled as usual.
  • What a loop's stop leaves running — switching off a repeating background job cancels its next run but lets the run already going finish, so a write can still land after the switch-off has returned.
  • An outcome waiting on a strategy — a report matching no strategy yet is set aside, everything after it for that command waits behind, and a wait that never ends costs them all.
  • What one pass over the parked outcomes does — each round through the set-aside reports takes one step for each command, judges every deadline against the single clock reading taken when the round began, and walks a snapshot of the names so that dropping a command partway through is safe.
  • What a tick of the outcome loop answers — the loop reports only whether it picked a report off the queue, and says the same whether the report reached its strategy, was set aside, or was filed behind an earlier one without being tried.

What Nexus writes down

  • What a checkpoint holds — the saved picture covers money, risk, holdings and trading state while what each strategy kept for itself goes to separate files; a stopping host, a timer and sometimes a start each ask for one.
  • What the thirty-day cut leaves — trimming the log goes by when each line was written, while the recent-loss figures rebuilt from what is left go by when the thing described happened, and the running total adds up what survived once repeats of one outcome are dropped.
  • How a record reaches the log — every line added to the log carries a short head saying how long it is and a number worked out from its contents, is forced out to the disk before the write is called done, and a file whose end was left torn is trimmed back to the last sound line before anything new goes on.
  • How a record is taken off the file — the file's length is noted before it is opened, the opening marker is read off the front, and each line is then found by reading a short fixed-size head that says how far the line runs; the scan that decides where to trim can leave its loop only by answering from inside it.
  • What packs a record and what forces a folder — a line going into the log is first turned into bytes as a set of named parts, among them its own position in the sequence, so a line read back says where it belongs; and the routine that makes a folder's own change stick keeps hold of nothing once it is done.
  • The version a saved record is read at — every saved record says which version of the writing made it, and one arriving without that marking is read as the oldest rather than turned away.
  • What happens to an event's version on the way in — an event's version marking is rounded down before anything looks at it, so a damaged marking is read by whichever reader the whole part names.
  • Which version an event is written at — whether an event is written in the newer form turns on one field being filled in, and the newer reader insists on that field so firmly it can only ever be refusing something this code did not write.
  • What a malformed saved record is refused as — anything that goes wrong while a saved record is being rebuilt comes back as one message, with the original failure's own words on the end and the failure itself still attached underneath.
  • The complaint folded into another — one reader writes a careful message about a bad field and the error handling around it swallows that message into a general one, and the case it was written for never reaches it.
  • The figures a risk record falls back to — a record of how far down an account is can be rebuilt from almost nothing, with one figure standing in for five others, though the writing always fills them all in.
  • What a snapshot from an earlier host is read as — a saved state gained fields over time, and reading an older one fills the gaps: some with nothing, some with a value that reads as all being well.
  • The small negative snapped to nought — money arithmetic can leave a remainder a shade below zero, which would make a saved state unreadable, so most of the money figures are nudged back to zero as they are read.
  • The copies taken before a record is written — the writing copies each list and mapping before walking it, which keeps each one whole but does not catch them all at a single moment.
  • What two writings of one state give — the same state written twice gives matching bytes for the sets of handled names and not for the mappings, which keep whatever order they were built in, so the bytes are no fingerprint of what was saved.
  • What a damaged record costs — reading the log stops at the first line that fails any of its checks, a short head, a length past the cap, a length past the file's end, a payload that runs out or a checksum that does not match and keeps only what came before it, so one bad line hides every good line written after it.
  • When a read raises instead of stopping — a line whose contents cannot be turned back into a record makes the read fail outright rather than stop, so the caller is handed nothing at all instead of the good lines before it.
  • How the checkpoint rewrites the log — trimming the log empties the file and writes the surviving lines back into that same file, so a failure part-way through leaves the file holding less than the history it stood for.
  • The timer that checkpoints while a host runs — a background job saves a picture of the state at a fixed spacing, measuring each wait from the end of the last save, and a save that fails is passed over, the turn after it making a whole new one rather than finishing the last.
  • The road that empties the log — one way of clearing the file wipes it completely, opening mark and all, and nothing in either system ever asks for it; the next write would put the mark back rather than refuse the file.
  • When the store writes without its locks — the part that saves state is handed the locks covering what it reads only after the start has already saved once, so that early save runs with none of them held.
  • Which of the store's writes take which locks — the saves it makes differ in what they lock: a save of the whole state holds the locks over what it reads, while a save of a single event holds none itself and leans on its caller to hold part of them.
  • What an entry in the log refuses — a single log record needs a recognised kind, a timestamp with no zone required, and bytes for its payload, while its ordering number is rejected only below zero and never checked for type, so a true-or-false or a fraction stands as a number there.
  • What the health report refuses — the report of how the venue is answering rejects any of four measurements that is not a real number of zero or more, caps each proportion it carries at one, and holds the consecutive-failure tally to a separate whole-number rule, with a true-or-false rejected wherever a number is wanted.
  • The same record written twice — that report exists as separate code on each side of the boundary, holding the same measurements to the same rules; running both gives the same answers, neither names the other, and nothing compares them, so a rule changed on one side alone would show only when a report accepted on one side was rejected on the other.
  • What counts as one trade — a replay's per-trade figures rest on bars grouped by a running count of the entry marks, with one trade being the held bars sharing a number and its return reached by multiplying its bars' returns rather than adding them, so two bars of a tenth give just over a fifth.
  • How the bars are cut into days — the same bars are also filed by calendar day and reported oldest first, each day carrying its compounded return in basis points and that return divided by the share of its bars holding a position, which is given as nothing at all for a day that held none.
  • How a fall from a peak is recorded — a running peak that only rises measures each bar's fall, and one test with three arms opens an episode on the first fall, deepens it while the fall worsens, and closes it on recovery with a depth in basis points and a length in days.
  • The falls that never ended — a fall still open when the walk ends records its depth and no length, so the list of depths and the list of lengths need not come to the same size and cannot be paired off position by position past that point.
  • What the series are read as — the predictions and the price columns are converted to floating-point numbers before anything examines them, so a boolean or a numeric string satisfies the check that a prediction be zero or one, while a value with no numeric form aborts the whole call as a prediction and, as a price, makes that bar untradable and splits any position spanning it into two separately costed trades.
  • Where the peak begins — the high-water mark a drawdown is measured against is seeded at the stake the equity curve starts from rather than at the curve's own opening value, so a curve already below that stake at its first evaluated bar is recorded as being in a drawdown right there.
  • The day a bar is filed under — the grouping uses the UTC calendar date of each bar's own opening timestamp, which the sole caller supplies, whereas the window those bars were selected by was filtered on their closing timestamps, so a bar opening before midnight and closing after it is grouped into the earlier date.
  • What a start reads back from a checkpoint — the stored state is read first and then overlaid by whatever state-change records the log still holds, a missing snapshot file reading as nothing at all rather than as an error, while the per-strategy loss figures are recomputed from the surviving events and the peak figures kept at whichever is larger, stored or recomputed.
  • The interval a checkpoint timer takes — the interval is rejected unless it is an int or float above zero, with a boolean caught by a test of its own, while finiteness is never required, so a not-a-number interval is stored; starting is ignored while the timer runs, and the running flag is read again both at each tick and at each rescheduling.
  • What a recovery takes before it rebuilds — the WAL's magic bytes are checked before anything is read on either road into it, the next sequence number continues from the last record the log still holds rather than the last one written, and the rolling-loss windows are measured back from the clock as recovery runs.
  • What a recovery inserts for a strategy the state forgot — a crash can leave the log holding a line about a strategy the saved state has never heard of, so a recovery puts a blank entry in for it before the sums are redone; without that, the pass that redoes them walks only what the saved state already named and the strategy's first result is lost.
  • What a refresh of the loss windows reads — the periodic re-reckoning of recent losses reads the log itself rather than being given anything, times its windows from the clock at the moment it runs, and zeroes a strategy whose losses have all aged out.
  • The two readings of the log — both walk the WAL from the start and both treat a missing file, an unreadably short header and a torn tail alike, but a header that is present and wrong raises on the strict read and reads as no records on the tolerant one, as do an over-cap length and a CRC mismatch.
  • The check a boot makes before reading — a separate check raises when the file is large enough to hold the magic bytes and does not hold them; it runs as the store is built and again before each tolerant read, while the strict read tests the header itself, and without it a wrong header would surface only at the first write.
  • What a trade is on the portfolio basis — a trade is a run of consecutive in-position steps, closed by the first step out and recorded as it stands if the steps end first, with its returns compounded and reported as the run's gain rather than a sum, where the bar basis instead numbers bars by a running count of entry marks.
  • How the portfolio windows are cut — steps are grouped by truncating each timestamp to a caller-named span, a day by default, where the bar basis offers no such choice; each window reports its compounded return and that return over the fraction of steps in position, which is absent when no step held one.

Starting and stopping Nexus

  • The roads around the checks — some orders go out to the venue without passing a single one of the checks the rest pass.
  • The sale a host sends as it stops — shutting down, the system asks each strategy what to sell and approves those orders itself, so the checks that normally stand in front of an order never see them.
  • Where an imported position's names come from — a holding rebuilt at startup needs three labels off the side that placed the orders, and a holding missing any one of them is left out of the records altogether.
  • What a stopping host halts first — on the way down, anything a strategy asks for through the usual checks is turned away, and the background jobs are switched off one after another in a set order.
  • What a stopping host saves of its strategies — each strategy is asked to describe itself in bytes, which are written to a side file and then moved over the old one, so what is on disk is always one whole version.
  • What a failed save costs the stopping — a write that fails on the disk loses one strategy's update while leaving what it saved before, a directory that cannot be made loses every update, and a strategy handing back something the writer cannot take costs the shutdown its final saved picture, though the account is still handed back.
  • What a start does with a strategy's saved state — the saved bytes are handed back to the strategy, with empty bytes standing in where the file is missing or unreadable, and a setting that is left blank means the start never looks.
  • The last record a stopping host writes — on the way out a picture of the state is saved and then the account is handed back, each wrapped so a failure is written down and passed over, and the handing back can fail with the account still registered.
  • What a failed checkpoint costs a start — a start that cannot save the state gives up the whole start, and nothing between there and the account's own thread catches it; a run over past bars has no such thread, and shuts the account down before the failure leaves.
  • What stops a start squaring its holdings — a start weighs its own record of what is held against what the trading side reports, and a holding the trading side does not mention ends the start rather than being adjusted away.
  • Where the figures a start squares start from — each running total a start compares begins empty: one is carried on the record it recovers, and the other is built up as it reads what the trading side reports.
  • Which roads reach a strategy — every occasion on which a strategy is spoken to, each arriving outside the tests from a single place in the code, and none of them named by Praxis's own code.
  • Stopping the loop that reads outcomes — the reader being switched off is asked to finish and given a while, and one still going when the while is up is left to complete the turn it is in, which can take one more message away from whoever reads next.
  • What a strategy is handed when it is asked to stop — the holdings it owns, the money it still has room for, and the state trading is in, with its own settings arriving empty.
  • The abort a host sends as it stops — a request to drop an order already handed over, naming it by a label the strategy itself supplies.
  • What a stopping host waits for — it keeps a list as it sends and reads replies until that list is clear; should a set time pass with entries left, it tries to drop them and reads once more for half as long before going down regardless.
  • What a sequencer refuses to be built with — building the thing that brings a host down insists on five pieces being present and of the right sort, allows the settings to be absent, and refuses only one combination: the account named twice and named differently.
  • What the wait for outcomes takes off the pending set — the host waits for answers on what it still owes, checks the clock before taking each answer rather than after acting on one, and strikes a command off only when an answer ends it, so a partly filled one keeps the wait open.
  • The same absence in the two exit builders — a closing instruction with no trade named is quietly skipped by the first builder and throws in the second, so the first decides which holdings are even attempted and the second trusts what it is handed.
  • What each shutdown submission records — with no way out or no settings, the sending does nothing and says nothing while the giving up says so; a sent closing raises the holding's reserved-for-sale amount and is filed under the name the far side gave back.
  • Where an outcome outside the wait is sent — a reply arrives for an order the shutdown is not watching, and a second route hands it to the code that keeps the books, which records it against the order where it has a file on one, and otherwise asks for the money back if the reply is a final one.
  • What a written-back position carries — a holding rebuilt at startup from the venue side takes one price as both the price it opened at and the price its money is booked at, where a holding built in the ordinary way keeps those apart.
  • What a start weighs a position at — startup values each holding at a different price depending on where it came from, and writes the price it settled on back onto the holding.
  • What a start does with a dusted position — startup asks the venue side what it is holding and writes back anything missing, so a holding written off can reappear with its money attached.
  • What money arriving in the account changes — paying money in is written to the log and buys nothing: the sum every allowance is a slice of is fixed when the host starts and never moves.

Across the Praxis boundary

  • What an entry outcome changes — a report of one kind moves the money set aside for a command on to the next place it sits, and two kinds of report move nothing at all.
  • What each outcome's answer records — the reply to a report says whether it worked, and separately whether a holding or the money changed; a cancelled or refused sale can reply that it worked while recording that the money did not move.
  • What a position change checks — the routines that move a holding insist on different things: a missing number in the arriving report is checked one way and a missing holding another, and one check carries on regardless of what it finds.
  • Whether a fill closes a position — a completed trade is checked against the holding it was meant to close, and a leftover below the increment the venue prices sizes in counts as closed.
  • What writes the name a success records — the label kept of a reply from the venue, so a repeat can be turned away, is never saved to disk on its own account; it goes down with whatever the next save of the state was asked for, so a host that stops with no save of any kind behind it leaves a log and a picture that never held the label, while the turning away of a repeat reads that label where it stands in memory, so the wait costs nothing until a restart.
  • What the money's lock is doing when a result is written — the line recording what a sale came to is written with that lock held by no one, reached two ways: where the sale frees money set aside, the lock is handed back as the freeing finishes; where it frees none, nothing reaches for the lock at all.
  • What a command is checked for — the instruction Nexus hands the trading side checks itself as it is made: what must be present and usable, what may be left out but is rejected when present and wrong, and the deadline given as a true-or-false, which a test placed ahead of the whole-number test catches.
  • The marker a command's moment must carry — the timestamp on that instruction is rejected unless it was built with the standard universal-time marker, so a zone that sits at the same offset is turned away, while the other handoffs the same connector makes accept it.
  • The settings a command rewrites — where mode-specific settings are supplied, the instruction takes a locked copy and keeps that instead of what it was given, and nothing can afterwards be added to that copy, taken out of it, or put in place of what a key already holds.
  • What each kind of command must carry — a new order must name a side, a self-trade setting and either a size or a spend but not both, while a change and a cancel must carry none of those nor any of the execution details, each kind checked against its own copy of the list.
  • What an outcome is checked for — the report the trading side sends back is rejected unless both its references are usable text, its type is a recognised one and its timestamp carries the standard universal-time marker, with the amount still working checked for every type after the report has already been sorted by whether anything filled.
  • What a fill must carry — a report saying something filled must give the quantity, the price, the money value and the fee charged, each a finite figure and the first three above zero where the fee may be zero, and a report of any other kind must give none of the four.
  • The reason an outcome may carry — a rejection has to explain itself in words that are not just blank space, a report saying the order was called off may explain itself or stay silent, and either explanation on a report of any other type is turned away.
  • The two measures an outcome reports — two further numbers may each be supplied or omitted, an omitted one is passed over before the number is examined, and a supplied one is turned away unless the report says something filled, where it must be a finite number.
  • What a note for an outcome is checked for — the note carried alongside an order is rejected unless its two required identifiers are usable text, its direction is a recognised one, its two true-or-false fields really are, and its money amount and expected fee are real numbers with the amount above zero.
  • The size a note may leave out — the quantity may be omitted only when the order adds to a holding, an omission clearing that one check; a quantity that is supplied must be a real number above zero, and those two tests ignore the field that allowed the omission.
  • The flag saying an order grows a position — that metadata states whether the order adds to a holding, nothing compares the statement with the buy-or-sell direction, the opposite reading is worked out on demand, and a record setting both that statement and the other true-or-false field it carries is rejected by that check, which either of them standing false clears.
  • What a lost protection is reported with — the notice that a bracket's safety orders could not be restored walks its account, its own identifier, the entry's identifier and the reason by name requiring usable text in each, requires a timestamp with the standard universal-time marker, and requires a whole number of one or more for the attempt count, with a true-or-false caught by a test placed ahead of the whole-number test.
  • What a fill's own record requires — a loop holds most of its identifiers to a shared non-empty check, its timestamp must carry a zone that reports an offset, and the venue's own trade identifier is absent from that loop, so it may be empty — which switches the duplicate-detection key from that identifier alone to four other fields combined.
  • What a fill's own record never asks — its quantity and price are rejected at or below zero and its fee below zero, with no check requiring either figure or the fee to be a real number rather than an infinity, and the direction and the maker flag are never examined.
  • The record nothing builds — that record is named once, where the package hands its types onward, and nothing in the production code constructs it, so every rule it enforces runs only under test; the production code reports a fill as the event record instead.
  • The name a bracket's protective exit is given — the protective order's identifier is the entry's with a dash and one letter appended, nothing checks what is passed in, callers on both sides of the code share the single helper, and nothing in the other repository derives the identifier at all — so the comment calling this a computation both sides must perform identically is out of date, and the side that reads it is handed it instead.
  • What the Nexus logging adds — Nexus can bind correlation fields for the duration of a block and put those same fields back on exit, including when an exception leaves the block, where the other side has only the unscoped bind; the level lookup and the handler replacement are identical on both sides.
  • The records that refuse nothing — three records declare their fields and validate none of them, so no rule constrains any value they hold; one of them can say whether its lifecycle has finished, by testing its state against the finished ones.
  • What the translation refuses — turning a passed decision into an instruction is refused for a decision that did not pass, a timestamp without the standard universal-time marker, an empty command identifier, or a modify action named outright, with a lookup table standing as the last barrier past those.
  • The kind of command nothing builds — three command kinds are declared and the translation reaches two, so the amend kind is built nowhere on this side, though the command record still carries the rules for one.
  • What an exit is given where it asked for nothing — an exit missing its execution style, order kind or deadline is handed a single shot, a market order and sixty seconds, where an entry is handed nothing and a non-order action has all three set aside; a spend and a quantity can never both be present.
  • What a funds movement refuses — the record of money entering or leaving an account is rejected unless its two identifiers are usable text, its timestamp carries the standard universal-time marker, its amount is a finite decimal above zero, and its direction matches one of two words exactly, case included.
  • What a mismatch refuses — the record of a disagreement with the venue is rejected unless its three identifiers are usable text, its timestamp carries the standard universal-time marker, and both figures are finite decimals — and rejected when those figures agree, so it cannot be made to report that nothing is wrong.
  • The named values copied from the other side — the execution styles, order kinds and maker preferences are declared again on this side so the strategy layer need not import the trading package, which means each list agrees with its counterpart only while both are maintained, and nothing checks that they do.
  • What a record of processing refuses — the record of how one report was handled needs a recognised kind, an explanation when it reports failure and none when it reports success, while the field those two checks read is never required to be a true-or-false, so text put there is read for truth alone.
  • The two cuts across the kinds of outcome — six outcome kinds are answered by two questions that do not line up: four count as finished and two as having filled, with the full fill answering yes to both and the acknowledgement yes to neither.
  • The questions a record answers about itself — four records answer something about themselves in a single line: which accounts increase on the debit side and which do not, whether a command or an order was sized in money (answered by the presence of a money amount rather than a flag), and whether a position has closed (answered by its quantity equalling zero).
  • The escape in the shared check for a name — one check holds every identifier on this side: it lets a missing value through when the caller marked the field optional, otherwise rejects a missing value and an empty string together, and never trims — so an identifier of spaces alone is kept here and rejected on the other side.
  • The severity an alert gives back — telling an alert returns the severity actually recorded after an unknown one is turned into a warning, and the call that also posts reads that return rather than its own argument, so the logged line and the posted payload agree.
  • What the bucket of permissions refuses — the pacer for venue calls rejects a rate or a capacity at or below zero, starts out holding its capacity so early calls go straight through, and on every take adds the elapsed time times the rate while capping the total at the capacity, so a long idle spell buys no unlimited burst.
  • The token taken before the waiting — a take computes its wait, subtracts its token whether one was available or not, then releases the lock and waits, so the count can go negative and lengthen later waits; a wait cut short part way adds the token back so nobody pays for a call never made.
  • What a ladder's prices must be — each price must be a positive real decimal, and the prices must rise throughout or fall throughout, which allows a descending ladder and rejects a repeated price without any check looking for duplicates.
  • What a ladder's weights must come to — weights are optional and the checking stops where they are absent; supplied, they must match the prices in count, each be a positive real decimal, and together come to exactly one, which is the only test that reads them as a set.
  • The quantity a lot step leaves behind — an even split reaches the total exactly when no trading step is known, because the final part takes the remainder whole; where a step is known the final part is rounded down like the rest, so the parts can come to less than was asked for, bounded by one step since a final part rounding to zero is rejected.
  • What a book poller refuses and answers — the poller keeping the kept prices fresh rejects an empty symbol and an interval at or below zero by comparison rather than by type, reports itself running while its task exists and has not finished, refuses a second start by reading that report, and clears its stop signal before making the task so a stopped poller can start again.
  • The gap between polls — the pause between polls is a bounded wait on the stop signal rather than a sleep, so the interval is the longest the pause can be and a stop is noticed immediately instead of after it, which is how this loop differs in shape from the others.
  • What recording a request refuses — the tracker rejects a latency that is not a real number of zero or more and a success flag that is not strictly a true-or-false, so an infinity, a not-a-number and a whole number of one are all turned back, which is stricter than the records around it.
  • What the lock covers — one lock guards the latency store, the outcome store and the failure run; recording takes it to append to both stores and to move the run, while producing a report takes it only to copy them, releasing it before the slow-end latency and the failed share are worked out from those copies.
  • The window a backfill opens — with no stored cursor a page is requested by whatever start timestamp was supplied and no end timestamp is ever sent, so the request is open-ended at the far side; only a full page of parseable ids sets a cursor, and once one is set every later page is requested by cursor instead.
  • What an even split refuses — the quantity is checked for being an exact finite positive Decimal and the child count only for being at least two, so a fractional count slips past and is rejected by the arithmetic instead, and where the venue's lot size is unknown the children are the quantity over the count with no minimum child size at all, the last taking the remainder of what the division produced rather than restoring digits the division dropped.
  • What a weighted split asks of its weights — the quantity and the number of weights are checked exactly as in the even split while the weight values are used untested, their type, sign and sum being enforced instead by whichever parameter record supplies them, and the final weight is never read at all because the final child is simply the quantity's remainder.
  • What counts as raising what a buy commits — a sell amendment is cleared immediately, a ladder is routed elsewhere, and everything else is judged on the commitment prices listed for its execution mode, which only a single order and an iceberg have; a named price above the original, or one with no original to bound it, is rejected, while a stop-limit price and a row-of-rungs comparison sit in the deciding as paths nothing can reach.
  • How a ladder's change is weighed — a buy's ladder amendment is compared as one quantity-weighted price total against another, each side taking amended values where amended and original ones otherwise, a side with no weights giving every rung an equal share, and shares that do not match the new price count being rejected outright.
  • What the translator remembers — the ceiling on remembered finished commands must be a positive integer and a boolean true passes it, bounding the list at one; finishing a command files its id, evicts the oldest ids past the ceiling and discards its own record, and an outcome for an id already evicted is treated as a brand-new command.
  • The words an ending carries — a rejection supplies a stock word where Praxis recorded nothing or an empty string, but a whitespace-only reason is truthy here and is passed through to a record that requires something after stripping, so building it raises; an expiry crosses with no reason and any other ending carries whatever Praxis had.
  • The command that ends twice — when the venue reports a bracket's protective order cancelled, that bracket's exit command is ended and dropped, and the flatten following an unprotected remainder derives the same command id, reinstalls it, and reports its fill with no check that the id already ended.
  • Registering an account, and undoing it — an empty account id and an account with no configured credentials are both refused, an already-registered account only has its venue credentials reapplied, and a new one is registered at the venue before the trading side, with the venue registration rolled back for two named failure kinds and left standing for any other.
  • How a settings field is known to want a tuple — a field is classed as wanting a tuple when its annotation is a tuple or a union containing one, with Annotated wrappers stripped first and no other generic walked into, so a list-of-tuples field keeps its list; the classification runs over both settings registries at import, before any payload exists.
  • The keys that must match what they hold — the positions and per-strategy-mode mappings each reject a value of the wrong type and a key that disagrees with the identifier inside its value, while the dust mapping and both processed-id sets are checked for shape alone and the remaining fields arrive already self-checked.
  • How a call across the seam is made — each call is refused outright if its function was never wired, four are bridged onto Praxis's event loop and awaited for one shared span after which the pending call is asked to stop, without that asking being waited for or checked, and registering an account and pulling its positions cross directly with no span at all.
  • The five re-keyings — each cross-seam enum field goes through one shared re-keying that is handed the field name, so a rejection says which field it concerned; a missing maker preference and a missing self-trade setting are answered before that call, and one field also carries a table of equivalent words.
  • The builder that stands apart — the single-order mode's parameters go to their own builder before the per-mode table is consulted, both roads hand back an already-correct object unexamined, and where a mapping arrives the single-order builder checks each value itself while the table's road leaves that to the record it fills.
  • The figures a fill is assumed to carry — the fill size, price, notional and fees are checked by assertion rather than by a test that could answer, the record's own validation having already required all four; the capital call runs before any position is read, so a failing call returns a failure while a missing trade or position raises later.
  • The name an order comes back with — the label the other side answers with when an order is handed over, and when a label that differs from what was asked for is treated as a failure.
  • What a pending sale does to the dust — an unsettled sale bars one route to writing a holding off and leaves the other wide open, so the same leftover is treated two ways depending on how it got there.
  • What a pending sale is — a holding records how much of it already has a sale out, which caps what a further sale asking through the checks may request.
  • What the host counts when a fill empties a position — a holding is gone before the message announcing its close arrives, so a tally stands in for it and tells a sold-out trade from one that never held anything.
  • Where a position's last scraps go — the part of a holding too small to sell is written off to a running total per coin, and no decision ever looks at that total again.
  • What a dust close refuses before it touches anything — writing off a tiny holding is given three names and each must be real text, all three checked before any part of the book is held, so a badly asked write-off blocks nothing.
  • What a dusted scrap leaves behind — writing off a holding too small to sell leaves the money it was bought with counted against nothing until the next startup.
  • What a fee figure is worked out from — the trading cost in a report is a flat thousandth of the fill, while the ledger alongside it books what the venue actually charged, so each trade is recorded as costing one amount in one place and another in the other.
  • Which fills come back with a result — a purchase reports no gain or loss at all, and the gain on a sale is measured from the price the holding was opened at rather than the price its money is booked at.
  • Where a realized result is written down — what a sale made or lost is saved to the record before it is counted, so a save that fails leaves nothing counted that was never saved.
  • Where the locks sit on a position change — the sums are worked out before the holdings are held and only the writing happens inside the hold, except for one routine that holds them before it even looks, and one way in that nothing calls.
  • What an exit outcome changes — closing a holding gives money back and reports what the trade made, and those are two different sums.
  • When an entry's position grows — buying in pieces leaves one holding at an averaged price, and what that average is later measured against.

A decision becomes an order

  • How a decision becomes a command — a decision from Nexus is turned into an instruction Praxis will act on, field by field.
  • What a command must carry — one instruction must name the account, the trade and itself, and give either an amount of coin or an amount of money, never both.
  • The payload a mode's settings arrive in — the settings that ride along with a decision, and how they are turned into the ones the chosen way of working needs.
  • What a command's checks let through — the checks on an instruction only ask whether something is there, or whether a number is above zero, so other mistakes pass and surface later.
  • What turns work away — the checks work must pass before Praxis records it at all, before it is ever queued.
  • The order a command's checks stand in — a request admitted into the trading side passes four checks in a fixed order, so a request wrong in two ways is told about whichever fault comes first rather than the worst one.
  • What a command sized in money is held to — saying how much to spend rather than how much to buy is allowed for one kind of order on one side, and the rules enforcing that sit in three separate places.
  • Which modes the money refusal reaches — the refusal that looks like a rule about every way of working cannot be met by the hidden order or the ladder, which earlier checks stop instead.
  • What a mode command refuses of itself — a request naming any way of working but the simplest meets one rule that applies to all of them and three narrow ones, and some ways of working meet nothing but the first.
  • The venue rules that are never applied — half of what weighs a request at the door is written to take the venue's own trading rules, and the place that admits requests hands in none, so that half runs only under test.
  • What the per-child rules would weigh — the unapplied half checks a different number of things for each shape of split order, from one for an evenly spread order to four for a hidden one.
  • What the host refuses first — one guard every way in shares, answered by a raise before anything is written down.

Orders, accounts and the venue

  • Trades, requests and orders — a trade, a request and an order: work from outside, one piece of it, and one send to the venue.
  • Which readings hand back a copy — the figures an account is asked for come back detached from it, except for one road that hands over the account's own state, which a caller can then read later or write to.
  • The three questions asked of an account's condition — asking whether an account has fail-stopped and asking whether it can send orders both answer no while it is being brought back into step, for different reasons, so only asking both tells a gate that will lift from one that will not.
  • When an account's registration is written — every startup tries to write the event that fixes how an account's costs are counted, and one reading decides whether anything goes down.
  • The registration a pre-account history is given — a history older than the account system is handed a registration that exists only in memory, so its fills can be counted.
  • What the manager is built holding — what the part that drives orders is handed — the record of events, the venue, the clock, the deadlines and the rest — and what it makes empty for itself.
  • What an account's runtime is built holding — what each registered account is given, what it makes for itself, and what starts empty or false.
  • What an account is — a name that groups the requests, orders, holdings and queues kept about it.
  • What a venue is — whatever Praxis sends orders to: one per host, called by name, so a live exchange and a simulator run the same code.
  • What a venue must offer — Praxis writes down what it needs of any exchange as a list of named things with no code behind them, so the file says what must be answered to and nothing about how.
  • How the adapter reckons its headroom — the request allowance it believes it has used drops to zero all at once when its window closes rather than fading, and the per-account order allowance never expires here at all.
  • What the allowance headers are trusted for — each figure is taken only if it reads as a sensible whole number, and storing the request figure restarts its expiry window while storing the order figure restarts nothing.
  • Which stated limits the adapter adopts — of all the limits the venue states, only those matching an exact kind, span and span-count are taken up, so anything stated another way is read and discarded.
  • How a venue answer becomes a record — the fields of a venue's reply are picked out by name, so a reply leaving one out stops the reading, while an absent list of fills or of legs is read as an empty one, which refuses one record and lets the other through.
  • Which health figures are read under the lock — the lock is held only while the account's record is found and the clock gap read, and the share of the venue's allowance in use is worked out after it is let go, so one answer carries figures read at two moments.
  • Which askings make their own request — the asking after a symbol's trading rules and the asking after how deep the market stands each build and send their own request rather than hand one to the code that sends again, so a passing failure in either goes straight back to the caller.
  • What signing a request adds — the query text is built once, signed over exactly that text, and the signature appended to it, so what is sent and what was signed cannot differ; a closed adapter refuses to make a connection at all.
  • How a venue failure is sorted — the status code alone decides most kinds of failure without the reply body being read at all, so a helpful message returned with a server error is discarded.
  • What the four asking calls share — the calls that ask after or cancel an order are built alike, and a caller-supplied name for a paired order goes out under one key when cancelling and a different one when asking.
  • When a request is signed afresh — the retry is handed a way to build the request rather than a built one, so each attempt signs again with its own timestamp and a retried request is never rejected as stale.
  • What the trading rules asking insists on — the allowance headers are read before the reply is checked for failure, so allowance spent on a failing reply is still recorded, and only the first symbol in the reply is ever read.
  • What the rules are read as — the limits are gathered by kind, three are demanded with every missing one named together, and each figure becomes an exact decimal while only the asset names fall back to blank.
  • What an asking sends and what it reads back — the balance request sends nothing and filters the reply on this side, so asking about one coin costs the same as asking about twenty.
  • How fund history is paged — deposits and withdrawals are fetched separately in fixed-size pages and the walk stops only when a page comes back short, so a history that is an exact multiple of the page size costs one empty request.
  • Which failures a retry counts as healthy — a not-found is recorded as a healthy exchange because the venue answered correctly, and of the statuses that mean rate limiting only one is ever retried.
  • What an order type decides about its parameters — each kind of order carries a record of what it must and must not include, so supplying a price to a kind that needs none is an error rather than ignored.
  • What a money-sized order is refused for — supplying a cash amount picks a road that then accepts only a market buy and rejects a coin amount, a price, a stop figure or a time limit alongside it.
  • What an amount-sized order goes through — the amount is rounded to the venue's step before any check runs, so an amount that would have been rejected as sent can pass, and what is judged is always the figure the venue will see.
  • What the adapter refuses to be told — a permission it cannot read counts as denied, a timestamp without a zone throws while one left out passes, and a blank simulator address leaves the real venue in place.
  • What closing the adapter does first — it marks itself closed and empties the connection field before closing the connection, so a task racing to ensure one refuses rather than building a connection nothing would track.
  • What an execution report is held to — a report that claims a trade must carry the numbers proving it, and a report of anything else has those numbers taken away.
  • What a non-trade report loses quietly — the fields cleared from such a report and the fields worth complaining about are two lists that differ by one, so one field is changed with nothing said.
  • What the venue's own records are held to — a trade is checked for its timestamp alone while a record of money moving is checked three ways, and one record insists on exactly one of its two fields.
  • What a fill is — a report from a venue that some of an order has traded: an amount, at a price, at a time.
  • What every event is held to — all forty-two kinds of recorded fact are built on one shared record, and each runs its two questions before its own: that the account be named, and that the time carry a zone that answers.
  • The records that reseal their own fields — a record that cannot be changed once made still rewrites its own lists as it is built, which protects the record from the caller's list but not from a list inside that list.
  • The floors a count is held to — two records carry the same two counts under the same names and disagree about the lowest value each may take, so whether zero is a fact one of them will carry depends on which one is carrying it.
  • The fields asked to be a true-or-false — a yes-or-no value is demanded of two fields, turned away in four places because it also answers as a number, and left unexamined in two more.
  • The mode a scheme may not begin with — the record of a scheme starting names one way of working it refuses and allows everything else, where every similar test names what it allows instead.
  • The names a record may leave out — a record can declare a name allowed to be missing, and the shared check then lets a missing one through while still turning away one written as an empty value.
  • The grounds a figure is weighed on — a number in a recorded fact may be asked what kind of thing it is, whether it is a real quantity, and which side of zero it falls on; most are asked only the last, which lets an unbounded value through.
  • The two noughts a figure is compared with — the zero a number is compared against is written two different ways in one file, and which way it is decides whether a not-a-number value is quietly accepted or stops the record being built.
  • The records that weigh their own fields against each other — a handful of the records reject a combination their fields would each pass alone, among them a reported balance disagreement whose two figures agree, and an order asking to be sized in coin and in money at once.
  • The rule a bracket borrows — the record of a bracket starting builds a second record out of its own fields, keeps nothing of it, and gets its rule about the protective legs from the checks that second record runs.
  • What the shared checks pass over — the checks written once and used across the records are narrower than they look: an empty list of figures passes, and asking whether a value is one of the named ones is done three different ways that disagree.
  • Outcomes — what Praxis reports back about a request: where it has got to, how much filled, and at what average.
  • Order types — the kinds of order Praxis can send — at the market, at a named price, waiting on a trigger, and a linked pair where one filling cancels the other.
  • The prices an order must name — which kinds of order need a price, a trigger, or both.
  • Where the order type decides — the few places where the kind of order alone changes what Praxis does.
  • The order book — what a venue publishes about a pair: buyers on one side, sellers on the other, each a price and an amount wanted.
  • The one asset a commission is netted in — a buy's commission is taken out of the holdings it adds only when the fee was charged in one named asset, and what that costs any other symbol.
  • The call-off a ladder hears as a refusal — a ladder called off before its first rung is reported at the next restart, and reported as refused rather than cancelled.
  • Holdings — what one trade holds: which way it went, how much, and the average price paid to build it.

Getting an order to the venue

  • Order placement — placing happens in two stages: recording the work and returning, then reaching the venue on a later pass.
  • What a command's acceptance leaves behind if the queue is full — the acceptance is written before the instruction reaches the queue, so a queue found full has a record to undo.
  • What target the closing command is given — the instruction a hand-placed close settles under targets the whole position, which is what lets both it and the protective pair count under one name.
  • What the closing side of a bracket is given — the protective pair gets its own instruction, name and budget, which keeps what it fills apart from the entry.
  • What a queue reservation is for — a place in the queue is held before the command is put there, so that two commands admitted at the same moment cannot both be told there is room.
  • What a caller-supplied command name must be — a name the caller chooses is held to three demands a made-up name never has to meet, being trusted instead by the way it is made.
  • Which failed protections a boot re-flattens — the recovery runs only for accounts whose settings ask for a flatten at all, and it tells a flatten that went out from one that never did by asking the venue rather than reading the record.
  • Which way a ladder's change is given up — a change that cannot go on is either dropped with the old rungs whole or left for the watch, and one reading decides which.
  • What figures a changed order's replacement is given — the replacement is built by reading the change against the instruction figure by figure, so what the change omits stays as it was.
  • How a single order's amend is named — the replacement order's name is worked out from a count of how many times that instruction has been changed before, which is what makes two changes of one order differ.
  • How an order is named — Praxis works an order's name out rather than drawing it at random, so the same inputs always give the same name.
  • The likely-price check — refusing an order that would trade too far from the market price.
  • Estimating the likely price — the average price Praxis expects an order to get, worked out by walking the offers standing at the venue.
  • The sizes a venue trades in — a venue accepts only certain amounts and prices, and Praxis weighs an order against the figures it holds for that symbol — or sends it unweighed when it holds none.
  • What a venue must be able to do — the jobs every venue has to offer — register an account, place, cancel, report balances — written down as one list.
  • Holding back sends — a limit on how fast Praxis may call the venue: most calls wait for a slot, and asking the time does not.
  • When Praxis retries a venue call — a repeatable call gets three attempts and a send gets one, and each attempt spends a slot of the allowance.
  • The four roads out of a slice's send — a send that timed out or whose name the venue already knew asks the venue again, where a refusal or a bad parameter is simply recorded as failed; the time written down is when the answer came back rather than when the send went out.
  • When a send's outcome is unknown — a call to the venue can fail without settling whether the order arrived, so Praxis asks the venue before deciding.
  • A reply that cannot be read — what happens when the venue answers in a shape Praxis cannot understand.
  • Who refused a send — a failed send is put down to the venue, to Praxis, or to neither, so a later reader need not judge the wording.
  • What a refusal says — a refusal arrives as a named kind, and the kind decides whether the outcome is settled or must be asked after.

The pass that takes work off the queues

  • Draining an account's outside events — news from outside can be waiting in any of three queues, and emptying them in the order they feed each other is what a restart does before it reads its figures.
  • The account worker — each account has one worker going round the same circuit until it is stopped, taking work off a queue.
  • The active-protection test written twice — whether a protective pair counts as live is decided by the same three conditions in two far-apart places, which is what stops a protected entry being changeable on one road and invisible on the other.
  • What unregistering an account does in order — the account is taken off the manager's books before anything is stopped, which is how work already under way finds out it has gone, and its worker keeps running until the cancel lands.
  • Which thread the manager will take work from — work may only be handed in from the thread the first account was registered on, and until that registration the door is open to any thread.
  • What a second budget offered for a command does — the size and spend a command's fills are measured against are written once, and a later offer is dropped, usually in silence.
  • What a caller waiting on an admitted event is told — the answer is the place the record gave the event, and an empty answer means the record already held it rather than turning it away.
  • What sending a ladder's rung writes — the intent goes down before the venue is called and the send afterwards, each stamped with its own moment, so the pair measures the call.
  • What admitting an event refuses — four things are turned away before anything reaches an account's record, and an admission made during recovery is refused unless the account is parked, which is the very state that turns an ordinary admission away.
  • The two checks around an append — the same question is asked on both sides of the write because the write is awaited, and the account is matched by identity so one that left and came back under the same name is turned away with its event already safe.
  • The priority line — cancellations and changes wait in a line of their own, emptied on each circuit once the account has started, before anything waiting to be placed.
  • Work already under way — what a pass moves along between taking one request and the next — a cancel tried again, a slice now due, protection waiting to go up.
  • When an account is reconciling or poisoned — what a pass does for an account being brought back into step with the venue, or carrying a fault that needs a restart, and when there is no pass left to do it.
  • When a reconnection releases an account — a gated account waits on its feed coming back, not on time passing.
  • A change waiting out a hold — a change to an order already sent is put aside while the account is catching up with the venue, and is never taken up at all once the worker has stopped.
  • How a worker stops taking work — the loop an account takes its work from can die, be cancelled, or go on turning without ever reaching that work, and each leaves the account differently placed.

Ways an order can be worked

Changing, cancelling and giving up

  • What the manager tells you about an unknown account — asking about an account that has gone raises on some roads and answers emptily on others, with nothing in either answer saying the account went.
  • Which commands count as amendable — the set a change may be aimed at is built by gathering three kinds and taking five things out, and the last step adds bracket entries back without asking what the removals concluded.
  • How a change is routed to its handler — which handler a change reaches is settled by the shape of the change's own parameters, and the protective road is taken before the tests the other roads make, reaching a handler with three different tests of its own.
  • What placing a bracket's protection writes first — the holding is marked as protected before the protective pair is even built, so a failure after that leaves it claiming a protection that may never have reached the venue.
  • How an amend's replacement order goes out — every failure sending the replacement reports the change as failed as well as the send, and the command's own description is rewritten only once the venue has taken the new order.
  • What a parked amend is retried against — a change whose old order had not finished waits on the venue agreeing that it has, however many passes that takes, and nothing in the retry gives up on it.
  • Changing work already sent — asking Praxis to alter work it has accepted, what may be altered depending on how that work is carried out.
  • The change each way of working accepts — every request to alter work must name the command, the account and a reason, and a change to how work is spread over time is refused outright.
  • What each change insists on — which fields each way of working lets a change touch, and what it checks before touching them.
  • What a scheme's change replans — only the part of the schedule not yet reached is replanned, so slices already run keep the amounts they ran with, and a change that cannot be divided leaves the schedule untouched rather than failing.
  • When a protection fills as it is placed — a protective pair can come back already filled, and it is recorded as live before it is given an outcome, so a reader catching it in between sees protection for a holding that has closed.
  • How a schedule change is carried out — the parts already sent kept, the rest planned again, and the next part set a full gap from now.
  • How a price change is carried out — a price change replaces the order rather than editing it: the resting one is cancelled, what it really filled is settled, and a fresh one goes out for the rest.
  • Which figures settle a bracket's entry — the order's own fills decide whether anything filled and what price the protection rests on, while the admitted totals decide what the outcome reports, so an entry can be called part filled while its protection is sized from a larger figure.
  • What a ladder's start plans before it posts — every rung's amount and price is worked out before anything is recorded, so a grid that cannot be planned is refused with no start written at all.
  • When a protective pair counts as still protecting — a pair the venue reports as refused, forgotten or finished is protecting nothing, and a working one comes back whole so its halves can be followed again.
  • What a hidden-size order shows the venue — an order carrying a whole size and a display size sends the display one only when it is smaller, and otherwise rests as an ordinary limit.
  • Which order the watchdog asks about first — the replacement pair still owing is asked about before the pair the holding carries, which settles the usual case on the first question, and a venue failure on a name is remembered but does not stop the next name being tried.
  • How a new ladder grid is renumbered — rungs too small to trade are dropped and the survivors numbered without gaps, which is what lets the walk that finds them again run from nothing upwards without stopping early.
  • How a ladder's rungs are found again — a grid of resting orders is recovered by working out what each rung was called and asking the account whether that order is there, so a rung the venue accepted but the record never saw is still found.
  • What a ladder amend caught mid-flight resumes as — a price change interrupted by a restart comes back as a change still under way, holding rungs from both the old grid and the new, so the watchdog drives it on from where it stopped.
  • When protection in doubt is remediated rather than waited on — the wait over a protection the venue will not confirm runs to a deadline, and what is closed afterwards is sized from the record rather than the venue.
  • How much a cancelled protection pair filled — the venue is asked half by half what the pair it has just taken down filled, and a venue that will not answer leaves no figure and no change.
  • How a protection in doubt is re-confirmed — a protective pair the venue says is working is written back as live under the version it already had, and an order missing from the account's own records is a reason to wait rather than to write.
  • What retiring a ladder's old grid counts — the rungs being retired are found by working their names out again, and the change is marked as committed on the strength of what is about to be attempted rather than what the venue confirms.
  • How a ladder's change moves from one phase to the next — the old rungs come down and the new ones go up in two steps, and a mark on the work says which step a later attempt should start at.
  • What finishing a ladder's change adopts — the new grid becomes the live one by putting a fresh instruction behind the old name, and by forgetting what the change was.
  • How a ladder's prices are changed — the whole grid replaced: every old rung cancelled and seen to be over before one new rung goes out.
  • What stops a ladder's new rungs — a grid can be left short: nothing worth placing, a freeze, or a rung that halts the run each time it is tried.
  • When a price change leaves no new order — a price change can end with nothing resting in place of the order it replaced: the cancel never settles, the order is still working, too little is left to trade, or the send goes out and comes back unconfirmed.
  • What a slice that cannot be sent does to the work — a part that will not go out freezes the rest and reports what has filled, leaving the instruction live for Nexus to decide about.
  • What moves a scheme on to its next part — each turn sends the part at the cursor and then moves the cursor, reading nothing about what that part filled.
  • When a call-off goes unreported — the call-off is written down before the report is worked out, and one missing lookup leaves the order stopped with Nexus never told.
  • Cancellation — asking Praxis to stop a request already submitted, answered at once or taken up in the line of its own.
  • Abandoning work outright — asking Praxis to give up on one command rather than alter it, cancelling at the venue where an order is out.
  • Where an abandonment lands — what giving up on a command does, by how far that command had got.

When work runs out of time

  • Deadlines — the time by which work is expected to be done, and the moments Praxis measures against it.
  • The expiry cancel — an order found past its deadline has its report settled as expired before the venue is asked, and the expiry written against the order unless the cancel failed outright.

What a fill does when it arrives

  • What a failure reacting to an event costs — three things happen in response to each piece of news and they fall together, so one of them failing silently skips the other two.
  • What status a changed command reports — the status comes from how much the instruction has filled across both the order replaced and its replacement, and nothing filled at all is reported as still waiting.
  • Which record an event is booked into — Praxis keeps a picture of the orders and a picture of the costs, and each event reaches one, both or neither of them.
  • What a partial report of a scheme leaves standing — a report sent while work fed out over time is still running, which says how much has filled and changes nothing about the work.
  • What a fill changes — a fill updates the order's record and then the money's, so a failure on the first leaves the second alone.
  • Fills and the order — how a fill moves an order's totals and status, including one arriving too late.
  • What the facade refuses once a start has begun — the callback setters stop accepting changes partway through starting rather than at the end of it, and the refusal names the setter that arrived too late.
  • What the facade is built with — callbacks supplied in the settings are wrapped as it is built while ones supplied later are wrapped as they arrive, a filter list is copied so the caller cannot alter it, and every field it keeps starts empty.
  • What the facade hands out — the pieces it holds are handed back exactly as held so a caller can reach through them, and asking for the event loop before starting throws rather than answering with nothing.
  • What registering an account touches — adding an account fills one collection while removing it closes a connection and clears three, because most of what accumulates was not put there by the adding.
  • How the reconciliation loop is stopped — the stop flag is checked before each account as well as before each round, so a stop lands within one account rather than one round, while a task that is cut short mid-account is not caught by the loop at all.
  • What the phase map and the gate agree on — an account partway through reconciliation is in the map and an idle one is absent, and the switch that holds its orders back is computed from that same value in the same call, so neither can be moved without the other following.
  • The five reasons a report is discarded — a venue update can be thrown away for several reasons and how loudly it is logged is the only thing that says which were expected, from silence for a payload of another kind to a complaint for one that would not parse.
  • What a report becomes — a venue update turns into a fill, a cancel, a refusal or an expiry, and only the fill can fail to convert, because it needs something about the original order that this side may no longer hold.
  • What a backfill asks the venue for — it asks about the coins the account is trading plus the ones the startup filter names, each from where the saved marker left off or a fixed window back when there is no marker, and one truncated coin makes the whole answer incomplete.
  • What a backfill records as confirmed — the marker moves only when a coin's pages finished and lands on a trade actually read, so a trade skipped for an unreadable identifier keeps the marker behind it.
  • What a backfilled trade becomes — it becomes a fill marked as recovered rather than live, and when the link to the original request is missing it is discarded in silence where the live path logs a warning.
  • What a balance comparison weighs — it reports only a shortage past that coin's tolerance and never a surplus, and abandons the round when the expected figures moved while the venue was being asked, so a delay is not mistaken for a difference.
  • What becomes of a mismatch nobody took — the discrepancy is recorded before anyone is told and a failed hand-off is reported back rather than thrown, so a record in the log is no evidence that anybody heard about it.
  • Where a fund pass starts looking — each round asks the venue from slightly before where the last one finished, on purpose, with a floor that stops the overlap reaching into history the account should not be asked about.
  • What holds a fund cursor back — the marker advances past movements it ignored and stops behind ones it handled, because what it records is the round rather than the movements.
  • What a failed start undoes — the event loop is claimed on the first line of the work, which is what closes the settings early, and a failure anywhere clears every collection whether each individual cleanup succeeded or not.
  • What a stop will not leave running — during a stop the facade reports itself both started and stopping, and after a failed stop it reports itself started and not stopping, because the stopping marker is always lowered while the started one is lowered only on success.
  • What the sweep for stray venue orders looks for — it compares what the venue has open against both the live and the completed orders, so its own finished work is not mistaken for a stray, and an order belonging to another host is noted and left alone.
  • What an account's startup does in order — the saved history is replayed before anything else so everything after sees it, and the trading rules are loaded for coins named by old bracket records as well as the current ones.
  • What a submitting road refuses first — a shutdown is reported before an unready account is, so a caller submitting into a closing facade is told the facade is closing rather than that its account is not ready.
  • Which orders a reconcile asks about — only the orders this side still believes are open are asked after, one question per order, and the walk runs over a copy so it can close orders as it goes.
  • How a caller's callback is wrapped — a supplied callback is wrapped so it can always be awaited whether it is plain or not, and one setter deliberately passes an absent callback through unwrapped because its far side reads absence as nobody listening.
  • What routing an outcome drops — the lock covers finding the queue and not handing anything to it, so a queue removed in between still receives, and a full queue raises into the router rather than slowing it.
  • How an event finds its way through the projection — some kinds are handled and answered before the rest are tried in a single chain, and several kinds share one closing routine where a refused send and a refusal from the venue leave the order in the same final state, so the state alone does not say which happened.
  • What closing an order moves it to — the order is moved out of the live book and into the closed one under the same name, so it stays readable afterwards and a reader looking in only one book can mistake a closed order for one that never existed.
  • The lookup every handler shares — one routine finds an order for every handler, logs a warning when it finds none, and hands back what it found for the caller to judge; a single handler checks the closed book first and so stays quiet on a repeat.
  • What the projection copies under its lock — one lock guards the holdings alone and a reading of them returns a copy of each, while the orders and the schemes beside them are read with no lock at all.
  • When an update fails — failing to update the order's own totals stops the account; failing to update the money record is logged and passed over.
  • How an outside event enters the record — news from outside is written by the account's own writer, and the caller waits to be told how it went.
  • Where duplicates stop — the same fill can arrive from the send, from the live feed and from a later query — it is written down once, and only that copy is acted on.
  • Two ways of asking what a command filled — one road reports nothing filled rather than report a figure the accounting never capped, and the other is built on exactly that uncapped figure with the venue's fees taken off.
  • What a boot ends an unfinished scheme with — a fed-out order a restart cannot resume is ended at boot from the figures the accounting admitted, so one whose fills never passed admission is ended as having filled nothing.
  • The part of a fill a command counts — the whole fill goes into the books, and only what fits the order's budget reaches the figures Nexus hears.

What the venue tells Praxis

  • The venue feed — a connection kept open per account, over which the venue says what happened to that account's orders unasked.
  • What opening the stream does and does not do — asking for the connection twice is harmless and silent, and the part that reconnects after a break is only started where somebody is listening for messages.
  • What setting up tears down first — setting the connection up lets go of whatever it already had before it checks anything, so a bad address costs the working connection as well as the complaint.
  • The address the stream will accept — a secured address is always allowed and an unsecured one only where the setting naming the simulator holds something, and a setting holding only blank space counts as holding nothing.
  • How a subscription is signed and acknowledged — the request's values are put in a fixed order before being signed so one set of values gives one text, and the signature is added only afterwards.
  • The order closing the stream does things in — the reconnecting is stopped, the connection is let go of before anything is sent, and only then is the venue told and the connection closed.
  • What a closing can raise — each step of a close ignores the kind of problem it expects and passes anything else on, so some closes stop partway and leave the connection open.
  • The failures the reconnect loop swallows — the loop is built to survive the venue being unreachable for as long as it takes, and the interruption it cannot survive is exactly what stops it when the connection is closed on purpose.
  • How the mark samplers are started and stopped — every sampler in a set shares one cadence read before any of them is built, and a build that fails part way raises past the line recording the set, so the next build begins from nothing although samplers were running a moment earlier.
  • Where the host's two sets of background work differ — the samplers and the book pollers are built by the same code and part on how many are made, what settles their cadence, where each writes, and what each needs before it will start at all.
  • The kept book — Praxis's own copy of the latest offers for a pair, held with the time it arrived so a check need not wait on the venue.
  • Backfilling missed trades — asking the venue for trades Praxis did not hear about, after the feed was away or at a start.
  • How an order is brought back into step — the venue asked what became of each working order, fills taken in before any ending is concluded.

The prices a strategy is priced against

  • Where the bars are kept — the price history a strategy is measured against: one file per series on disk, read for the last bar that closed.
  • When no price comes back — the ways reading that history gives nothing back — the file, the table inside it, or the price itself being unusable.

What Praxis reports back to Nexus

When the books do not match the venue

The records Praxis keeps

  • The order record Praxis keeps — what Praxis holds about one attempt to place an order at the venue.
  • What changes on an order — the fields that move as the venue reports, and the rules that stop applying once the record exists.
  • The position Praxis keeps — what Praxis records of the coin it holds per trade, and when a purchase charge is taken off the amount that purchase adds.
  • The commission and the amount — why holdings are sometimes credited less than the fill reported.
  • When the commission swallows the fill — what happens when the fee equals or exceeds the amount traded.
  • The money ledger — Praxis's own account of what a trade cost and what it made, kept beside the holdings.
  • Lots, and what a sell costs — a buy is remembered as an amount at the price it was bought at, and a sell is costed against those.
  • What the ledger refuses to apply — an event for another account is rejected before the lock is even taken, then inside it a registration is handled first, anything arriving before one is rejected, a repeat registration is rejected, and only past those does a fill meet the symbol test; a close for an unknown trade is silently ignored.
  • What a rebuilt ledger carries — the resumable state holds balances, per-trade realized and fee figures, and open lots, but no journal, so the posting history behind each figure is gone; lots return in the order the snapshot listed them, and under average costing there is one per trade to return.
  • How a journal entry moves the balances — the entry is written to the journal before any balance moves, and each of its lines shifts an account in the direction that account itself dictates, so the same pair of figures moves two accounts opposite ways.
  • What the ledger refuses — it will not be built without an account name, treats a fill in any other coin as something it was never built to do, and throws on a sale larger than the holdings it has open, naming the shortfall.
  • What a reading of the ledger hands back — every way of reading it takes its lock and returns freshly made values, copying each per-trade record rather than just the mapping, so what a reader keeps never shifts underneath them.

The written history, and what it proves

  • Which of the host's appends can stop the work — the host writes several kinds of event the same way, and the record of what an order was sent as raises where an acknowledgement only logs, so a failure there stops the order going out.
  • What a delivery record carries — what the host writes down about an order before sending it comes back unchanged after a restart, while a rebuilt outcome has its average price recomputed, its slice counts set to one, and its timing taken from the record.
  • The event spine — the file Praxis writes its events to, in the order it wrote them.
  • The chain — records carry codes drawn from the record before, so editing a coded one shows up.
  • When an older record can be opened — a record from an earlier build is brought forward to the shape this one expects, unless its identity or its duplicate marks say otherwise.
  • What the chain proves — checking the chain end to end says whether every row that has codes still matches its contents and the row before it.
  • What the chain misses — ways of altering the records that the check does not notice.
  • How a value is written out and read back — exact decimal figures go to storage as text and are rebuilt from that text, so no precision is lost, while anything the writer cannot handle throws rather than being stored in some other shape.
  • What opening the spine does to its schema — a file written by a later build is refused rather than read, an up-to-date one has its version left untouched, and the whole bringing-forward is committed once with any failure rolled back.
  • What the first migrations add and prove — the seal columns are added only when absent and no seal is filled in for older records, and the migration that follows refuses outright rather than guess when it cannot attribute a leftover row or pin the file to one coin pair.
  • What the spine's four readings insist on — the old and new deduplication rows are read under different conversion rules and then compared, and the scan over stored fills builds one refusal message in advance for every way a row can be wrong.
  • How the spine closes a write — a failed save is reported and raised so the caller knows nothing was written, while a failed undo is only logged, because by then there is nothing left for the caller to do about it.
  • What an append does in one transaction — a fill and a money movement each insert a duplicate-guard row first and are judged repeats by whether that insert changed anything, so the guard and the record can never disagree.
  • What sealing an appended event takes — the row is written before its seal can be made, because the number the row is given is part of what the seal covers, so one record takes two writes.
  • What a caller can read back from the spine — reading an epoch collects everything before returning any of it where the internal scan streams row by row, and moving the reconciliation marker takes the same lock an append does.
  • What the last migration drops — the leftover rows are copied, read back and counted before the old table is removed, because removing it is the step a repeat run cannot undo, so a copy that lost rows leaves both tables in place.
  • What the spine asks of its own identity — it refuses a file whose recorded chain settings differ from the build's, saying something different when a setting is missing than when it disagrees, because a lost record and a foreign chain are different problems.
  • The three shapes a coercion looks inside — a field that allows several types always becomes the first of them, a list or pair turns every item into the first type it names, and a nested record keeps only the fields it still declares.
  • How an event is rebuilt from what was stored — a stored event whose type the code no longer has stops the read, while a stored field the type no longer declares is dropped without a word, so stale records fail loudly and stale fields vanish quietly.

The settings a host runs on

  • The settings a host is given — what a host reads from its environment and its manifests before it starts anything.
  • What the strategy records refuse — the records a strategy's entry turns into check what the reading of the file let through, and the schedule is one place where the record asks something the reading never did: that the number of seconds be above zero.
  • What the risk-controls block is held to — the block of loss limits for an account is barely checked at all: three keys are read out of it, anything written under any other key is passed over in silence, and a limit that is no real quantity gets through to be refused a step later.
  • The complaint that names the wrong block — one helper reads every optional number in the settings file and stamps the same block's name on every complaint it makes, so a strategy's own price limit is objected to under a block it was never written in.
  • What a manifest file must be — before any setting is looked for, the path must lead to a file rather than a folder, the bytes must read back as UTF-8, and what the reader makes of them must be a set of keys and values.
  • The two refusals the manifest record adds — an account's settings file is checked as it is read and checked over again by the record made from it, and that second round can turn the file back only for a strategy name used twice, or for allocations adding to more than the whole.
  • What a money figure loses on the way in — a sum of money written in the settings file passes through a reader that holds about seventeen digits before it becomes a number, so one written longer than that arrives rounded, and quoting it in the file is what keeps it whole.
  • The order a strategy entry is read in — a strategy's name and the file it points at are asked only to be present while the settings are being read, and asked to be text afterwards; a timer's schedule is asked what kind of value it is before the timer's own name is.
  • What a strategy's file must be — the file named for a strategy has to sit inside the folder the settings file sits in, be there, read back as UTF-8, and parse as Python, and none of that is looked at until everything else about the settings has passed.
  • Which settings are refused — the checks a host's settings are read through, any one of which failing ends the start.
  • What a timing setting is held to — a setting saying how often the host saves its state, marks its holdings, warns about an unclear send or samples a price falls back to a figure of its own when left out, and one holding something endless or no greater than nothing refuses the start as firmly as a misspelt one.
  • How the mark-price series is settled — the host prices against one run of bars at one width, taken from the strategies it was given where they agree on one, and from a setting where they name several or none.
  • The deployment caps — the ceilings a host's settings can put on what it may do, from an order's worth to a book's age.
  • Which accounts are refused — the checks each account faces as its manifest is read.
  • Where credentials come from — the key and secret for an account, fetched once at startup and handed on to be kept.

Starting and stopping a host

  • What each check is built holding — some of the checks a decision passes are handed their figures once and cannot see them change while the host is up, while others ask for a fresh reading each time a decision arrives.
  • How the watch keeps itself going — the watch sets its own timer after every pass, and a flag read before a pass and again after it means a stop is noticed only once the pass has finished.
  • What the platform ceilings weigh — the last check before an order goes out asks for five numbers and is handed one, and the limits it offers on the rest cannot be used.
  • How an action is routed into a request — a strategy's instruction of an unknown kind is reported and dropped before any check sees it, an instruction to amend an order or to give one up is answered before the money is ever reached, and only the road an exit takes is handed anything able to write a scrap off.
  • Where the two request builders part — an entry falls back on a provider for a price and is dropped where none can be had, while an exit always has the price its position was entered at, and the refusal of a full close is reported as news rather than as a problem.
  • The empty position an entry is given first — an entry has a holding of no size written for it before its order goes out, carrying a price the first fill throws away, because a fill arriving with no holding on record stops the work with an error.
  • What rebuilding an order's record is given — where a command is registered before it is sent, the request the checks already read is handed over rather than a fresh one asked for, because the registering has just changed a figure a fresh request would read differently.
  • What a bracket's protective exit is registered as — the record the protective order will fill against is written when the entry is registered, carrying the size the entry planned rather than the size it filled, and it replaces whatever stood under its name where the entry's own record would have left it alone.
  • What a strategy is told about the account — a strategy missing from the settings is told it holds nothing and may do nothing, the same answer a halted account gives, and every holding the account has is copied to answer about one strategy's own.
  • What a submission remembers between its halves — a mapping made fresh for each batch of instructions holds every request built, and the registering reads it back by a lookup that will not tolerate a gap.
  • What a terminal outcome removes — the last word on an instruction forgets its registration whatever it says, deletes the holding only where nothing is left of it, and nothing but that deletion drops the record a protective order would have filled against.
  • What settles a request before the first stage — the name is fixed when the settings are read, while the money allowance is written as the order is put together — from two figures the settings already hold above zero, except on a request to alter an order, which is given no allowance at all.
  • What an entry's sum is worked out from — an order to buy carries either an amount of money or a quantity, and a quantity is trimmed to what the venue trades in before it is priced, which can make the order smaller than was asked for.
  • What Praxis works out for an exit — before the checks see a request to close a holding, that holding is looked up, what is left of it after anything already in progress is computed, and a label is minted where none came.
  • The watch over handovers that timed out — an order whose handover ran out of time is flagged as unsettled, and a job reports the flags that have stood too long; a final reply the books cannot take in drops the order off the list with its flag still raised, while one that blows up on the way in leaves both standing.
  • Which of a host's changes reach the log — an operator halting or resuming the whole account is written down every time, and an outcome from the venue only where working it through succeeded and one of three marks is set, while the running valuations of what is held are written on nobody's account and ride along with whatever else is being saved.
  • Which hosts the checkpoint timer runs on — the job that writes a full picture of the state at a fixed spacing is switched on only for a live account; a run over bars that already happened builds the same machinery and never switches it on, so a full picture gets written on such a run only where its own start asks for one.
  • Which clock a record is stamped off — every line written to the log carries the real time of the machine, even on a run driven by a made-up clock, because the part that writes those lines is never handed that clock.
  • How a command's unwritten mark is let go — a note that an instruction's figures have moved in memory without being saved yet is cleared in batches, so one instruction's save clears the notes standing against others, while a save an operator asks for clears none of them.
  • What can stop a closing record going down — the line written to say a reply was taken, or that Praxis gave up on it, is handed to a background worker and waited on for ten seconds; the wait running out leaves the write still going, and on one road the line is never attempted at all.
  • The road an arriving report takes — a reply from the venue is converted, has its figures applied in memory and is put on the account's queue, reading nothing of what an earlier run settled; an account with no queue has the reply dropped, and one whose parts are not yet assembled has the figures applied later instead.
  • What the walk that lets marks go cannot reach — the notes saying an instruction's figures are unsaved are cleared from a list copied before the save begins, so a note added while that save runs is not looked at by it; that clearing is the only thing anywhere that removes a note.
  • What an instance's configuration refuses — the account and venue must be usable text, the duplicate window a whole number above zero with a true-or-false rejected, the optional rate and staleness limits held to that same rule, the optional spread and deviation limits finite decimals of zero or more, the self-trade setting a recognised one, and the shutdown timeouts finite numbers above zero.
  • The mapping this record accepts and its neighbours do not — the configuration takes any object that behaves as a mapping, where the signal and the strategy settings insist on a dictionary and reject anything else, so which objects a caller may pass depends on which record receives them.
  • The keys this record rewrites — the configuration's per-strategy caps and its capital shares each trim their keys as they read them, reject one left with nothing, and reject one that collides with a key already taken after trimming, so a mapping that would have silently lost an entry is turned back instead.
  • The one check that reads a mapping whole — each capital share must be a finite decimal above zero and no more than a hundred, and the shares are summed as they are read with a total above a hundred rejected, which is the only place this record examines entries as a group rather than one at a time.
  • The field that must name its yardstick — the reference price source is optional, trimmed and lower-cased and written back over itself, and accepted only as one specific name; a deviation limit of either kind is rejected when no source is named, which is the only place this record compares one of its fields with another.
  • The stop that waits for its pollers — stopping one poller waits for the turn in hand and swallows the interruption it caused, and the host walks all of them waiting for each under a single ten-second limit shared between them, keeping the list when the walk fails or runs out and emptying it only when the walk finishes.
  • What a credential record must hold — a record read as text must parse as JSON and be an object, with api_key and api_secret each a truthy string, so an empty one is rejected while a whitespace-only one is kept and used; every other field is ignored, and the road handed ready-made credentials parses nothing.
  • The records a file of credentials is read into — the file is parsed and decoded on the first request and the result cached only if the whole file passes, so a failed read is retried and a corrected file picked up, a successful one is never re-read, and decoding walks the file's own accounts and stops at the first it rejects.
  • What the host's configuration record refuses — each venue URL is tested for truthiness alone so a whitespace one is kept, each timeout is compared against zero with no type check so a NaN passes while a string raises from the comparison itself, and the credentials mapping's keys along with the keys and secrets inside its values are all truthiness-tested.
  • What the configuration record holds afterwards — the record is frozen, so its own construction writes through a call that bypasses that in order to seal copies of its mappings and freeze its mode set; the seal stops a caller mutating the mapping it handed in, while that same bypass stays open for replacing a field entirely.
  • Which name a command is kept under — an order is filed under either the label the sender chose or the label the other side answered with, and which of those applies was fixed long before the order went.
  • Claiming the money after the send — on one route the money held in reserve is re-booked against an order only once that order has gone, so a refusal arrives too late to stop it and can leave the reply with no strategy to attach it to.
  • What the one listener serves — the road a container polls for health and the asks that halt an account or close what it holds all arrive on the same listener, bound to every address the host has, and a port it cannot bind stops the host outright.
  • When an account can be delivered to — an account is reachable only while its runtime is published, which happens once its own thread has built it, and an ordinary stop unpublishes it before the account's loops are stopped.
  • What a host keeps as it is built — the settings and surroundings a host is handed are held as they came, only its list of accounts is copied, and where an alert will be sent is settled while the host is being built rather than when one is raised.
  • What a host refuses to be built as — being handed both a record and a path to one fails the same line as being handed neither, and the demand that every deployment cap be set is written in two places that raise different kinds of failure.
  • The two mappings an account lives in — an account is written down for accounting from inside its own build and written down as reachable only once that build has answered, so a report can be accounted for against an account nothing can yet ask anything of.
  • Which roads out wait for an account to be ready — money moving, a disagreement found and a protection to put right are all held back until an account is reachable, while an outcome is handled whether it is or not.
  • The order an account's loops start and stop in — the loops an account runs come up in a fixed order with the producing one ahead of the consuming one, and on the way down some are stopped by hand and the rest handed to the stopping sequence, with none stopped twice.
  • What the build refuses before an account runs — a startup sequence that has answered is not proof it produced anything, and the build says so; past its refusals the lock guarding holdings is also installed as the risk record's own, so one lock stands under two names.
  • What runs before an account's loops do — outcomes a previous run never acknowledged are re-delivered, and held-over instructions are sent, while the account's figures can still be moved but nothing can be asked of it yet.
  • Starting a host — what one process does to bring Praxis and Nexus up, in the order it does it.
  • What a strategy's startup answer does — each strategy is asked what it wants to do before trading begins, and the same kind of failure stops the whole boot from one side of a few lines and is merely logged from the other.
  • What the buffer of startup answers is for — where there is no way to send a strategy's opening request yet, it is held for later, and the holding place is emptied before anything is sent.
  • Which saved events a strategy is handed — a host coming back up replays what was saved so a strategy can rebuild what it knew, skipping events for strategies the settings no longer name.
  • The mode a start begins with — a host with no health reading yet begins in the state that allows less rather than more, and what this step settles is an input to the mode rather than the mode.
  • What a start hands the loops — the descriptions the polling and timing need are worked out from the settings file alone, with nothing read from disk and no loop built here.
  • How the strategies are built — every strategy is built inside one attempt, so any one of them failing arrives as a single complaint that names the step rather than the strategy.
  • What a start wraps, and what it lets through — most steps turn whatever went wrong into one complaint of their own, and one of them passes a complaint already shaped for a caller straight out.
  • What a starting host reports — what the figures a starting host publishes actually confirm, and why reading healthy does not mean every account is ready.
  • What poisons an account — four failures mark an account as no longer trustworthy about its own state, and nothing in the running system lifts the mark.
  • What picks a stalled ladder change up again — a grid change that stopped halfway is driven on by a scan that requires both marks the change leaves behind.
  • What a failure at startup does — which steps stop the host when they go wrong, and which are written off.
  • What startup does with orphaned work — work the record cannot account for, and orders at the venue it has never heard of.
  • Stopping a host — a host comes down when its stop flag is set, which a signal or an escaping exception does.
  • What becomes of work still open — what a stopping host does with commands part-way through and orders resting at the venue.
  • How a restart reads its record back — every event is walked once and a command rebuilt from it comes back as a single order whatever it was, so the kinds of work that span several events are left entirely to the rebuilds that follow it.
  • What one pass gathers for the schemes — one reading of the history answers what both rebuilds need, and a scheme frozen because its protection failed stays frozen through any number of replans where one frozen by a failed slice does not.
  • Which ladders a restart passes over — a restart walks every ladder the replay found started, and a run of readings decides which are brought back.
  • What a resumed ladder's grid is taken from — the live grid comes from the last change that completed rather than from the start, which is what makes the names of the resting rungs findable.
  • What stops a scheme being resumed — a fed-out order whose plan can no longer be worked out is passed over silently and not ended either, so it waits for the pass that closes orphaned work, and a scheme that recorded only its start is treated as still going.
  • What a scheme's settings are rebuilt from — a schedule comes back from the figures its own start recorded, so the instruction that asked for it need not survive.
  • The entry report a restart makes good — a fill that reached the record but never reached Nexus is reported after a restart, and only where something actually filled.
  • What a resumed scheme comes back holding — a replan replaces the plan the start recorded outright, a child that finished while the host was down is not counted as live, and a scheme with nothing left to wake it is handed the present moment.
  • What a restart puts back — the live work rebuilt from the record, each kind at the point it had reached, with nothing already at the venue sent again.
  • What stops a bracket being resumed — six tests pass a protected entry over, and a protection that failed and was then restored comes back active because the later record clears the mark the earlier one set.
  • What a resumed bracket's protection is taken from — the legs restored are the ones belonging to the list the venue is actually resting, so a price change whose call-off never landed restores the legs that are really there.
  • What a restart puts back of a bracket — a resting pair left alone, one that never got out sent, one mid-change left for the watch, and a stale one passed over.
  • What stopping leaves undone — stopping carries on past a refused cancel, a drain out of time and a failed close, logging each, while being called off stops it where it stands.

Watching a host run

  • Health — what Praxis records about the venue answering, and who can halt an account on it.
  • What the operator's two sweeps answer with — asking an account to cancel everything and close what it holds wraps both halves together, so a failure closing discards the answer about what was cancelled although those cancellations were already sent.
  • What a sweep does to each item — both walks carry on past an item that fails, and the walk closing positions names every position it tried while the walk cancelling orders simply leaves a failed command out of its list.
  • What every operator road weighs first — the operator roads stay off entirely until a token is set, a caller from elsewhere on the network is turned away before the token is looked up, and the same answer serves both an account that is absent and no account named while none runs.
  • What an operator's halt and resume do — the mode is changed before anything is written down, so an operator told the ask failed is looking at an account that has been halted and may not stay halted past a restart.
  • What the health road reports unhealthy for — the road a container polls to decide whether to restart the host asks nothing at all about its caller, and answers with a list naming every part of the host that has stopped rather than the first one found.
  • Which accounts the figures road knows — the road serving a paper run's figures answers for the accounts the settings name, where the operator roads answer only for accounts that have finished building, so one name reaches two different answers.
  • Alerts — how Praxis says something needs a person: a marked log line, and a web call where one is configured.
  • What a host writes about itself — a host writes JSON, one piece per line, each line carrying its level and the moment in UTC.
  • What the logging arrangement misses — log lines a library writes keep their own shape, and asking the host for plain text does not change them.

Replaying recorded bars

  • What a clock refuses and what stands in — the replay clock rejects a start with no zone and keeps whatever zone it is given without converting it, while a price store given no clock uses one reporting the current moment in universal time.
  • The moments a replay request names — a window edge given with a trailing capital Z is rewritten to an explicit zero offset and anything else is passed to the standard reader untouched, so a lower-case z is refused, a bare date becomes midnight with no zone, and whether a missing zone is caught by the ordering comparison or later by the frame reader depends on what the other edge carries.
  • What stopping the replay listener does — the shutdown attached to the server's cleanup waits for the run already under way and cancels whatever is still queued at that moment, and a cancelled run's record is never written again, so it still answers as running for as long as the service can be asked.
  • What the mark sampler is built with — the account and symbol are tested for truthiness only, so a whitespace name is kept, and the interval is rejected at or below zero without any check of its type, so a not-a-number interval makes the inter-sample wait expire immediately and a Decimal one makes that wait raise, ending the loop's task.
  • Starting and stopping the sampler — starting raises while a task is still running and otherwise clears the stop flag and launches the loop, while stopping sets the flag, cancels, and awaits, suppressing only the error a cancelled task raises, so a task that failed another way re-raises out of the stop and is still held afterwards.
  • How a replay settles a bar — each bar ends by waiting for the account's command queue to empty and then draining outcomes until a round drains none, with eight rounds allowed before it raises, and the wait covers only the queue, so a scheme whose next slice is due later has already left it and arrives during a later bar.
  • The mode a replay gives itself — a replay writes the ACTIVE mode into the account state itself, under the positions lock and before the first bar, because no health loop runs to move it; the trigger is recorded as the replay and the moment comes from the replay's own clock.
  • The worst fall a replay reports — the peak is seeded from the series' own first value rather than from the stake, so a run starting below its stake reports nothing of that; the worst drop is kept as a fraction of the running peak, a peak at or below zero is skipped instead of divided by, and an empty series answers zero.
  • What the replay report counts a trade as — every trade is filed as a buy-and-hold one with nothing checked to decide it, and a trade that finished exactly even is left out of both the winners and the losers while still counting in the overall figure.
  • How the replay report places a fill in a bar — a fill is assigned to a bar by looking up its time among the bars' end times and stepping back, never below the earliest, so a fill from before the first bar is moved into it and nothing records the move.
  • When the risk-adjusted figure is absent — it is left empty for a non-positive interval, for fewer than two returns, and for a zero variance; a step whose previous equity is at or below zero forms no return at all, which can starve the count, and otherwise the answer is the mean over the standard deviation, annualised by a square root.
  • Replay — running the ordinary path over bars that already happened.
  • What the replay venue refuses before it fills — five refusals stand before the simulated venue works anything out and four more after, so getting past the first five means only that the figures have been taken.
  • How the replay venue settles a fill — the commission lands on the money balance whichever way the order goes, which is the opposite arrangement from the other simulated venue.
  • What the replay venue snaps a quantity to — a quantity is floored onto the venue's step, and a quantity the flooring made too small is refused with the same reason as one that was too small to begin with.
  • What the replay venue answers when asked — several answers are fixed, and the same missing information gives nothing in one place and an error in another.
  • How the replay venue narrows its trades — asking for a limited number of trades gives the earliest recorded rather than the most recent, and an account that has been removed still answers with everything it traded.
  • What the replay venue will not do — several of the things a venue must offer are answered here by declining, since nothing ever rests unfilled and there is no real exchange behind it.
  • What a replay is given — the bars, the money and the strategy text a replay run is handed before it starts.
  • Where a replay's bars come from — a run over real history takes its bars from a prediction frame and a price frame, filtered before use.
  • The frames a replay writes — every run writes a price frame and a prediction frame of its own before each bar goes out.
  • The replay clock — the clock moved by hand, one bar at a time.
  • The replay venue — what stands in for an exchange during a replay, holding one price at a time inside the same program.
  • Asking for a replay from outside — the request that starts a run, and everything it is held to before one begins.
  • What a replay reports — the single result a finished walk hands back: bars walked, fills, amounts, fees and what was made.
  • What a replay run reports back — a run asked for over HTTP answers at once with a name, and holds the result until that name is asked after.

A simulated exchange on the real paths

  • What a simulated walk refuses — both walks over binsim's book reject a non-finite or non-positive figure and answer an empty side with a different error naming the book as never filled, and the spend walk's second return value reports the unspent budget only when the book ran out, being forced to zero when a partial level was taken.
  • What binsim's read endpoints answer — health and time ignore the request entirely, the trading-rules endpoint checks a symbol only when one is supplied, and the order-book endpoint insists on one, reporting a missing symbol under a different code from an unrecognised one.
  • What binsim's server holds and when — it is built with its web application already made, and takes hold of the pieces that serve requests only once a start has succeeded, so a failed start leaves it holding neither of them and reading as stopped.
  • The two sockets binsim accepts — one connection reads what arrives and replies, the other reads what arrives and throws it away, and both stay up on the same keepalive, so a caller cannot tell a discarded message from one that was acted on.
  • What a submitted order is weighed against — the book's staleness is measured from the last successful price fetch rather than from the last time the book changed, and the lot rules are applied after the book walk on one sizing road and before it on the other.
  • What a fill's fee is charged in — at every price level a buy is charged in coin and a sale in cash, so a round trip is charged in two different assets and its fees cannot be added together, and an account with no balance record is told its order was rejected rather than its key refused.
  • What a subscription frame is answered with — a message the simulator cannot parse is dropped without reply while anything it can parse always gets one, and a value sent as the wrong type reaches the emptiness test as empty.
  • What the application is handed and what it serves — the book, the balances, the price feed and the staleness limit are each attached to the application under their own key, every handler reaching them through it, and one path answers about an order or submits one depending on the method used.
  • What an order's figures are put through — rounding an amount only ever lowers it, and the smallest-value check returns immediately when the book has no price to measure against, so such an order passes it unmeasured.
  • What asking for a signature buys — the endpoints that demand a signed caller use it for the account name, and an account the simulator has never heard of comes back as a refused signature, so a bad key and an unknown account look identical.
  • The two shapes a refusal takes — the routine that builds an error returns one to be thrown for two known statuses and throws one itself for anything else, so the same call is a factory on one path and a failure on the other.
  • Binsim — a simulated exchange Praxis can be pointed at, answering over the web on the real venue's paths.
  • What the simulated venue's settings must be — the service reads its settings from the environment, insists on a token and a folder for its books, and fills in the rest; the bounds on the numbers differ enough that the same value is fine for one setting and refused for another.
  • The order the simulated venue starts and stops in — the shutdown handlers go in before anything is started, the price feed is started before the server without waiting for its first reading, and the stopping happens in reverse.
  • Registering an account from the command line — the command that creates an account hands the operator a key, holding the folder lock across reading the saved balances and writing the new account into them.
  • What running the simulated venue plainly does — leaving the command off is how the service itself is run, and the folder lock is held for as long as it stays up.
  • Which failures give a sentence and which a stack — some bad starts print one clear line and others print a full trace, and which you get follows from what kind of thing the failure is rather than from how serious it is.
  • Binsim's book — a list of prices handed to it, replaced whole, and filled against by walking.
  • Binsim's ledger — what the simulated venue keeps per account: the balances it holds and the fills it has been given.
  • What settling a fill moves — both of an account's balances move at once, the fee comes out of what the side receives rather than being charged beside it, and a balance landing exactly on zero is allowed.
  • The asset a fee is taken in — the commission is charged in the coin on a purchase and in the money on a sale, to match what a real exchange does, and the file's own description says the opposite.
  • The order a fill's refusals stand in — seven things are checked before the books are touched, and whether the account exists at all is asked after every one of them.
  • The guard a sell does not get — a purchase whose commission swallows everything bought is turned away, and a sale whose commission swallows the money coming in is not, so such a sale leaves the account lighter in both.
  • What an order settles as one — several fills settle together against one check of the totals, so a step that would overdraw partway through is allowed where a later step covers it.
  • The three readings the ledger offers — each answer is taken while the books are held still and handed over as a copy, so nothing a caller does to what it was given reaches the books.
  • The lock one writer holds — the simulated venue keeps its books in memory and writes them out whole, so one lock on the state folder is what stops two programs each writing over the other's work.
  • What a refused writer is told — being turned away from that lock gives one message built from two readings that can each come up short, so it may name a program that has already finished, or none.
  • What registering an account refuses, and the key it mints — four things are checked before the books are touched at all, and the key handed back is the only one that account will ever be given.
  • How a key names an account — a key is trimmed and scrambled before it is looked up, three quite different problems all give the same silent answer, and padding a key with spaces is no barrier.
  • What an interrupted save does — a save interrupted partway still finishes writing before the interruption is passed on, and there is one narrow case where a failed save is reported to the log alone.
  • How the snapshot is written and read back — the books go to a new file beside the old one which is then moved into place, so a reader sees the whole of one version or the whole of the other.
  • What reading the saved ledger requires — a missing file is a fine answer and a damaged one stops the service coming up, and the index of keys is rebuilt from the accounts rather than trusted from the file.
  • What a restart of the simulated venue loses — balances outlast a restart and the record of the trades behind them does not, while the numbering carries on as though nothing were missing.
  • When binsim turns an order away — the refusals that turn on the venue's own state: a book too old, a name booked before, a balance that cannot cover it, and a size the venue will not take.
  • What a binsim snapshot is turned away for — depth, progress and shape are each checked before a snapshot replaces the book, and orders go on filling against whatever was accepted last.

Summing up a replay or a paper run

  • What a paper run's figures add — a paper run is summed up like a replay, except its prices are sampled from the market rather than read from bars, and it works out their spacing itself.
  • The paper report — how recorded fills and sampled prices become closed-trade results and account figures, asked for during a run or after it.
  • The mark sampler — the market price noted on a timer between trades, so a paper run has something to value an open position against — and the samples that arrive late or not at all.
  • The two bases the figures come from — the same summary figures worked out twice, once from the run's own steps and once from tables of bars.
  • What the parity figures refuse — the bar-based figures turn away empty input, mismatched columns and a prediction that is neither yes nor no, and assume a fee unless told otherwise.
  • The metrics — the figures a run is summed up by, and the units they come in.

Routes end to end


Created 2026-09-16 15:31 UTC · Last modified 2026-11-10 14:52 UTC

Edit this sourceCheckout revision · 7381aa49
Reference / keep your place
Find a passage