Commit Graph

1381 Commits (6825ad4804e2cdad8333a5b5863e5940032c90b8)

Author SHA1 Message Date
Tyler Goodlet a1f605bd52 Clear out old commented code 2021-06-09 13:21:56 -04:00
Tyler Goodlet 8e8a005128 Fix attr accesses on msg type 2021-06-09 12:22:02 -04:00
Konstantine Tsafatinos 90e5a10a66 modify error string to format: <name>.<provider> 2021-06-09 12:02:05 -04:00
Tyler Goodlet 4cae470f3a Pass "arbiter" socket correctly 2021-06-08 15:57:01 -04:00
Tyler Goodlet 47e7baa0c9 Ensure paperboi is shield killed on teardown 2021-06-08 15:56:34 -04:00
Tyler Goodlet db92683ede Port ib orders to new msgs and bidir streaming api 2021-06-08 14:33:41 -04:00
Tyler Goodlet 6e58f31fd8 Port EMS to typed messaging + bidir streaming
This moves the entire clearing system to use typed messages using
`pydantic.BaseModel` such that the streamed request-response order
submission protocols can be explicitly viewed in terms of message
schema, flow, and sequencing. Using the explicit message formats we can
now dig into simplifying and normalizing across broker provider apis to
get the best uniformity and simplicity.

The order submission sequence is now fully async: an order request is
expected to be explicitly acked with a new message and if cancellation
is requested by the client before the ack arrives, the cancel message is
stashed and then later sent immediately on receipt of the order
submission's ack from the backend broker. Backend brokers are now
controlled using a 2-way request-response streaming dialogue which is
fully api agnostic of the clearing system's core processing; This
leverages the new bi-directional streaming apis from `tractor`.  The
clearing core (emsd) was also simplified by moving the paper engine to
it's own sub-actor and making it api-symmetric with expected `brokerd`
endpoints.

A couple of the ems status messages were changed/added:
'dark_executed' -> 'dark_triggered'
added 'alert_triggered'

More cleaning of old code to come!
2021-06-08 14:33:30 -04:00
Tyler Goodlet 0dabc6ad26 Port paper engine to new msgs and run in sub-actor
This makes the paper engine look IPC-wise exactly like any
broker-provider backend module and uses the new ``trades_dialogue()``
2-way streaming endpoint for commanding order requests.

This serves as a first step toward truly distributed forward testing
since the paper engine can now be run out-of tree from `pikerd` if
needed thus demonstrating how real-time clearing signals can be shared
between fully distinct services.
2021-06-08 14:32:03 -04:00
Tyler Goodlet 23094d8624 Spec out brokerd 2-way trade dialogue messages 2021-06-08 14:31:43 -04:00
Tyler Goodlet 02459cd964 Use new top level portal import 2021-06-08 14:31:14 -04:00
Tyler Goodlet 0bcad35c70 Set ack time on pydantic model 2021-06-08 14:31:04 -04:00
Tyler Goodlet f9238f3a8a Validate client message updates 2021-06-08 14:30:47 -04:00
Konstantine Tsafatinos 099bf260f5 fix unknown kraken symbol raised error 2021-06-01 18:01:45 -04:00
Tyler Goodlet f4c9e20f0d Avoid `numpy` type usage on the wire 2021-06-01 10:48:23 -04:00
Tyler Goodlet edf3af9777 Drop waits to half-seconds 2021-06-01 10:48:23 -04:00
Tyler Goodlet 9931accc52 Port clearing systems to new tractor context api
This avoids somewhat convoluted "hackery" making 2 one-way streams
between the order client and the EMS and instead uses the new
bi-directional streaming and context API from `tractor`. Add a router
type to the EMS that gets setup by the initial service tree and which
we'll eventually use to work toward multi-provider executions and
order-trigger monitoring. Move to py3.9 style where possible throughout.
2021-06-01 10:48:23 -04:00
Tyler Goodlet 7fb2c95ef1 Factor daemon spawning logic, use it to spawn emsd 2021-06-01 10:48:23 -04:00
Tyler Goodlet 9792b9aa7d Drop search pause config; use default 2021-05-28 14:11:02 -04:00
Tyler Goodlet 51a8308105 Lower connection timeout duration 2021-05-28 14:11:02 -04:00
Tyler Goodlet b689adaeb0 Throttle L1 label updates at a lower rate 2021-05-28 14:11:02 -04:00
Tyler Goodlet ff856a6ee3 Woops, make unsub pairs a list 2021-05-28 14:11:02 -04:00
Tyler Goodlet 19711bf024 Reconnect slow binance conns instead of error 2021-05-28 14:11:02 -04:00
Tyler Goodlet 1a7b06c147 Limit l1 graphics updates to half the refresh rate 2021-05-28 14:11:02 -04:00
Tyler Goodlet d0e3f5a51c Port binance and kraken to "reliable" ws API 2021-05-28 14:11:02 -04:00
Tyler Goodlet 89dc3dde61 Move no bs websocket api into its own data module 2021-05-28 14:11:02 -04:00
Tyler Goodlet ee71f445fb Clear entries on no results returned per task 2021-05-28 14:08:24 -04:00
Tyler Goodlet a31b83c5ca Don't ever send plain whitespace a search pattern 2021-05-28 13:44:30 -04:00
Tyler Goodlet ea3d96e7ed Accept arbitrary QEvent subscriptions via a set 2021-05-28 13:30:26 -04:00
Tyler Goodlet 7fa9f3f542 Add `Client.search_symbols()` to all backends, use it in `piker search` 2021-05-28 12:29:58 -04:00
Tyler Goodlet c56c7b8540 Increase min debounce period, stop searching on user nav selection 2021-05-28 10:16:00 -04:00
Tyler Goodlet 50aff72f8e Don't require map (yet) in backend modules 2021-05-27 13:05:23 -04:00
Tyler Goodlet ec6ea32dda Don't pass through linked charts x-axis handle 2021-05-27 13:05:23 -04:00
Tyler Goodlet e88e5b8ce2 Decrease binance search debounce period 2021-05-27 13:05:23 -04:00
Tyler Goodlet 3e39e9620c Add a no data available error 2021-05-27 13:05:23 -04:00
Tyler Goodlet 7dfc7f7fa2 Factor chart selection into widget, cleanups, add resource links 2021-05-27 13:05:23 -04:00
Tyler Goodlet ab3adcee9e Get basic switch-on-click mouse support working 2021-05-27 13:05:23 -04:00
Tyler Goodlet 607e1a8299 Add per-provider-async searching with status updates 2021-05-27 13:05:23 -04:00
Tyler Goodlet 89beb92866 Add api for per-section filling/clearing
Makes it so we can move toward separate provider results fills in an
async way, on demand.

