Commit Graph

84 Commits (2d7aba0193f9fa9dcad6977eaebd7545629cdfd5)

Author SHA1 Message Date
Tyler Goodlet 15922f4090 More ems resiliency: discard broken client dialogs 2022-04-16 15:38:26 -04:00
Tyler Goodlet c1bdf0e26d Make a derivs intrustment type table for alloc config checks 2022-04-16 15:38:26 -04:00
Tyler Goodlet 8a4f124a48 Use units by default for continuous futes 2022-04-16 15:38:26 -04:00
Tyler Goodlet ebe2680355 Change `uncons_fqsn()` -> `unpack_fqsn()` 2022-04-11 01:01:36 -04:00
Tyler Goodlet e92632bd34 Remove old commented nan checking lines 2022-04-10 21:51:22 -04:00
Tyler Goodlet c9e6c81459 Expect fqsn input to paper clearing engine 2022-04-10 17:33:02 -04:00
Tyler Goodlet c7f3e59105 Expect fqsn in ems and order mode
Use fqsn as input to the client-side EMS apis but strip broker-name
stuff before generating and sending `Brokerd*` msgs to each backend for
live order requests (since it's weird for a backend to expect it's own
name, though maybe that could be a sanity check?).

Summary of fqsn use vs. broker native keys:
- client side pps, order requests and general UX for order management
  use an fqsn for tracking
- brokerd side order dialogs use the broker-specific symbol which is
  usually nearly the same key minus the broker name
- internal dark book and quote feed lookups use the fqsn where possible
2022-04-10 17:30:02 -04:00
Tyler Goodlet c034ea742f Fix comment: filled not executed is a valid status key 2022-04-09 16:46:25 -04:00
Konstantine Tsafatinos 48c7b5262c get positions working for kraken 2022-03-06 15:17:26 -05:00
Tyler Goodlet 16b9e39e11 Dis-allow an allocator limit less then the current pp size 2022-03-02 10:05:33 -05:00
Tyler Goodlet 7b13124dd4 Keep clear loop price pedantically up to date
To avoid the "trigger finger" issue (darks execing before they should
due to a stale last price state, normally when generating a trigger
predicate..) always iterate the loop and update the last known book
price even when no execs/triggered orders are registered.
2022-02-11 10:30:30 -05:00
Tyler Goodlet ca1c1cf415 Annoying doc strings 2022-02-11 10:30:30 -05:00
wattygetlood fc3c0741b8 Set isn't serializable on std msgpack 2022-02-10 10:26:52 -05:00
Tyler Goodlet 16c04e11e4 Comment out nan-price assert previously for `ib` in ems clear tasks 2022-02-07 09:49:45 -05:00
Tyler Goodlet 47d0c81a2d Only warn if trigger predicate was already popped 2022-01-25 07:57:01 -05:00
Tyler Goodlet b63ce088f2 Error out clearing task on first quote being nan 2022-01-25 07:57:01 -05:00
Tyler Goodlet 50e8b3464f Can't serialize a `set` on `msgpack` codec 2022-01-14 09:16:34 -05:00
Tyler Goodlet 6825ad4804 Add some type annots around pp msg handling 2021-11-05 10:05:11 -04:00
Tyler Goodlet de0cc6d81a Expect accounts as tuple, don't start rt pnl on no live pp 2021-11-05 10:05:11 -04:00
Tyler Goodlet c737de7c74 Rage drop the limit size unit enum 2021-11-05 10:05:11 -04:00
Tyler Goodlet 8f70398d88 Fix exit-slot-edge-case when only one discrete unit remains 2021-11-05 10:05:11 -04:00
Tyler Goodlet d706f35668 Keep slots ratio of 1 on derivs at startup 2021-11-05 10:05:11 -04:00
Tyler Goodlet f5d73edd1b Switch imports to new `tractor.trionics` subpkg 2021-11-01 13:22:23 -04:00
Tyler Goodlet fd8be33f10 Add portal getter, store throttle rate 2021-09-21 15:48:40 -04:00
Tyler Goodlet f4740da6a2 Drop `.accounts` field from allocator 2021-09-14 13:10:39 -04:00
Tyler Goodlet b04645aa47 Expect `accounts: set[str]` startup msg through clearing system 2021-09-14 10:36:13 -04:00
Tyler Goodlet c6cc592f4e Fix wrong key, use account value 2021-09-13 08:24:45 -04:00
Tyler Goodlet 6acfd6c38a Ugh, positions relay hotfix
Must have run into some confusion with data structures in `brokerd` vs.
`emsd`. This fixes the ems `relay.positions` state tracking to be
composed maps, vs. messages from `brokerd` should just be a sequence.
2021-09-12 19:30:43 -04:00
Tyler Goodlet f81d47efc4 Detail some comments 2021-09-11 13:10:20 -04:00
Tyler Goodlet c00cf12f94 Deliver ems cached pps are dict of lists 2021-09-10 18:54:34 -04:00
Tyler Goodlet 054ddf6732 Send error on non-paper account requests to paperboi 2021-09-10 18:54:04 -04:00
Tyler Goodlet e1efb0943b Track per-account pps in ems memory 2021-09-10 11:33:08 -04:00
Tyler Goodlet 15aba154f2 Return account name in next order info 2021-09-09 10:33:52 -04:00
Tyler Goodlet b01538f183 Support an account field in clearing system
Each backend broker may support multiple (types) of accounts; this patch
lets clients send order requests that pass through an `account` field in
certain `emsd` <-> `brokerd` transactions. This allows each provider to read
in and conduct logic based on what account value is passed via requests
to the `trades_dialogue()` endpoint as well as tie together positioning
updates with relevant account keys for display in UIs.

