arvo-api 0.5.0

The types of Arvo's engine API, generated from its protobuf contract. Messages only, no transport, so it builds for WebAssembly.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JobId {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VendorId {
    #[prost(string, tag = "1")]
    pub vendor: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VendorProfile {
    #[prost(string, tag = "1")]
    pub vendor: ::prost::alloc::string::String,
    /// Which sub-account, for a vendor that has them (Alpaca's paper and live).
    #[prost(string, optional, tag = "2")]
    pub profile: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AccountKeys {
    #[prost(string, tag = "1")]
    pub vendor: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub profile: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, tag = "3")]
    pub key_id: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub secret: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SignIn {
    /// Where to send the person. The caller opens it: the engine binds the
    /// loopback listener and exchanges the code, but opening a browser is the
    /// front end's job (ADR-0028).
    #[prost(string, tag = "1")]
    pub url: ::prost::alloc::string::String,
}
/// A script's path, relative to the project folder. What identifies a
/// schedule: one schedule per script.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptPath {
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
}
/// A run in progress, as `RunScript` numbered it.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RunId {
    #[prost(uint32, tag = "1")]
    pub run: u32,
}
/// A cadence a person set for one of their scripts.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptSchedule {
    /// Relative to the project folder.
    #[prost(string, tag = "1")]
    pub script: ::prost::alloc::string::String,
    /// The cadence when no cron expression is set. Kept either way, so
    /// switching to cron and back does not lose what the interval was.
    #[prost(uint64, tag = "2")]
    pub every_secs: u64,
    /// A cron expression as the person wrote it. When set it decides when the
    /// script runs and `every_secs` is not consulted.
    #[prost(string, optional, tag = "3")]
    pub cron: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(bool, tag = "4")]
    pub enabled: bool,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JobView {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub label: ::prost::alloc::string::String,
    /// The project script this job runs, when it is a scheduled script
    /// rather than one of the runtime's own. `None` for a built-in.
    #[prost(string, optional, tag = "3")]
    pub script: ::core::option::Option<::prost::alloc::string::String>,
    /// The cron expression it runs on, as the person wrote it. `None` for a
    /// job on a fixed interval, where `every_secs` is the cadence.
    #[prost(string, optional, tag = "4")]
    pub cron: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(uint64, tag = "5")]
    pub every_secs: u64,
    #[prost(bool, tag = "6")]
    pub running: bool,
    #[prost(uint32, tag = "7")]
    pub runs: u32,
    #[prost(string, optional, tag = "8")]
    pub last_started: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "9")]
    pub last_finished: ::core::option::Option<::prost::alloc::string::String>,
    /// One line from the last run that succeeded.
    #[prost(string, optional, tag = "10")]
    pub last_result: ::core::option::Option<::prost::alloc::string::String>,
    /// Why the last run failed, when it did.
    #[prost(string, optional, tag = "11")]
    pub last_error: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "12")]
    pub next_run: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PluginStatusView {
    #[prost(oneof = "plugin_status_view::Of", tags = "1, 2")]
    pub of: ::core::option::Option<plugin_status_view::Of>,
}
/// Nested message and enum types in `PluginStatusView`.
pub mod plugin_status_view {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Of {
        #[prost(message, tag = "1")]
        Reachable(super::PluginStatusViewReachable),
        #[prost(message, tag = "2")]
        Unreachable(super::PluginStatusViewUnreachable),
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PluginStatusViewReachable {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub version: ::prost::alloc::string::String,
    #[prost(string, repeated, tag = "3")]
    pub capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PluginStatusViewUnreachable {
    #[prost(string, tag = "1")]
    pub reason: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PluginView {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub address: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub status: ::core::option::Option<PluginStatusView>,
}
/// One signal a plugin publishes, as it stands right now (#163).
///
/// A signal that is declared and has no value is shown with none, not with
/// a zero and not with whatever it last said. That is the invariant made
/// visible: a reader looking at this list should be able to see the
/// difference between "nothing to say" and "saying nothing has changed".
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignalView {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub description: ::prost::alloc::string::String,
    /// Whether each value is computed from what was known at that instant.
    /// A study may gate on a causal signal and never on a descriptive one.
    #[prost(bool, tag = "3")]
    pub causal: bool,
    /// Why it is not causal, in the provider's own words. Empty when it is.
    #[prost(string, tag = "4")]
    pub because: ::prost::alloc::string::String,
    /// What computes it, by name and version.
    #[prost(string, tag = "5")]
    pub engine: ::prost::alloc::string::String,
    /// The instant the value describes, empty when there is no value.
    #[prost(string, tag = "6")]
    pub at: ::prost::alloc::string::String,
    /// `None` is the answer for a signal that is declared and silent, and
    /// for one whose provider has gone away.
    #[prost(double, optional, tag = "7")]
    pub value: ::core::option::Option<f64>,
}
/// One strategy an extension contributes as a document (#162).
///
/// Data Arvo reads, like a theme: there is no code in it and none runs in
/// the window. A document this build cannot offer is listed with the reason
/// rather than dropped, so a person can see why their catalog is one entry
/// short.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StrategyContributionView {
    /// Namespaced by its extension: `their-catalog.fast-cross`.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub label: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub premise: ::prost::alloc::string::String,
    /// `grid` or `rules`, as the document names its kind.
    #[prost(string, tag = "4")]
    pub kind: ::prost::alloc::string::String,
    #[prost(string, tag = "5")]
    pub interval: ::prost::alloc::string::String,
    /// Configurations the search holds; zero for a kind that is not a grid.
    #[prost(uint32, tag = "6")]
    pub configurations: u32,
    /// Why it is not in the strategy picker. `None` means it is.
    #[prost(string, optional, tag = "7")]
    pub problem: ::core::option::Option<::prost::alloc::string::String>,
}
/// A list, as a message.
///
/// An RPC returns one message, never a bare repeated field, so a call that
/// answers with a list needs a name for the list. The wrapper is also where
/// a total or a "when this was read" goes later, without renumbering what is
/// already here.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JobsView {
    #[prost(message, repeated, tag = "1")]
    pub jobs: ::prost::alloc::vec::Vec<JobView>,
}
/// The plugins this engine hosts. A list, as a message; see `JobsView`.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PluginsView {
    #[prost(message, repeated, tag = "1")]
    pub plugins: ::prost::alloc::vec::Vec<PluginView>,
}
/// What the plugins publish. A list, as a message; see `JobsView`.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignalsView {
    #[prost(message, repeated, tag = "1")]
    pub signals: ::prost::alloc::vec::Vec<SignalView>,
}
/// What one extension contributes to the strategy picker.
///
/// Its own message because a proto map's value cannot itself be repeated.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StrategyContributionsView {
    #[prost(message, repeated, tag = "1")]
    pub contributions: ::prost::alloc::vec::Vec<StrategyContributionView>,
}
/// Every extension's contributions, by extension name.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExtensionStrategiesView {
    #[prost(map = "string, message", tag = "1")]
    pub by_extension: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        StrategyContributionsView,
    >,
}
/// One vendor as the Accounts view shows it: what it needs from the
/// person, whether it has it, and what it gives back.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccountView {
    /// The vendor's id: `robinhood`, `alpaca`, `yahoo`.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub label: ::prost::alloc::string::String,
    /// `none`, `sign_in` or `keys`.
    #[prost(string, tag = "3")]
    pub credential: ::prost::alloc::string::String,
    /// Whether the credential is there and the vendor can be used. Always
    /// true for one needing nothing.
    #[prost(bool, tag = "4")]
    pub connected: bool,
    /// In words: `bars`, `quotes`, `holdings`, `option quotes`.
    #[prost(string, repeated, tag = "5")]
    pub provides: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// The sources under this vendor, by label.
    #[prost(string, repeated, tag = "6")]
    pub sources: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// When one vendor login holds several accounts that each need their own
    /// credential — Alpaca's paper and live, from one login but two key pairs
    /// — each is one of these. Empty for a vendor with a single credential.
    #[prost(message, repeated, tag = "7")]
    pub subaccounts: ::prost::alloc::vec::Vec<SubAccountView>,
}
/// One account under a vendor that has more than one: its own credential and
/// its own state, sharing the vendor's row.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubAccountView {
    /// The vendor's spelling: `paper`, `live`.
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub label: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub connected: bool,
    /// Real money, so the window can mark it. Paper is not.
    #[prost(bool, tag = "4")]
    pub live: bool,
}
/// A person's vendors. A list, as a message; see `JobsView`.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccountsView {
    #[prost(message, repeated, tag = "1")]
    pub accounts: ::prost::alloc::vec::Vec<AccountView>,
}
/// Something that happened while nobody was looking: a plugin dropped, a
/// broker session ended (#150).
///
/// Every other view answers a question a front end asked. This is the other
/// direction, so it arrives on a stream rather than as a reply.
///
/// # Why the text is in the payload
///
/// `title` and `detail` are filled in by the engine rather than derived from
/// the kind by whoever renders it. There are two renderers — the OS
/// notification and the in-app alerts list — and text derived twice is text
/// that drifts. The kind is left for what a renderer needs *structurally*:
/// the status bar needs to know a feed is down, not how to phrase it.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EventView {
    #[prost(message, optional, tag = "1")]
    pub kind: ::core::option::Option<EventKindView>,
    #[prost(string, tag = "2")]
    pub title: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub detail: ::prost::alloc::string::String,
    #[prost(enumeration = "SeverityView", tag = "4")]
    pub severity: i32,
}
/// What happened, structurally.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EventKindView {
    #[prost(oneof = "event_kind_view::Of", tags = "1, 2, 3, 4, 5")]
    pub of: ::core::option::Option<event_kind_view::Of>,
}
/// Nested message and enum types in `EventKindView`.
pub mod event_kind_view {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Of {
        #[prost(message, tag = "1")]
        Plugin(super::PluginEvent),
        #[prost(message, tag = "2")]
        Feed(super::FeedEvent),
        #[prost(message, tag = "3")]
        Stream(super::StreamEvent),
        #[prost(message, tag = "4")]
        Findings(super::FindingsEvent),
        #[prost(message, tag = "5")]
        Session(super::SessionEvent),
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PluginEvent {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub reachable: bool,
}
/// A broker connection came up or went away. `connected: false` covers both
/// signing out and a session that expired underneath you — which of the two
/// it was is in the detail, because the difference matters to a person
/// reading it and not at all to the status bar.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FeedEvent {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub connected: bool,
}
/// The live price stream stopped or came back.
///
/// Its own kind rather than another feed: the status bar reads a feed event
/// to decide whether a broker session is held, and a price socket dropping
/// says nothing about that. Folding the two together would have a Yahoo
/// reconnect claim you had been signed out of your broker.
///
/// Worth an event at all because the failure is otherwise invisible: a dead
/// socket looks exactly like a market where nothing is trading.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StreamEvent {
    #[prost(bool, tag = "1")]
    pub live: bool,
}
/// Stored findings went stale since they were last checked — their data
/// changed or disappeared. The count is how many were newly so.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FindingsEvent {
    #[prost(uint32, tag = "1")]
    pub count: u32,
}
/// A trading session changed state: starting, running, stopped, halted or
/// failed.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SessionEvent {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub state: ::prost::alloc::string::String,
}
/// One scheduled script: a project file the engine runs on a timer.
///
/// The engine runs it, not a window, so a cadence a person set goes on being
/// honoured after they close the window (ADR-0018). A schedule that only
/// fires while someone is watching is not a schedule.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptJobView {
    /// Relative to the project folder, and what identifies the schedule: one
    /// schedule per script.
    #[prost(string, tag = "1")]
    pub script: ::prost::alloc::string::String,
    /// The cadence when `cron` is unset. Kept either way, so switching to a
    /// cron expression and back does not lose what the interval was.
    #[prost(uint64, tag = "2")]
    pub every_secs: u64,
    /// A cron expression, as the person wrote it. When set it decides when the
    /// script runs and `every_secs` is not consulted.
    #[prost(string, optional, tag = "3")]
    pub cron: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(bool, tag = "4")]
    pub enabled: bool,
}
/// Every saved schedule. A list, as a message; see `JobsView`.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScriptJobsView {
    #[prost(message, repeated, tag = "1")]
    pub jobs: ::prost::alloc::vec::Vec<ScriptJobView>,
}
/// One line from a running script, or the fact that it ended.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptOutputView {
    /// Which run, as `RunScript` numbered it.
    #[prost(uint32, tag = "1")]
    pub run: u32,
    /// `out`, `err`, `info` (what the engine started) or `exit`.
    #[prost(string, tag = "2")]
    pub stream: ::prost::alloc::string::String,
    /// The line without its newline; for `exit`, how it ended.
    #[prost(string, tag = "3")]
    pub text: ::prost::alloc::string::String,
}
/// Whether this is worth interrupting someone for.
///
/// The one thing that decides it: a warning raises an OS notification, info
/// only lands in the alerts list. Both are always recorded, so the
/// distinction costs nothing but noise.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SeverityView {
    Unspecified = 0,
    Info = 1,
    Warning = 2,
}
impl SeverityView {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "SEVERITY_VIEW_UNSPECIFIED",
            Self::Info => "SEVERITY_VIEW_INFO",
            Self::Warning => "SEVERITY_VIEW_WARNING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SEVERITY_VIEW_UNSPECIFIED" => Some(Self::Unspecified),
            "SEVERITY_VIEW_INFO" => Some(Self::Info),
            "SEVERITY_VIEW_WARNING" => Some(Self::Warning),
            _ => None,
        }
    }
}