Also,
- add depth 1 iteration helper method
- add section finder helper method
- fix last selection loading to be mostly consistent
2021-05-27 13:05:23 -04:00
Tyler Goodlet c478ddaed0 Disable cursor blink globally 2021-05-27 13:05:23 -04:00
Tyler Goodlet 924960a359 Add label to search bar 2021-05-27 13:05:23 -04:00
Tyler Goodlet 46d88965d3 Get LIFO sort on cache syms working properly 2021-05-27 13:05:23 -04:00
Tyler Goodlet 44f4fdf043 Type annot the internal symbol cache 2021-05-27 13:05:23 -04:00
Tyler Goodlet 59475cfd81 Store lowercase symbols within piker data internals 2021-05-27 13:05:23 -04:00
Tyler Goodlet af9dcf9230 Use an ordered dict to get LIFO cache sorting on sym selection 2021-05-27 13:05:23 -04:00
Tyler Goodlet 9bfc230dde Speedup: load provider searches async at startup 2021-05-27 13:05:23 -04:00
Tyler Goodlet c9cf72d554 Add remote context allocation api to service daemon
This allows for more deterministically managing long running sub-daemon
services under `pikerd` using the new context api from `tractor`.
The contexts are allocated in an async exit stack and torn down at root
daemon termination. Spawn brokerds using this method by changing the
persistence entry point to be a `@tractor.context`.
2021-05-27 13:05:23 -04:00
Tyler Goodlet 27d704b32e To avoid feed breakage, just give up on history after too many throttles for now 2021-05-27 13:05:23 -04:00
Tyler Goodlet 82cdb176e1 Make ctrl-l highlight current text in edit 2021-05-27 13:05:23 -04:00
Tyler Goodlet 0cd3cb3328 Drop old todo 2021-05-27 13:05:23 -04:00
Tyler Goodlet 212882a5a5 Don't try to show xhair if no active plot 2021-05-27 13:05:23 -04:00
Tyler Goodlet 307afb1935 Clean some key handling 2021-05-27 13:05:23 -04:00
Tyler Goodlet 67498c60af More UX features
- load previous search state on open
- show cached on empty search bar
- allow ctrl-u/d to navigate provider "sections"
2021-05-27 13:05:23 -04:00
Tyler Goodlet 8129fcc648 Ignore key auto-repeats 2021-05-27 13:05:23 -04:00
Tyler Goodlet a4627c2b04 Send blank packet on no match to avoid blocking search stream 2021-05-27 13:05:23 -04:00
Tyler Goodlet 07d8bf1453 Add a `.select_first()` view method + more cleaning 2021-05-27 13:05:23 -04:00
Tyler Goodlet d5e83e61d4 Reorder, drop some cruft 2021-05-27 13:05:23 -04:00
Tyler Goodlet 9d2c8a9526 Factor selection details into completer view methods 2021-05-27 13:05:23 -04:00
Tyler Goodlet 43d73b4a7c Info log the current provider search 2021-05-27 13:05:23 -04:00
Tyler Goodlet ddc2c8975a Ignore whitespace patterns in ib search 2021-05-27 13:05:23 -04:00
Tyler Goodlet 64c1d9a965 Support ctrl-space to open search pane 2021-05-27 13:05:23 -04:00
Tyler Goodlet d8a200aadc Increase completion-tree width, support ctrl-space toggle 2021-05-27 13:05:23 -04:00
Tyler Goodlet 2471ce446e Require `<symbol>.<provider>` format to cli 2021-05-27 13:05:23 -04:00
Tyler Goodlet c9311dd7d0 Few more derivs symbols 2021-05-27 13:05:23 -04:00
Tyler Goodlet 6f3b799960 Skip ib exchanges we haven't tested yet 2021-05-27 13:05:23 -04:00
Tyler Goodlet 42fda2a9e6 Drop old code 2021-05-27 13:05:23 -04:00
Tyler Goodlet e77a51f16e Support multi-provider cache symbol switching 2021-05-27 13:05:23 -04:00
Tyler Goodlet 1bd0ee8746 Support loading multi-brokerds search at startup 2021-05-27 13:05:23 -04:00
Tyler Goodlet fd8dc4f1a3 Make -b a multi-option for backends 2021-05-27 13:05:23 -04:00
Tyler Goodlet 59377da0ad Load pause configs from backends on feed opens 2021-05-27 13:05:23 -04:00
Tyler Goodlet bbd5883e52 Add search pause configs to backends 2021-05-27 13:05:23 -04:00
Tyler Goodlet b2ff09f193 Support min and max keyboard pauses
Some providers do well with a "longer" debounce period (like ib) since
searching them too frequently causes latency and stalls.  By supporting
both a min and max debounce period on keyboard input we can only send
patterns to the slower engines when that period is triggered via
`trio.move_on_after()` and continue to relay to faster engines when the
measured period permits. Allow search routines to register their "min
period" such that they can choose to ignore patterns that arrive before
their heuristically known ideal wait.
2021-05-27 13:05:23 -04:00
Tyler Goodlet 63363d750c Port chart to multi-search api 2021-05-27 13:05:23 -04:00
Tyler Goodlet cb102f692c Top level widget `.focus()` 2021-05-27 13:05:23 -04:00
Tyler Goodlet c9c686c98d Register context-stream with multi-search for each feed 2021-05-27 13:05:23 -04:00
Tyler Goodlet 0163a582a5 Move search machinery to ui module, add fast cached chart selection 2021-05-27 13:05:23 -04:00
Tyler Goodlet 82ece83d33 Drop commented cruft 2021-05-27 13:05:23 -04:00
Tyler Goodlet b39fd5e1fc Use per-provider indented tree layout for results 2021-05-27 13:05:23 -04:00
Tyler Goodlet 25dbe60c77 Flip to ctrl-l to pop out search/list 2021-05-27 13:05:23 -04:00
Tyler Goodlet 51c61587d2 Make list pop out next to primary y-axis 2021-05-27 13:05:23 -04:00
Tyler Goodlet 2c24c9ef2d Compose search bar and view under parent widget 2021-05-27 13:05:23 -04:00
Tyler Goodlet f19f4348e0 Decouple symbol search from feed type 2021-05-27 13:05:22 -04:00
Tyler Goodlet e5e9a7c582 Add symbol searching for ib backend
Obviously this only supports stocks to start, it looks like we might
actually have to hard code some of the futures/forex/cmdtys that don't
have a search.. so lame. Special throttling is added here since the api
will grog out at anything more then 1Hz.

Additionally, decouple the bar loading request error handling from the
shm pushing loop so that we can always recover from a historical bars
throttle-error even if it's on the first try for a new symbol.
2021-05-27 13:05:22 -04:00
Tyler Goodlet 25d7122cb6 Throttle requests using a static "typing paused period" 2021-05-27 13:05:22 -04:00
Tyler Goodlet ef1b0911f3 Add symbol search to ib 2021-05-27 13:05:22 -04:00
Tyler Goodlet 82a8e0a7b6 Accept lower case sym requests in kraken backend 2021-05-27 13:05:22 -04:00
Tyler Goodlet 5766dd518d Enforce lower case symbols across providers 2021-05-27 13:05:22 -04:00
Tyler Goodlet 478b114708 First draft completion in background task 2021-05-27 13:05:22 -04:00
Tyler Goodlet c9efbcc6d2 Drop completion list from startup 2021-05-27 13:05:22 -04:00
Tyler Goodlet 431fdd3f9c Add initial working symbol search with async completions 2021-05-27 13:05:22 -04:00
Tyler Goodlet ad494db213 Make search routine a tractor context 2021-05-27 13:05:22 -04:00
Tyler Goodlet a5826e6e22 Up the kb event queue size 2021-05-27 13:05:22 -04:00
Tyler Goodlet 534553a6f5 Add client side multi-provider feed symbol search 2021-05-27 13:05:22 -04:00
Tyler Goodlet 4b818ea2f2 Add initial symbol search api for kraken 2021-05-27 13:05:22 -04:00
Tyler Goodlet be39e9bdf5 Load async kb search handler at startup 2021-05-27 13:05:22 -04:00
Tyler Goodlet 60d44f30ee Make search kb handling async 2021-05-27 13:05:22 -04:00
Tyler Goodlet 2861f321ce Add async keyboard cloner sub-sys 2021-05-27 13:05:22 -04:00
Tyler Goodlet 5e1b15f319 Repair indents from rebasing 2021-05-27 13:05:22 -04:00
Tyler Goodlet 821d5ab9ec Bring back in and merge tractor stream api patch 2021-05-27 13:05:22 -04:00
Tyler Goodlet da0cb9b2ac Call search focus directly 2021-05-27 13:05:22 -04:00
Tyler Goodlet 0e83906f11 Initial WIP search completer; still a mess 2021-05-27 13:05:22 -04:00
Tyler Goodlet c26f4d9877 Add kraken fuzzy symbol search 2021-05-27 13:05:22 -04:00
Tyler Goodlet 157f6ab02b Drop lingering chart focus call 2021-05-27 13:05:22 -04:00
Tyler Goodlet 1f9f2b873a Super fast switching, just hide loaded charts 2021-05-27 13:05:22 -04:00
Tyler Goodlet 0627f7dcee First draft: symbol switching via QLineEdit widget 2021-05-27 13:05:22 -04:00
Tyler Goodlet 27aed85404 Handle no matching symbols case 2021-05-27 13:05:22 -04:00
Tyler Goodlet 9cad59366f Extract min tick info from symbol data 2021-05-25 08:46:10 -04:00
Tyler Goodlet 165d6257fa Get symbol search working for binance 2021-05-25 08:46:04 -04:00
goodboy 9c821c8cfd
Merge pull request #181 from pikers/syseng_tweaks
Syseng tweaks
2021-05-25 08:39:06 -04:00
Tyler Goodlet 9e367432fd Minimize update to Qt reported display's refresh rate 2021-05-25 06:56:18 -04:00
Tyler Goodlet e623c58754 Naively throttle graphics updates to 60 FPS 2021-05-25 06:33:22 -04:00
Tyler Goodlet f51e12819a Attach to order client *after* feed connection to speed up the startup time 2021-05-24 12:27:23 -04:00
Tyler Goodlet 319eacd8c1 Use compact async with tuple syntax from py3.9 2021-05-24 12:26:50 -04:00
Tyler Goodlet efd93d058a Breakout fsp rt loop as non-closure for readability 2021-05-24 12:26:44 -04:00
Tyler Goodlet f6f4a0cd8d Use tractor settings for qtractor 2021-05-24 12:26:34 -04:00
Tyler Goodlet 74b4b4b130 Expose registry port as dict 2021-05-24 12:26:28 -04:00
Tyler Goodlet dcc60524cb Add remote context allocation api to service daemon
This allows for more deterministically managing long running sub-daemon
services under `pikerd` using the new context api from `tractor`.
The contexts are allocated in an async exit stack and torn down at root
daemon termination. Spawn brokerds using this method by changing the
persistence entry point to be a `@tractor.context`.
2021-05-24 12:26:11 -04:00
Tyler Goodlet 435e005d6e Drop quantdum legend item 2021-05-24 12:23:02 -04:00
Tyler Goodlet 0b36bacfb6 Avoid weird `pydantic` runtime warning 2021-05-24 12:22:17 -04:00
Tyler Goodlet 2635ade908 Reminder to remove msgpack-numpy 2021-05-24 12:20:48 -04:00
Tyler Goodlet 9b59471dc1 Pass debug flag down to any daemons 2021-05-24 12:20:20 -04:00
Tyler Goodlet 6e70bc4fa7 New tractor non-default port 2021-05-24 12:19:38 -04:00
Tyler Goodlet 4d03d62641 Don't submit limits on alerts 2021-05-24 12:17:16 -04:00
Tyler Goodlet ecd94ce24d Better indexing logic? 2021-05-24 12:17:08 -04:00
Tyler Goodlet 7b8c482719 Add reconnect logic help link 2021-05-24 12:16:49 -04:00
Tyler Goodlet 9c3f8ff050 Only do context unsubs in main feed bus path 2021-05-24 12:16:26 -04:00
Tyler Goodlet a7cee86fea Just de-lint imports 2021-05-24 12:16:15 -04:00
goodboy 372b0dbace
Merge pull request #170 from guilledk/binance_backend
Add Binance backend
2021-05-24 10:54:55 -04:00
Tyler Goodlet b6d8c300d4 Slap in brokers.toml template if none exists 2021-05-22 15:11:39 -04:00
Guillermo Rodriguez a0dfdd935f
Post @goodboy review commit 2021-05-21 22:23:35 -03:00
Tyler Goodlet 7b26bd45e2 Get binance OHLC history and quote format correct
This gets the binance provider meeting the data feed schema requirements
of both the OHLC sampling/charting machinery as well as proper
formatting of historical OHLC history.

