Commit Graph

47 Commits (60b0b721c5776a3e81efbc780cce964850679657)

Author SHA1 Message Date
Tyler Goodlet 7b4f4bf804 First draft `.storage.nativedb.` using parquet files
After much frustration with a particular tsdb (cough) this instead
implements a new native-file (and apache tech based) backend which
stores time series in parquet files (for now) using the `polars` apis
(since we plan to use that lib as well for processing).

Note this code is currently **very** rough and in draft mode.

Details:
- add conversion routines for going from `polars.DataFrame` to
  `numpy.ndarray` and back.
- lay out a simple file-name as series key symbology:
  `fqme.<datadescriptions>.parquet`, though probably it will evolve.
- implement the entire `StorageClient` interface as it stands.
- adjust `storage.cli` cmds to instead expect to use this new backend,
  which means it's a complete mess XD

Main benefits/motivation:
- wayy faster load times with no "datums to load limit" required.
- smaller space footprint and we haven't even touched compression
  settings yet!
- wayyy more compatible with other systems which can lever the apache
  ecosystem.
- gives us finer grained control over the filesystem usage so we can
  choose to swap out stuff like the replication system or networking
  access.
2023-06-27 13:41:47 -04:00
Tyler Goodlet c6da09f3c6 Add fast(er), time-sorted ledger records
Turns out that reading **and** writing with `tomlkit` is just wayya slow
for large documents like ledger files so move to using the `tomli`
sibling pkg `tomli-w` which seems to much improve on the latency, though
obviously longer run we're likely going to want:
- a better algorithm for only back loading records using as little
  history as possible
- a different serialization format for production maybe something
  like apache parquet?

The only issue with using a non-style-preserving writer is that we don't
necessarily get TOML conf ordering for free (without first ordering it
ourselves), and thus this patch also adds much more general date-time
sorting machinery which is now **required** when using
`open_trades_ledger()` via a `tx_sort: Callable`. By default we now
provide `.accounting._ledger.iter_by_dt()` (exposed in the subpkg mod)
which conducts dynamic "datetime key detection" based parsing of records
based on a `parsers: dict[str, Callabe]` input table. The default should
handle most use cases including all currently supported live backends
(kraken, ib) as well as our paper engine ledger-records format.

Granulars:
- adjust `Position.iter_clears()` to use new `iter_by_dt(key=lambda ..)`
  signature.
- add `tomli-w` to setup and our `tomlkit` fork to requirements file.
- move `.write_config()` to bottom of class defn.
- fix closed pos popping to not error if pp was already popped..
2023-05-18 18:27:54 -04:00
Tyler Goodlet 2865f0efe9 `piker.config`: use `tomlkit` for accounting files
We still need to get some patches landed in order to resolve:
- https://github.com/sdispater/tomlkit/issues/288
- https://github.com/sdispater/tomlkit/issues/289
- https://github.com/sdispater/tomlkit/issues/290

But, this does work for style preservation and the inline-table style we
were previously hacking into the `toml` lib in `.accounting._toml`,
which we can pretty much just drop now B)