This also adds relay support for a `Status` msg with a `'broker_errored'`
status which for now will trigger the same logic as cancelled orders on
the client side and thus will remove order lines submitted on a chart.
2021-09-08 15:46:33 -04:00
Tyler Goodlet 504040eb59 Add an `account` field to EMS msging schemas 2021-09-08 14:03:18 -04:00
Tyler Goodlet 0d2cddec9a Return accounts in `bidict` 2021-09-08 14:01:54 -04:00
Tyler Goodlet 09d34f7355 Make `accounts` field public, add an account name method 2021-09-07 09:21:55 -04:00
Tyler Goodlet d38a6bf032 Create alloc instance in factory body, template out defaults loading 2021-09-07 08:38:24 -04:00
Tyler Goodlet 214c622328 Move allocator components to clearing sub-pkg 2021-09-06 22:05:42 -04:00
Tyler Goodlet 39d2cac3a6 Handle race with order-request-ack msg 2021-09-06 09:28:10 -04:00
Tyler Goodlet 87bd6046e5 Not sure how this worked before but, pass reqid from existing live order 2021-09-06 09:28:10 -04:00
Tyler Goodlet c1379001e5 Expect `Order` msg instance to ems client `.send()` 2021-09-06 09:28:10 -04:00
Tyler Goodlet 374967dc6f Support temp `Symbol` and non-copied model refs on `Order` msg 2021-09-06 09:28:10 -04:00
Tyler Goodlet a4028d3475 Actually position msgs get relayed verbatim 2021-09-06 09:28:10 -04:00
Tyler Goodlet bd754b740d Only re-calc avg pp price on pp size increases 2021-09-05 13:59:40 -04:00
Tyler Goodlet 449c4210e4 Add per session paper position tracking
Generate and maintain position messages in the paper engine for each
`pikerd` session. We no longer tear down the engine on each client
disconnect. Ensure -ve size on sells to make the math work.
2021-09-05 13:59:40 -04:00
Tyler Goodlet cae7f486e4 Revert "Lol, don't use `maybe_open_feed()` for now, it's totally borked..."
Think this was fixed by passing through `**kwargs` in
`maybe_open_feed()`, the shielding for fsp respawns wasn't being
properly passed through..

This reverts commit 2f1455d423.
2021-08-30 17:55:10 -04:00
Tyler Goodlet 2f1455d423 Lol, don't use `maybe_open_feed()` for now, it's totally borked... 2021-08-26 17:04:59 -04:00
Tyler Goodlet 71b50fdae8 Use broadcast chan for order client and avoid chan repacking 2021-08-26 17:04:59 -04:00
Tyler Goodlet 7d0f47364c Use `maybe_open_feed()` in ems and fsp daemons 2021-08-26 17:04:59 -04:00