Notably,
- spec a minimal ohlc dtype based on the kline endpoint
- use a dataclass to parse out OHLC bar datums and pack into np.ndarray/shm
- add the ``aggTrade`` endpoint to get last clearing (traded) prices,
  validate with ``pydantic`` and then normalize these into our tick-quote
  format for delivery over the feed stream api.
- a notable requirement is that the "first" quote from the feed must
  contain a 'last` field so the clearing system can start up correctly.
2021-05-21 15:35:36 -04:00
Tyler Goodlet 2ef5a52521 Fix broken import in ib backend 2021-05-20 19:34:45 -04:00
Guillermo Rodriguez 432bd96474
Added missing toml dependency to setup.py
Pinned qdarkstyle to 2.8.1
Updated arrow timestamp api used in kraken backend
2021-05-16 18:53:54 -03:00
Guillermo Rodriguez 604e195bc0
Got rid of websocket OHLC API, and added l1 tick streaming 2021-05-07 10:59:08 -03:00
Guillermo Rodriguez 7e493625f6
Finally backfilling is working, still need to work on realtime updates! 2021-05-05 10:17:52 -03:00
Guillermo Rodriguez d327584039
Rough translation of kraken backend to binance API, still missing some
important parts
2021-05-04 22:52:53 -03:00
Tyler Goodlet c08f192f77 Move charting to new tractor stream api
This required a fsp task spawning logic rework which ended up being
cleaner just spawning tasks in a loop sequentially instead of trying
a 2-phase spawn-then-initialize approach.

This also includes changes from the symbol search branch hacked in.
Mostly it includes isolating the main chart startup-sequence to a
function that can be run in a new task every time a new symbol is
requested by the selector/searcher. The actual search functionality
obviously isn't in here yet but minor changes are included as part of
pulling out the `tractor` stream api patch from the symbol search dev
branch.
2021-04-29 11:28:00 -04:00
Tyler Goodlet d3b50b9920 Port clearing engine to new tractor stream api 2021-04-29 09:10:36 -04:00
Tyler Goodlet 56db2c812d Port fsp engine to new tractor stream api 2021-04-29 09:10:28 -04:00
Tyler Goodlet 0d9f091a34 Port data feed to new tractor stream api 2021-04-29 09:10:18 -04:00
Tyler Goodlet 3375735914 Port kivy monitor to new tractor stream api 2021-04-29 09:10:11 -04:00
Tyler Goodlet 8a140b5ae8 Pass loglevel as named arg to pikerd 2021-04-15 11:20:30 -04:00
Tyler Goodlet 7d6bc4d856 Move feed api(s) into new submodule
Also add a --pdb flag to chart app.
2021-04-15 10:43:29 -04:00
Tyler Goodlet 0b10c8d6d6 Make standalone mode work again 2021-04-15 08:23:08 -04:00
Tyler Goodlet feeabb3d28 Add --pdb flag to pikerd to enable service debug mode 2021-04-14 12:57:46 -04:00
Tyler Goodlet 7f580ad356 Pass through kwargs 2021-04-14 12:56:08 -04:00
Tyler Goodlet 9622254cdb Hack broadcast chan for order submissions, smh 2021-04-14 11:02:14 -04:00
Tyler Goodlet 4774881812 Handle predicate not yet inserted to exec loop 2021-04-10 14:34:29 -04:00
Tyler Goodlet 9a15cd48f0 Just symbol info in window title 2021-04-10 14:18:40 -04:00
Tyler Goodlet 598aec579f Avoid token checking type mismatches 2021-04-10 14:18:40 -04:00
Tyler Goodlet fa7fadebac Report sym on unexpected open 2021-04-10 14:18:40 -04:00
Tyler Goodlet 3147a49384 Move sample-broadcast routine into sampling module 2021-04-10 14:18:40 -04:00
Tyler Goodlet 71d02db126 Rename "buffer" to "sampling" 2021-04-10 14:18:40 -04:00
Tyler Goodlet 1523637979 Always update L1 labels 2021-04-10 14:18:40 -04:00
Tyler Goodlet 3506bbe05c Nest async withs 2021-04-10 14:18:40 -04:00
Tyler Goodlet a18a4b5a4c Call the app what it is 2021-04-10 14:18:40 -04:00
Tyler Goodlet 20c99733b6 Let cli pass through actor name 2021-04-10 14:18:40 -04:00
Tyler Goodlet 47f823ab22 Always close emsd data connection on close 2021-04-10 14:18:40 -04:00
Tyler Goodlet 1281755d65 Don't use mem chan cloning, it doesn't actually broadcast 2021-04-10 14:18:40 -04:00
Tyler Goodlet ddae08493b Manage the send mem chan lifetime 2021-04-10 14:18:40 -04:00
Tyler Goodlet 28a961ebc0 Add a maybe-startup-runtime manager 2021-04-10 14:18:40 -04:00
Tyler Goodlet 100e27ac12 Task lock bus loading, always close feed stream on disconnect 2021-04-10 14:18:40 -04:00
Tyler Goodlet 8069bbe105 Drop old incrementer func 2021-04-10 14:18:40 -04:00
Tyler Goodlet ce4144aace Deliver and utilise broker backend OHLC sample rate in init msg 2021-04-10 14:18:40 -04:00
Tyler Goodlet c05fc8991a Rework ohlc sampling to launch from .start()
Avoid bothering with a trio event and expect the caller to do manual shm
registering with the write loop. Provide OHLC sample period indexing
through a re-branded pub-sub func ``iter_ohlc_periods()``.
2021-04-10 14:18:40 -04:00
Tyler Goodlet a8a3f098cf Drop lingering prints 2021-04-10 14:18:40 -04:00
Tyler Goodlet 5a970dad72 Port kraken backend to new data feed api 2021-04-10 14:18:40 -04:00
Tyler Goodlet 29b73b41fb Slight rename; fix predicate is None bug 2021-04-10 14:18:40 -04:00
Tyler Goodlet 24bda8636e Port quest to new client api 2021-04-10 14:18:40 -04:00
Tyler Goodlet 30dabbab44 Support backend volume summing; handle disconnects 2021-04-10 14:18:40 -04:00
Tyler Goodlet 1d013126b9 Fix type annot 2021-04-10 14:18:40 -04:00
Tyler Goodlet b2eacb85d4 Don't hold lock on initial client construction 2021-04-10 14:18:40 -04:00
Tyler Goodlet 3ebb7ab6b1 Only activate Qt hidpi detection on windows for now 2021-04-10 14:18:40 -04:00
Tyler Goodlet 4f51ca74f4 Broadcast all tick types to subs, not just trades 2021-04-10 14:18:40 -04:00
Tyler Goodlet 5fc2aba3ed Drop some more old cruft 2021-04-10 14:18:40 -04:00
Tyler Goodlet 8ccf987d52 Fix typo 2021-04-10 14:18:40 -04:00
Tyler Goodlet 7cc395b5bf Open data feed in ems main entrypoint 2021-04-10 14:18:40 -04:00
Tyler Goodlet 14c5fc24ec Port to new setup routine name 2021-04-10 14:18:40 -04:00
Tyler Goodlet a82f43e3a5 Rework data feed API to allow for caching streams
Move all feed/stream agnostic logic and shared mem writing into a new
set of routines inside the ``data`` sub-package. This lets us move
toward a more standard API for broker and data backends to provide
cache-able persistent streams to client apps.