Relates to #496 (pretty much solves it near-term i think?)
2023-05-12 16:05:45 -04:00
Tyler Goodlet e0067a4e1d WIP: trying out `typer` for ledger cli 2023-05-09 14:49:26 -04:00
Tyler Goodlet 0a2187a73f Add 3.11 install tag 2023-05-08 19:35:45 -04:00
Tyler Goodlet 166f99b3d1 setup: reorg some deps drop unused ones 2023-05-08 13:30:09 -04:00
Tyler Goodlet 609b91e848 Try out `@trio_util.async_generator` for streaming
Apparently it will likely fix our `trio`-cancel-scopes-corrupted crash
when we try to let our `._web_bs.NoBsWs` do reconnect logic around
the asyn-generator implemented data-feed streaming routines in `binance`
and `kraken`.  See the project docs for deatz; obvs we add the lib as
a dep.
2023-03-20 12:54:48 -04:00
Guillermo Rodriguez 17a4fe4b2f
Trim unnecesary stuff left from marketstore copy, also fix elastic config name for docker build, add elasticsearch to dependencies 2023-02-21 13:34:28 -03:00
Guillermo Rodriguez 2851a0ecc5
Add missing protobuf dependency 2023-02-12 16:07:42 -03:00
Tyler Goodlet d8bf45b02d Use latest `asks` 2023-02-02 16:52:34 -05:00
Guillermo Rodriguez 28e025d02e
Finally get a chart going! lots of fixes to streaming machinery and custom cryptofeed fork with fixes 2022-08-23 15:18:43 -03:00
Guillermo Rodriguez 6df181c233
Add brokercheck test and got deribit to dump l1 and trades to console 2022-08-23 15:17:18 -03:00
Tyler Goodlet dfee9dd97e Remove `pydantic` from deps 2022-07-09 13:10:09 -04:00
Tyler Goodlet 7ebf8a8dc0 Add `tomli` as dep being fastest in the west 2022-06-28 10:07:57 -04:00
Tyler Goodlet ac0f43dc98 Go Python 3.10+ in anticipation of upcoming feature PRs 2022-06-28 10:02:09 -04:00
Tyler Goodlet e718120cc7 Drop `pandas` as dep 2022-05-15 13:49:54 -04:00
Tyler Goodlet ed85079d0f Add `trimeter` dep.. that we forgot 2022-05-11 13:19:47 -04:00
Tyler Goodlet a10dc4fe77 Add `docker` as `tsdb` extras dep 2022-05-09 11:15:13 -04:00
Tyler Goodlet ed8cfcf66d Drop `arrow` from install deps 2022-04-16 13:23:42 -04:00
Tyler Goodlet a073039b30 Drop dependence on `msgpack` and `msgpack_numpy` 2022-02-28 08:15:18 -05:00
Tyler Goodlet 174590ee88 Note 3.10 support and add msgspec as dep 2022-02-07 09:41:13 -05:00
Tyler Goodlet a9cdb94ff3 Port styling to latest `qtdarkstyle` version 2021-06-10 13:23:28 -04:00
Tyler Goodlet ddeb9e7a94 Add fuzzywuzzy as dep 2021-05-27 13:05:22 -04:00
Tyler Goodlet 6cc325f855 Add fuzzywuzzy dep for search 2021-05-25 08:50:48 -04:00
Tyler Goodlet f95ae79cff Officially pin to python 3.9+
The numba stuff was resolved re:
https://github.com/numba/numba/issues/6345#issuecomment-775873609

Resolves #126
2021-05-22 15:25:07 -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
Tyler Goodlet 69df73afc3 Deliver symbol info from kraken; start using pydantic 2021-02-06 14:23:27 -05:00
Tyler Goodlet 1c7da2f23b Include bidict as dep 2021-01-15 21:10:08 -05:00
Tyler Goodlet c1109ee3fb Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
Tyler Goodlet 2f1e9ee760 Update dev deps to current state of things.. 2020-10-02 12:13:49 -04:00
Tyler Goodlet ee6e4d2207 Add colorama for numba tracebacks 2020-10-02 12:13:28 -04:00
Tyler Goodlet 7a78c3a1c7 Add a couple more deps 2020-10-02 12:13:28 -04:00
Tyler Goodlet 2dd596ec6c Deps bump 2020-10-02 12:13:28 -04:00
Tyler Goodlet 213a19b191 Update version and deps 2020-09-01 13:25:40 -04:00
Tyler Goodlet b58820e297 Relicense to AGPLv3 2020-06-16 00:12:19 -04:00
Tyler Goodlet f8d619b183 Go GPLv3 2018-11-12 00:29:43 -05:00
Tyler Goodlet 94012b05c3 Screw it; go 3.7 for ``datetime.fromisoformat()`` 2018-11-11 23:12:13 -05:00
Tyler Goodlet 51b44cf236 Use msgpack for quote-packet serialization 2018-04-20 11:43:14 -04:00
Tyler Goodlet 73ef95f42a Add `pikerd` entry point 2018-04-20 11:43:14 -04:00
Tyler Goodlet 42f48c82fc Update readme; use async kivy branch 2018-02-12 10:55:04 -05:00
Tyler Goodlet 37a4d2e5f8 Expose watchlist app via `piker watch` for now 2018-02-09 03:29:30 -05:00
Tyler Goodlet a2d38f49cf Add more deps and pkgs 2018-02-08 02:39:18 -05:00
Tyler Goodlet 797efedf6a Add quote polling; pseudo-streaming
Add a ``poll_tickers`` coro which can be used to "stream" quotes at
a requested rate. Expose through a cli subcommand `piker stream`.
Drop the `pikerd` command for now.
2018-01-29 12:45:48 -05:00
Tyler Goodlet 534ba0b698 Add json highlighting; make debug msgs white 2018-01-26 11:31:40 -05:00
Tyler Goodlet 5c4996873a Start using click for cli 2018-01-25 20:56:57 -05:00
Tyler Goodlet de3d32307e Remap main entry point 2018-01-22 22:05:42 -05:00
Tyler Goodlet 037597ee36 Initial packaging 2018-01-20 13:20:10 -05:00