← All examples
Example 26
Hook on fill log
a hook for "order filled": print what was filled, from the event.
- Category
- Host: needs the terminal's data and engine
- Permissions
- None
- Before you run it
- attached to "Order filled" (or "Order rejected", "Order
- What it does
- none
- How to run it
- in Script Hooks, "+ Add script" under "Order filled", choose this
- Language
>=0.1.1, <0.2.0- Host
>=0.1.5, <0.2.0- Needs
- event >=0.1.0, <0.2.0
Source
// Purpose: a hook for "order filled": print what was filled, from the event. // Category: host // Permissions: none // Preconditions: attached to "Order filled" (or "Order rejected", "Order // cancelled") in the Script Hooks window // Side effects: none // Run: in Script Hooks, "+ Add script" under "Order filled", choose this // file. The log shows what it printed; it needs no permission. lang ">=0.1.1, <0.2.0"; host "ttt" ">=0.1.5, <0.2.0"; requires "event" ">=0.1.0, <0.2.0"; fn main() { let e = event.current(); print(e.kind + " at " + to_string(e.time)); for line in e.data { print(" " + line); } }