The data layer now takes care of
- starting a single background brokerd task to start a stream for as
  symbol if none yet exists and register that stream for later lookups
- the existing broker backend actor is now always re-used if possible
  if it can be found in a service tree
- synchronization with the brokerd stream's startup sequence is now
  oriented around fast startup concurrency such that client code gets
  a handle to historical data and quote schema as fast as possible
- historical data loading is delegated to the backend more formally by
  starting a ``backfill_bars()`` task
- write shared mem in the brokerd task and only destruct it once requested
  either from the parent actor or further clients
- fully de-duplicate stream data by using a dynamic pub-sub strategy
  where new clients register for copies of the same quote set per symbol

This new API is entirely working with the IB backend; others will need
to be ported. That's to come shortly.
2021-04-10 14:18:40 -04:00
Tyler Goodlet f17a26c948 Don't mistakenly alias options to underlyingn for positions 2021-04-10 14:18:40 -04:00
Tyler Goodlet 65e7680cdd Draft a feed cacheing sub-system 2021-04-10 14:18:40 -04:00
Tyler Goodlet 0d4073dbd2 Move quote stream setup into a cacheing func 2021-04-10 14:18:40 -04:00
Tyler Goodlet aa61bf5a65 Use mem-chans for quote streams; clone for multiple consumers 2021-04-10 14:18:40 -04:00
Tyler Goodlet 17d3e7a9e2 Don't shield ems feed; enact remote cancels 2021-04-10 14:18:40 -04:00
goodboy feb8d5bbad
Merge pull request #153 from wattygetlood/windows_patches
Windows patches
2021-04-06 11:55:51 -04:00
Tyler Goodlet 549f81e85d Fix lints 2021-04-03 12:29:56 -04:00
Tyler Goodlet 2b7cecc78e Drop upcoming cached feed usage 2021-04-03 12:22:14 -04:00
Tyler Goodlet 6891309abd Fix import 2021-04-03 12:22:14 -04:00
Tyler Goodlet b1a1b32315 Better tractor startup, runtime detection 2021-04-03 12:22:14 -04:00
Tyler Goodlet 877db52162 Add license header 2021-04-03 12:22:14 -04:00
Tyler Goodlet 2a51582ec0 Start forming an services api
Add a `Services` nurseries container singleton for spawning sub-daemons
inside the long running `pikerd` tree. Bring in `brokerd` spawning util
funcs to start getting eyes on what can be factored into a service api.
2021-04-03 12:22:14 -04:00
Tyler Goodlet 38471b7b34 Use early return instead of branching for remote emsd spawning 2021-04-03 12:22:14 -04:00
Tyler Goodlet fb996bfffb Change subpkg name in cli 2021-04-03 12:22:14 -04:00
Tyler Goodlet 20a9617c18 Use open pikerd from chart entrypoint 2021-04-03 12:22:14 -04:00
Tyler Goodlet 4ab8545e87 Return early on remote actor lookups instead of branching 2021-04-03 12:22:14 -04:00
Tyler Goodlet 8ce37875a0 Use pikerd to spawn emsd 2021-04-03 12:22:14 -04:00
Tyler Goodlet 1931da97f4 Fix spawn attr typo, merge tractor kwargs 2021-04-03 12:22:14 -04:00
Tyler Goodlet 7ca05238af Port pikerd entry to drop `tractor.run()` 2021-04-03 12:22:14 -04:00
Tyler Goodlet 79d37646a2 Add `open_pikerd()` and `spawn_emsd()`
The direct open is needed for running `pikerd` cmd and
the ems spawn point is the first step toward detaching UI based order
entry from the engine itself.
2021-04-03 12:22:14 -04:00
Tyler Goodlet 8812aff3b8 Fix import 2021-04-03 12:22:14 -04:00
Tyler Goodlet 26ee7260d6 Clearing is a better name 2021-04-03 12:22:14 -04:00
Tyler Goodlet 2b9ac8d8ec Port daemon(s) to new clearing system apis 2021-04-03 12:22:14 -04:00
Guillermo Rodriguez 189c56c012 Add piker root daemon spawning machinery
Refactor maybe_spawn_brokerd to adapt to new process tree structure
and add a ``maybe_open_pikerd``.
2021-04-03 12:22:14 -04:00
Tyler Goodlet d4395dbcbc Make default view more zooomed in 2021-03-31 14:26:32 -04:00
Tyler Goodlet f75b3108ce Size execution arrows to dpi 2021-03-31 14:26:13 -04:00
Tyler Goodlet 0dfa92230d Size level line markers to dpi aware font size 2021-03-31 14:25:51 -04:00
Tyler Goodlet 54d36f26f0 Base anchor contents labels based on dpi-aware font bounding rect 2021-03-31 14:25:17 -04:00
Tyler Goodlet 3f7d9c5c15 Base axis text offset on dpi-aware font size 2021-03-31 14:24:39 -04:00
Tyler Goodlet 3bd87caf4b Hip shot: try making low dpi font sizes "just work" 2021-03-29 17:52:32 -04:00
wattygetlood c39c4f11db Forcinng trio spawner seems to work? 2021-03-28 17:24:30 -04:00
wattygetlood 583cafc947 Avoid loading posix unlinker, use shm bytes size 2021-03-28 17:23:59 -04:00
Tyler Goodlet 07a5bf4b7c Use low dpi inches on 96 dpi 2021-03-19 09:33:47 -04:00
Tyler Goodlet 77fbde1115 Override the inverse transform func from pg 2021-03-19 00:40:39 -04:00
Tyler Goodlet 6fa1d4dc88 Show xhair even if order is filled while line is hovered 2021-03-18 21:57:08 -04:00
Tyler Goodlet 5610807b8e Move marker factory funcs to new mod 2021-03-18 16:59:22 -04:00
Tyler Goodlet 55de079320 Add low dpi settings and different default view bars counts 2021-03-18 13:40:31 -04:00
Tyler Goodlet 67c5563090 Enable marker-on-select through order mode 2021-03-18 13:33:10 -04:00
Tyler Goodlet 68f75b582a More fixes for kivy shit 2021-03-18 13:32:34 -04:00
Tyler Goodlet cd5da45abf Show order line marker on hover 2021-03-18 13:28:28 -04:00
Tyler Goodlet 2c7d8cdbb0 Support hiding only "half" the xhair 2021-03-18 13:27:49 -04:00
Tyler Goodlet e1dc2b9225 Enable daemon debug through top level kwarg 2021-03-17 08:36:34 -04:00
Tyler Goodlet aaca2b2f33 Tweak L1 labels to have more spaces 2021-03-17 08:26:28 -04:00
Tyler Goodlet 17b66e685f Experiment with zoom focal @ L1 edge 2021-03-17 08:25:58 -04:00
Tyler Goodlet d1c8c2a072 More level line reworking
- break (custom) graphics item style marker drawing into separate func
 but keep using it since it still seems oddly faster then the
 QGraphicsPathItem thing..
- unfactor hover handler; it was uncessary
- make both the graphics path item and custom graphics items approaches
  both work inside ``.paint()``
