Precomputing Live demo: Engine How to run it

Answers ready before you ask

A trading day of stock trades, turned into candles by the Engine in your browser

Loading SQLite and the Engine

Loading SQLite and the Engine.

0
trades in
–
trades a second, now
–
of the time the Engine is busy
–
trades a second at full speed on this device
0
trades in memory, not yet in the file
–
the Engine's file

Candles

Drawn from the Engine's file with SQL, as it writes it.

Up: closed at or above its open Down Volume An unusual step: a price jump

New York time. Prices and symbols are invented. Hover or use the arrow keys for a candle's open, high, low, close, VWAP and volume.

Quote board

Seven precomputes, read from the file. Pick a row to chart it.

SymbolLastChangeHighLowVolumeVWAPTrades

Trades a second, all symbols

Minute by minute, from the 1-minute candles: busy at the open and the close, calm at lunch.

Price jumps

Trades whose step from the previous trade is far outside the usual steps, kept whole.

    What happened

    Newest first.

      Pulling the plug

      The Engine is thrown away in the middle of writing a checkpoint: the whole program and everything in its memory. SQLite rolls the half-written checkpoint back, a fresh copy of the Engine opens the file, and the feed resends every trade after the last one the file holds. At 13:15 the demo does this once by itself.

      WhenByTrades only in memoryRows written, then rolled backTrades resentBack inCandles checked afterwards
      Not yet. Press Play, then Pull the plug whenever you like.

      The race: the Engine against the compiled SQL

      The first 200,000 trades of the day, rounded up to a whole second, through a fresh Engine and through the same policy compiled to SQLite triggers. Both take turns on the same thread in equal slices of time, then every value in the two files is compared.

      Engine
      –
      SQL triggers
      –
      The trading day pauses while the race runs.

      The policy

      The same short policy runs in the Engine and, compiled, in plain SQLite. Candles are window summaries; the quote board is seven precomputes.

      
          
        

      Ask the file

      The Engine's file is plain SQLite, the same layout the compiled SQL keeps. Pick a question or write your own, then press Run (or Ctrl+Enter, ⌘+Enter on a Mac). It reads while the day is paused or finished.