2021-03-16 19:36:05 -04:00
Tyler Goodlet adf6437449 Move margin settings to class scope 2021-03-16 15:59:44 -04:00
Tyler Goodlet 61198818dc Fix label snap on line highlight bug 2021-03-14 12:28:11 -04:00
Tyler Goodlet cf2f001bcc Add save last datum toggle to y-label 2021-03-13 21:06:53 -05:00
Tyler Goodlet 776395791a Pass action to line editor 2021-03-13 19:31:22 -05:00
Tyler Goodlet c75dacb239 Support func ops on field data, extend anchor logics 2021-03-13 19:29:52 -05:00
Tyler Goodlet c71a3e0fc5 Level line look and feel rework
Add support for drawing ``QPathGraphicsItem`` markers but don't use them
since they seem to be shitting up when combined with the infinite line
(bounding rect?): weird artifacts and whatnot. The only way to avoid
said glitches seems to be to update inside the infinite line's
`.paint()` but that slows stuff down.. Instead stick with the manual
paint job use the same pin point: left of the L1 spread graphics - where
the lines now also extend to.

Further stuff:
- Pin the y-label to a line's value on hover.
- Disable x-dimension line moving
- Rework the labelling to be more minimal
2021-03-13 17:31:15 -05:00
Tyler Goodlet 887c305d46 Allow y-label pinning on cross hair hide 2021-03-13 17:29:35 -05:00
Tyler Goodlet 9798689961 Lengthen label arrow a tad 2021-03-13 17:28:57 -05:00
Tyler Goodlet f6dbdfab84 Don't crash on unknown orders execing 2021-03-13 17:28:22 -05:00
Tyler Goodlet 396f6b2a0d Fix type annot 2021-03-12 07:41:47 -05:00
Tyler Goodlet 18ab81a967 Make crosshair lines a milder gray 2021-03-11 21:44:35 -05:00
Tyler Goodlet 624617d8e1 Don't run brokerds in debug mode by default 2021-03-11 21:44:10 -05:00
Tyler Goodlet d016abcd0d Adjust right axis anchor closure to include l1 label size 2021-03-11 21:43:29 -05:00
Tyler Goodlet 4a1df686a5 Update max l1 label size on chart 2021-03-11 21:42:38 -05:00
Tyler Goodlet a51d5c536e Add a couple more grays 2021-03-11 21:41:13 -05:00
Tyler Goodlet 31c14a2f9f Add l1 label size tracking to chart widget 2021-03-11 21:40:50 -05:00
Tyler Goodlet ea8120156f Add position line updating to order mode 2021-03-11 21:40:06 -05:00
Tyler Goodlet e91e7bea1f Add position event support to ems 2021-03-11 21:38:59 -05:00
Tyler Goodlet 6265ae8057 Add position event relay to ib broker backend 2021-03-11 21:38:31 -05:00
Tyler Goodlet 98bfee028a Add a position line api
Add a line which shows the current average price position with and arrow
marker denoting the direction (long or short). Required some further
rewriting of the infinite line from pyqtgraph including:
- adjusting marker (arrow) placement to be offset from axis + l1 labels
- fixing the hover event to not require the `.movable` attribute to be
  set
2021-03-11 21:35:09 -05:00
Tyler Goodlet 7075a968b4 Create an order mode module 2021-03-08 09:05:37 -05:00
Tyler Goodlet 7e214180a6 Remove old simulated order price on update 2021-03-07 22:17:19 -05:00
Tyler Goodlet fff9efe4aa Snap level line movements to tick size 2021-03-07 22:16:46 -05:00
Tyler Goodlet d58a82bd38 Factor and simplify paper clearing logic 2021-03-07 16:41:14 -05:00
Tyler Goodlet 5deea50963 Factor order request processing into new func 2021-03-07 16:25:47 -05:00
Tyler Goodlet e71bcb363c Drop stage line cacheing; the complexity isn't worth it. 2021-03-07 16:07:23 -05:00
Tyler Goodlet de5a69c59c Add mouse drag order update support to UI 2021-03-07 16:01:42 -05:00
Tyler Goodlet 6851bacd0a Add drag start/end callback support, remove from cursor hovered on delete 2021-03-07 15:50:50 -05:00
Tyler Goodlet 0ade7daebc Support simulated live order modification in paper engine 2021-03-07 13:34:03 -05:00
Tyler Goodlet 919ecab732 Support order modification in ems request loop 2021-03-07 13:12:39 -05:00
Tyler Goodlet a43ab1b983 Add order update method to client 2021-03-07 10:56:09 -05:00
Tyler Goodlet 2cabe1831c Attempt to handle existing order updates with ib backend 2021-03-06 16:33:56 -05:00
Tyler Goodlet a1a1dec885 Move L1 labels into lone module 2021-03-01 14:48:08 -05:00
Tyler Goodlet 8997b6029b Drop cruft 2021-03-01 12:02:07 -05:00
Tyler Goodlet 72c4a4366b Tag TWS trade events 2021-03-01 12:01:48 -05:00
Tyler Goodlet a1691cf1c5 Keep to one EMS daemon if possible 2021-03-01 11:28:44 -05:00
Tyler Goodlet 327129db37 Drop paper limit submissions for alerts 2021-02-25 18:44:40 -05:00
Tyler Goodlet 9f9b5480a6 More explicit private var name 2021-02-24 12:05:09 -05:00
Tyler Goodlet 948e133cae Split out ems daemon, client api and paper engine into new mods 2021-02-22 18:37:57 -05:00
Tyler Goodlet a9bbc223bb Add a new exchange subpackage 2021-02-22 17:28:34 -05:00
Tyler Goodlet 1142a538ea Don't forward errors without an order id 2021-02-22 10:45:01 -05:00
Tyler Goodlet e6ea053d40 Get kivy/questrade shit working again 2021-02-21 12:32:40 -05:00
Tyler Goodlet f724798336 Fix incorrect bounding rect calc 2021-02-21 12:02:20 -05:00
Tyler Goodlet 4b0e5662a5 Add default order lot sizes by asset type 2021-02-21 12:01:48 -05:00
Tyler Goodlet 6fb1945360 Fix and pass through piker loglevel correctly 2021-02-21 11:50:33 -05:00
Tyler Goodlet aa4a2ef64f Bump up font size one more time 2021-02-21 11:49:27 -05:00
Tyler Goodlet c2890b8197 Port level line to xhair methods 2021-02-21 11:48:51 -05:00
Tyler Goodlet d5b41e12c5 Add crosshair hide/show convenience methods 2021-02-21 11:45:24 -05:00
Tyler Goodlet 71745ddcd4 Even smaller text fill on axes 2021-02-21 11:44:58 -05:00
Tyler Goodlet 8c757d0bdd Accept a symbol type key from broker 2021-02-21 11:42:19 -05:00
Tyler Goodlet 38b2e99002 Fill clearable prices asap 2021-02-20 16:43:33 -05:00
Tyler Goodlet d8b157d209 First draft paper trading engine!
It's a super naive implementation with no slippage model or network
latency besides some slight delays. Clearing only happens on bid/ask
sweep ticks at the moment - simple last volume based clearing coming
up next.
2021-02-20 15:25:53 -05:00
Tyler Goodlet ead2f77d40 Add a symbol/asset type key 2021-02-19 18:43:56 -05:00
Tyler Goodlet add63734f1 Add an auto-reconnect websocket API 2021-02-19 18:42:50 -05:00
Tyler Goodlet bbd54e8f95 Report asset types, tick sizes, and order actions from ib 2021-02-19 17:23:37 -05:00
Tyler Goodlet 1ac4cc3dd3 Use new field label api for L1 2021-02-16 06:42:48 -05:00
Tyler Goodlet 880bdcffa7 Document order status list from ib 2021-02-12 09:07:49 -05:00
Tyler Goodlet b794855ad3 Port order mode to new order line api 2021-02-11 23:42:57 -05:00
Tyler Goodlet d91f07c947 Drop old candlestick graphics code 2021-02-11 23:42:17 -05:00
Tyler Goodlet aec8f1d25c Hide y-label on level line mouse over 2021-02-11 23:41:40 -05:00
Tyler Goodlet bf78c13df4 Attempt px perfection on crosshair lines placement 2021-02-11 14:03:47 -05:00
Tyler Goodlet f51e503e47 Support arbitrary fields (with update) in labels
This turned into a larger endeavour then intended but now we're using our
own label system on level lines to be able to display things nicely
**pinned wherever we want in the UI**. Keep the old ``LevelLabel`` for
now for the L1 graphics but we'll likely replace this as well since i'm
pretty sure the new label type (which wraps `QGraphicsTextItem`) is more
performant anyway.
2021-02-11 13:59:50 -05:00
Tyler Goodlet cbf259f3f3 Add hidpi issue regarding it being borky 2021-02-11 11:49:33 -05:00
Tyler Goodlet ca576ca3cf Add label delete method 2021-02-11 11:49:01 -05:00
Tyler Goodlet 0edca84b3d Yet another font size tweak 2021-02-11 11:48:40 -05:00
Tyler Goodlet dd1aed627e Tidy axis code 2021-02-11 11:48:19 -05:00
Tyler Goodlet 02edfdf846 Pass order size to ems 2021-02-11 11:47:34 -05:00
Tyler Goodlet 21e1561a57 Add a sane label type..smh 2021-02-11 00:12:37 -05:00
Tyler Goodlet 386cd9404d Drop hidpi detection? it doesn't seem to yield benefits 2021-02-08 07:07:04 -05:00
Tyler Goodlet ac84087755 Fix stage line updating, size up arrow heads? 2021-02-08 07:06:00 -05:00
Tyler Goodlet 0449734c53 Drop YSticky for level lines stuff 2021-02-08 07:04:08 -05:00
Tyler Goodlet 1ef2d18a41 Try to make crosshair lines px perfect 2021-02-08 07:03:28 -05:00
Tyler Goodlet 708ed89894 Hard code font inches 2021-02-08 07:01:26 -05:00
Tyler Goodlet 890f932400 Use through lot digits, drop YSticky 2021-02-08 07:00:51 -05:00
Tyler Goodlet bf66eb0b3d Support lot tick size (mostly for crypto) 2021-02-08 06:42:59 -05:00
Tyler Goodlet d7f806c57b Add arrowheads to labels
For labels that want it add nice arrow paths that point just over the
respective axis. Couple label text offset from the axis line based on
parent 'tickTextOffset' setting. Drop `YSticky` it was not enough
meat to bother with.
2021-02-08 06:40:11 -05:00
Tyler Goodlet c3fa31e731 Convert symbol type to use pydantic 2021-02-06 14:38:25 -05:00
Tyler Goodlet 0c184b1b41 Port ib to new provide new tick size fields in symbol info 2021-02-06 14:37:24 -05:00
Tyler Goodlet 69df73afc3 Deliver symbol info from kraken; start using pydantic 2021-02-06 14:23:27 -05:00
Tyler Goodlet a8c4829cb6 Start using `tick_size` throughout charting
The min tick size is the smallest step an instrument can move in value
(think the number of decimals places of precision the value can have).

We start leveraging this in a few places:
- make our internal "symbol" type expose it as part of it's api
  so that it can be passed around by UI components
- in y-axis view box scaling, use it to keep the bid/ask spread (L1 UI)
  always on screen even in the case where the spread has moved further
  out of view then the last clearing price
- allows the EMS to determine dark order live order submission offsets
2021-02-06 11:35:12 -05:00
Tyler Goodlet 03541bd368 Drop unneeded .hide(); add more comments 2021-01-26 22:16:18 -05:00
Tyler Goodlet cfc36e7928 Snap y-cursor-label to min tick 2021-01-26 22:15:45 -05:00
Tyler Goodlet 708086cbcb Convert contractsto dicts on errors 2021-01-26 13:34:49 -05:00
Tyler Goodlet 5a0612e6a8 Factor some line and label steps 2021-01-26 13:34:29 -05:00
Tyler Goodlet 8501a9be4f Lol actually fix screen wakeup lookup.. 2021-01-26 12:26:43 -05:00
Tyler Goodlet a232e8bc39 Display order size on order lines in order mode 2021-01-26 11:36:44 -05:00
Tyler Goodlet 25ec5faaef Drop removed show_label kwarg 2021-01-26 11:28:24 -05:00
Tyler Goodlet b9d9dbfc4a Support size fields on order lines; avoid overlap with L1 lines 2021-01-26 11:27:50 -05:00
Tyler Goodlet 990c3a1eac Try out 3 ticks away as limit submission 2021-01-26 11:26:30 -05:00
Tyler Goodlet cc5af7319f Slightly lighter sell red, try to fix screen stuff... 2021-01-22 23:02:23 -05:00
Tyler Goodlet 18fafb501d Use dashed lines for dark orders 2021-01-22 23:01:12 -05:00
Tyler Goodlet 4b2161a37b Use 2 min-ticks offset for dark orders 2021-01-22 23:00:01 -05:00
Tyler Goodlet f072e2551b Snap y-axis crosshair to min tick(s) 2021-01-22 22:59:00 -05:00
Tyler Goodlet 50d2d8517b Add support for dotted style level lines 2021-01-22 22:57:42 -05:00
Tyler Goodlet 92efb8fd8e Expect new init message in feed from brokers 2021-01-22 22:56:42 -05:00
Tyler Goodlet b4a4f12aa4 Send init message with kraken 2021-01-22 22:55:49 -05:00
Tyler Goodlet 10e47e349c Include symbol deats in feed init message from ib
Async spawn a deats getter task whenever we load a symbol data feed.
Pass these symbol details in the first message delivered by the feed at
open. Move stream loop into a new func.
2021-01-22 17:11:53 -05:00
Tyler Goodlet 5327d7be5e Add screen acquire timeout loop 2021-01-22 16:46:39 -05:00
Tyler Goodlet f82127de31 Add "live order" submission using ctl-<action key> 2021-01-19 20:48:58 -05:00
Tyler Goodlet 7811119736 Support toggling level line highlighting 2021-01-19 20:47:55 -05:00
Tyler Goodlet 149820b3b0 Get "dark (order) mode" workin!
Basically a stop limit mode where the dirty execution-condition deats
are entirely held client side away from the broker. For now, there's
a static order size setting and a 0.5% limit setting relative to the
trigger price. Swap to using 'd' for dump and 'f' for fill - they're
easier for use with ctrl (which is used now to submit orders directly to
broker - ala "live (order) mode"). Still more kinks to work out with too
fast cancelled orders and alerts but we're getting there.
2021-01-19 16:58:01 -05:00
Tyler Goodlet 794665db70 Drop log msg 2021-01-18 20:28:52 -05:00
Tyler Goodlet e6724b6559 Move order mode handling into charting code 2021-01-18 20:28:37 -05:00
Tyler Goodlet f3ae8db04b Big refactor; start paper client 2021-01-18 19:56:35 -05:00
Tyler Goodlet 2bf95d7ec7 Fix clients map typing annot 2021-01-15 21:10:08 -05:00
Tyler Goodlet 5acd780eb6 Get live mode correct and working 2021-01-15 21:10:08 -05:00
Tyler Goodlet 3e959ec260 Add fill handler to order mode 2021-01-15 21:10:08 -05:00
Tyler Goodlet bdc02010cf Finally, sanely normalize local trades event data 2021-01-15 21:10:08 -05:00
Tyler Goodlet c835cc10e0 Get "live" order mode mostly workin 2021-01-15 21:10:08 -05:00
Tyler Goodlet ee8caa80d4 Add order cancellation and error support 2021-01-15 21:10:08 -05:00
Tyler Goodlet 140f3231e7 Add basic client-side order entry to EMS 2021-01-15 21:10:08 -05:00
Tyler Goodlet f9d4df7378 Start higher level order mode API 2021-01-15 21:10:08 -05:00
Tyler Goodlet 53c0816c5f Add color properties for level line and label 2021-01-15 21:10:08 -05:00
Tyler Goodlet c1266a7a1d Add buy/sell colors 2021-01-15 21:10:08 -05:00
Tyler Goodlet 12aebcc89c Expose "proxy" api a little better 2021-01-15 21:10:08 -05:00
Tyler Goodlet e51670a573 Try dynamically loading screen 2021-01-15 21:10:08 -05:00
Tyler Goodlet 5503a5705a Drop old line 2021-01-15 21:10:08 -05:00
Tyler Goodlet 3e7057d247 Use feed's trade streamin in ems 2021-01-15 21:10:08 -05:00
Tyler Goodlet 611486627f Cleaning 2021-01-15 21:10:08 -05:00
Tyler Goodlet bd180a3482 Add trades data stream routine to Feed 2021-01-15 21:10:08 -05:00
Tyler Goodlet 280739b51a Add trades data streaming support 2021-01-15 21:10:08 -05:00
Tyler Goodlet 620f5fee6e Wishful thinking with conditional mngrs 2021-01-15 21:10:08 -05:00
Tyler Goodlet 39e4953a6a Get order cancellation working 2021-01-07 22:08:25 -05:00
Tyler Goodlet dba8457be9 Trigger kraken sample increment after startup 2021-01-07 12:17:10 -05:00
Tyler Goodlet 282cc85ba0 Create an "order mode"
Our first major UI "mode" (yes kinda like the modes in emacs) that has
handles to a client side order book api, line and arrow editors, and
interacts with a spawned `emsd` (the EMS daemon actor).

Buncha cleaning and fixes in here for various thingers as well.
2021-01-07 12:03:18 -05:00
Tyler Goodlet 8d66a17daf Add a "lines editor" api/component 2021-01-05 13:37:03 -05:00
Tyler Goodlet 268f207a6c Shadow 'close' field with 'last' 2021-01-05 08:02:48 -05:00
Tyler Goodlet 24536ad769 Get roundtrip alert uuids workin; stage order book api 2021-01-05 08:02:14 -05:00
Tyler Goodlet d0a3deae09 Pass symbol type further down chart stack 2021-01-04 14:46:47 -05:00
Tyler Goodlet 4d6b1d4bb1 Add brokers list field to symbol type 2021-01-04 14:45:59 -05:00
Tyler Goodlet 3c424a153f Port to new `Portal.run()` api 2021-01-04 14:45:34 -05:00
Tyler Goodlet 267c8c6bd3 Go back to manual label contents check for now 2021-01-04 14:45:12 -05:00
Tyler Goodlet 9478adf600 Use event sync for increment task launch 2021-01-04 14:44:39 -05:00
Tyler Goodlet c7ff0804db Graph snap quote immediately on ib spin up 2021-01-04 14:43:59 -05:00
Tyler Goodlet c030b63101 Rejig state with dataclasses; prep for numba 2021-01-04 14:42:35 -05:00
Tyler Goodlet 7b5a72909e Start a "real" alert looking msg 2021-01-03 17:23:45 -05:00
Tyler Goodlet 616a74865b Better highlighted yellow 2021-01-03 17:23:23 -05:00
Tyler Goodlet 6e2328d351 More comments? 2021-01-03 17:23:06 -05:00
Tyler Goodlet a3468fb915 Barebones level based alerts are working! 2021-01-03 17:19:16 -05:00
Tyler Goodlet 97b2f86cfe Add preliminary support for alert line management 2021-01-03 11:12:51 -05:00
Tyler Goodlet 88d48bd188 Port to `Cursor` 2021-01-03 11:10:08 -05:00
Tyler Goodlet 08aa5984ec Rename crosshair (type) to cursor
Since the "crosshair" is growing more and more UX implementation details
it probably makes sense to call it what it is; a python level mouse
abstraction. Add 2 internal sets: `_hovered` for allowing mouse hovered
objects to register themselves to other cursor aware components, and
`_trackers` for allowing scene items to "track" cursor movements via
a `on_tracked_source()` callback.
2021-01-03 10:46:28 -05:00
Tyler Goodlet 14dad08d98 Extend level line interaction
Support tracking the mouse cursor using a new `on_tracked_sources()`
callback method. Make hovered highlight a bit thicker and highlight when
click-dragged. Add a delete method for removing from the scene along
with label.
2021-01-03 10:43:53 -05:00
Tyler Goodlet edbbcbf954 Add alert yellow 2021-01-03 10:39:06 -05:00
Tyler Goodlet d492f5c35a Define our own mouse clicked handler 2021-01-01 17:49:23 -05:00
Tyler Goodlet a55d72f8d6 Create and "EMS" module for order execution/routing actor(s) 2021-01-01 17:49:02 -05:00
Tyler Goodlet 80d48e5ece Dynamically override .boundingRect() after startup 2021-01-01 13:23:05 -05:00
Tyler Goodlet e474d8c309 Remove horizontal crosshair on "a" hotkey 2021-01-01 13:05:50 -05:00
Tyler Goodlet 7a53f19eeb Highlight level line label on hover 2021-01-01 13:05:16 -05:00
Tyler Goodlet d602cbc985 Avoid active_plot race 2021-01-01 12:59:31 -05:00
Tyler Goodlet bd85214017 Add draft order actor architecture 2021-01-01 12:40:05 -05:00
Tyler Goodlet 5fddb581ab Kill backfiller on "no history" error 2021-01-01 12:34:50 -05:00
Tyler Goodlet 81b10b9dfc Add initial y-axis zoom 2020-12-30 12:55:02 -05:00
Tyler Goodlet f3a0b1e91e Use pixel buffers on axis labels 2020-12-29 18:05:36 -05:00
Tyler Goodlet 1e09b0f08f Type annot paint methods 2020-12-29 18:05:36 -05:00
Tyler Goodlet 98c3bb8aee Add a pyqtgraph profiling toggle to chart CLI 2020-12-29 18:05:36 -05:00
Tyler Goodlet a68fff4139 Break specialized graphics into specific mods 2020-12-29 18:05:36 -05:00
Tyler Goodlet 575b3a0605 Adjust imports 2020-12-29 18:05:36 -05:00
Tyler Goodlet 916396fbfe Move fast curve graphics to new mod 2020-12-29 18:05:36 -05:00
Tyler Goodlet 19e3db8f61 Move OHLC items into new module 2020-12-29 18:05:36 -05:00
Tyler Goodlet b4c28cb086 Start a new graphics sub-package 2020-12-29 18:05:36 -05:00
Tyler Goodlet 5d30f351af Remove use of `tractor.run()` 2020-12-29 18:05:36 -05:00
Tyler Goodlet d7f80d8ddb Add note about shm limit 2020-12-29 18:05:36 -05:00
Tyler Goodlet b467e8fd8d Try cache mode on a bunch of "static" graphics 2020-12-29 18:05:36 -05:00
Tyler Goodlet 588213a230 Add an experimental "fast appendable curve" graphic 2020-12-29 18:05:36 -05:00
Tyler Goodlet 93e76fa12c Comment some unneeded PDI optimization flags 2020-12-29 18:05:36 -05:00
Tyler Goodlet cac797a7fc Add initial pixel buffer caching usage
Leverages `QGraphicsItem.cacheMode` to speed up interactivity via
less `.paint()` calls (on mouse interaction) and redraws of the
underlying path when there are no transformations (other then a shift).
In order to keep the "flat bar on new time period" UX, a couple special
methods have to be triggered to get a redraw of the pixel buffer when
appending new data.

Use `QPainterPath.controlPointRect()` over `.boundingRect()` since
supposedly it's a lot faster. Drop all use of `QPicture` (since it seems
to conflict with the pixel buffer stuff?) and it doesn't give any
measurable speedup when drawing the "last bar" lines.

Oh, and add some profiling for now.
2020-12-29 18:05:36 -05:00
Tyler Goodlet bd73d02cfb Avoid loading volume FSPs on symbols without any data 2020-12-28 14:43:17 -05:00
Tyler Goodlet 42761438f6 Pass backfiller explicit symbol str, don't require volume ticks 2020-12-26 18:04:32 -05:00
Tyler Goodlet bc96c5847c Port to new tractor api 2020-12-21 13:02:43 -05:00
Tyler Goodlet 714c757e3e Add vwap back to fsp conf on feature branch 2020-12-21 13:02:43 -05:00
Tyler Goodlet 48da729364 Use .shield() meth name from tractor 2020-12-21 13:02:43 -05:00
Tyler Goodlet c01382294e Add signal backfilling via trio task respawn 2020-12-21 13:02:43 -05:00
Tyler Goodlet e89d3f9560 Use `numpy.divide()` to avoid divide-by-zero 2020-12-21 13:02:43 -05:00
Tyler Goodlet 7c7b31ebbe Break hist calc into wap func, use hlc3. 2020-12-21 13:02:43 -05:00
Tyler Goodlet 33515f45cc Add vwap to exposed fsp map 2020-12-21 13:02:43 -05:00
Tyler Goodlet ef2be16d97 Add initial tina (ohl3) vwap fsp 2020-12-21 13:02:43 -05:00
Tyler Goodlet 833a442ac0 Disable vwap in conf, feature delay 2020-12-19 16:57:58 -05:00
Tyler Goodlet f27d639552 Port kraken to declare "wap" field 2020-12-19 16:53:51 -05:00
Tyler Goodlet b72d7d3085 Drop profile calls on OHLC bars for now 2020-12-19 16:52:04 -05:00
Tyler Goodlet df686755da Drop legacy "historical" QPicture cruft 2020-12-19 16:51:11 -05:00
Tyler Goodlet 618c2f8e0a More general salutation 2020-12-19 16:51:03 -05:00
Tyler Goodlet db6f77481b Stick with slightly smaller fonts 2020-12-19 16:50:54 -05:00
Tyler Goodlet 7ce27107df Fix axes for shm primary indexing 2020-12-19 16:50:49 -05:00
Tyler Goodlet c8537d59a8 Port charting to new shm primary indexing 2020-12-19 16:50:38 -05:00
Tyler Goodlet 9930430721 Close app on last window exit
Use a system triggered SIGINT on app close to tear down the streaming
stack and terminate the `trio`/`tractor` runtimes deterministically.
2020-12-19 16:50:29 -05:00
Tyler Goodlet 599b5276b4 Port data apis to not touch primary index 2020-12-19 16:50:20 -05:00
Tyler Goodlet fda9fcbc55 Add historical backfilling to ib backend 2020-12-19 16:50:08 -05:00
Tyler Goodlet 6d50ad75a7 Ensure right bar x index is an int 2020-12-19 16:49:57 -05:00
Tyler Goodlet 2568a2d2e9 First draft, make graphics work on shm primary index
This is a bit hacky (what with array indexing semantics being relative
to the primary index's "start" value but it works. We'll likely want
to somehow wrap this index finagling into an API soon.
2020-12-19 16:49:43 -05:00
Tyler Goodlet 02b7d6cd19 Add prepend support to shm system 2020-12-19 16:49:35 -05:00
Tyler Goodlet 9710685508 Left align yaxis label 2020-12-19 16:49:27 -05:00
Tyler Goodlet 1f8f2eb8b3 Font size tweaks for low dpi 2020-12-19 16:06:54 -05:00
Tyler Goodlet 247b5fa2ec Tidy up doc string 2020-12-19 16:06:28 -05:00
Tyler Goodlet 3e16840566 Attempt to add numba typing and use `QGraphicsPathItem`
Failed at using either.

Quirks in numba's typing require specifying readonly arrays by
composing types manually.

The graphics item path thing, while it does take less time to write on
bar appends, seems to be slower in general in calculating the
``.boundingRect()`` value. Likely we'll just add manual max/min tracking
on array updates like ``pg.PlotCurveItem`` to squeeze some final juices
on this.
2020-12-19 16:06:22 -05:00
Tyler Goodlet 949e9d6cd1 Drop commented pixmap cruft
See #124 as to why we'll probably never need this.
2020-12-19 16:06:07 -05:00
Tyler Goodlet f083f537b1 Get `QPainterPath` "append" working
Pertains further to #109.

Instead of redrawing the entire `QPainterPath` every time there's
a historical bars update just use `.addPath()` to slap in latest
history. It seems to work and is fast. This also seems like it will be
a great strategy for filling in earlier data, woot!
2020-12-19 16:05:59 -05:00
Tyler Goodlet 413c703e34 Draw bars using `QPainterPath` magic
This gives a massive speedup when viewing large bar sets (think a day's
worth of 5s bars) by using the `pg.functions.arrayToQPath()` "magic"
binary array writing that is also used in `PlotCurveItem`.  We're using
this same (lower level) function directly to draw bars as part of one
large path and it seems to be painting 15k (ish) bars with around 3ms
`.paint()` latency. The only thing still a bit slow is the path array
generation despite doing it with `numba`. Likely, either having multiple
paths or, only regenerating the missing backing array elements should
speed this up further to avoid slight delays when incrementing the bar
step.

This is of course a first draft and more cleanups are coming.
2020-12-19 16:05:53 -05:00
Tyler Goodlet 8aede3cbcb Add field diffing on failed push 2020-12-19 16:05:22 -05:00
Tyler Goodlet f9e4e9507d Tweak axis text offset and margins 2020-12-19 15:05:37 -05:00
Tyler Goodlet c625dc90f1 Use new global var stack from tractor 2020-12-19 15:05:29 -05:00
Tyler Goodlet 9572280553 Kill the tractor tree on window close.
This makes it so you don't have to ctrl-c kill apps.
Add in the experimental openGL support even though I'm pretty sure it's
not being used much for curve plotting (but could be wrong).
2020-12-19 15:05:21 -05:00
Tyler Goodlet bfcf5170dc Add commented ex. code for line price charts 2020-12-19 15:05:14 -05:00
Tyler Goodlet acf8aeb33e Allocate space for 2d worth of 5s bars 2020-12-19 15:05:03 -05:00
Tyler Goodlet daa429f7ca Put fsp plotting into a couple tasks, startup speedups.
Break the chart update code for fsps into a new task (add a nursery) in
new `spawn_fsps` (was `chart_from_fsps`) that async requests actor
spawning and initial historical data (all CPU bound work).  For multiple
fsp subcharts this allows processing initial output in parallel
(multi-core). We might want to wrap this in a "feed" like api
eventually. Basically the fsp startup sequence is now:
- start all requested fsp actors in an async loop and wait for
  historical data to arrive
- loop through them all again to start update tasks which do chart
  graphics rendering

Add separate x-axis objects for each new subchart (required by
pyqtgraph); still need to fix hiding unnecessary ones.
Add a `ChartPlotWidget._arrays: dict` for holding overlay data distinct
from ohlc. Drop the sizing yrange to label heights for now since it's
pretty much all gone to hell since adding L1 labels. Fix y-stickies to
look up correct overly arrays.
2020-12-19 15:04:51 -05:00
Tyler Goodlet 49699a16ff Skip base metrics on no basis 2020-12-17 10:50:05 -05:00
Tyler Goodlet af61611801 Add initial selection box interaction
Requires decent modification of the built-in ``ViewBox``.
We do away with the zoom functionality for now and instead just add
a label full of some simple stats on the bounded data.
2020-11-08 16:15:34 -05:00
Tyler Goodlet 1972740d0c Make salotz stop grumbling like an old man 2020-11-06 15:35:10 -05:00
Tyler Goodlet 0f458f8263 Add min tick setting to axis type 2020-11-06 15:24:01 -05:00
Tyler Goodlet c1109ee3fb Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
Tyler Goodlet be4a3df7ba Add L1 spread streaming to kraken 2020-11-06 11:35:40 -05:00
Tyler Goodlet 043bc985df Configure L1 queue size precisions from history 2020-11-06 11:35:10 -05:00
Tyler Goodlet e27fece4e6 Add L1 queue size precision controls 2020-11-06 11:34:32 -05:00
Tyler Goodlet 205bedce85 Spec dpi aware font size in inches 2020-11-05 20:32:35 -05:00
Tyler Goodlet 1e491fb1bb Use pyqtgraph default pen for level lines 2020-11-05 13:23:29 -05:00
Tyler Goodlet cc88300ac5 Fix L1 updates to be like TWS
I think this gets us to the same output as TWS both on booktrader and
the quote details pane. In theory there might be logic needed to
decreases an L1 queue size on trades but can't seem to get it without
getting -ves displayed occasionally - thus leaving it for now.

Also, fix the max-min streaming logic to actually do its job, lel.
2020-11-05 12:08:29 -05:00
Tyler Goodlet db075b81ac Specialize `LevelLabel` for orientation-around-axis gymnastics 2020-11-05 12:08:02 -05:00
Tyler Goodlet 9c3850874d Add all L1 tick types for ib 2020-11-05 08:18:55 -05:00
Tyler Goodlet f438139ad7 Update L1 labels in price loop 2020-11-03 22:03:49 -05:00
Tyler Goodlet 73e54a2259 Add L1 labels wrapper type
Start a simple API for L1 bid/ask labels.
Make `LevelLabel` draw a line above/below it's text (instead of the
rect fill we had before) since it looks much simpler/slicker.
Generalize the label text orientation through bounding rect
geometry positioning.
2020-11-03 19:48:27 -05:00
Tyler Goodlet 987c13c584 Classify L1 tick types 2020-11-03 16:22:04 -05:00
Tyler Goodlet a5d5208cfa Add sticky "orientation", allow overriding label draw instructions. 2020-11-03 16:21:21 -05:00
Tyler Goodlet e65f511648 Draw flat line on every new time step
Until we get a better datum "cursor" figured out just draw the flat bar
despite the extra overhead. The reason to do this in 2 separate calls is
detailed in the comment but basic gist is that there's a race between
writer and reader of the last shm index.

Oh, and toss in some draft symbol search label code.
2020-11-03 12:25:08 -05:00
Tyler Goodlet d92e02db86 Add back min window size i guess 2020-11-03 12:22:57 -05:00
Tyler Goodlet 22f1b56b36 Always update left (open) arm 2020-11-03 08:15:00 -05:00
Tyler Goodlet 1640906b09 Write shm volume (facepalm), update open=close on first volume 2020-11-03 08:14:37 -05:00
Tyler Goodlet b23e459027 Cleanup unneeded commented stuff 2020-11-02 15:43:19 -05:00