piker/piker/brokers/kraken
Gud Boi 50ffc1095b Use `__name__` for loggers across most sub-mods
Change most sub-modules to use `get_logger(name=__name__)` for
per-leaf-module `log` instances vs previous subpkg-level/shared refs.

Primary changes,
- import `get_[console_]logger()` from top-level `piker.log` across leaf
  mods.
- change any `<subsys>._util.log` logger-instances as well (though this
  approach should no longer be used since it masks the endpoint module's
  emissions.

Also,
- add a defaulted `loglevel: str` param to all `open_trade_dialog()`
  endpoints, anticipating it being passed in by `.clearing`-engine.
- call `get_console_log(level=loglevel, name=__name__)` in each trade
  dialog ep to enable per-`brokerd`-backend console writing.
- drop `get_logger` from `.brokers.__all__` exports
- fix type annotations: `str|None` vs `str | None`
- add TODOs for,
  * comments in `._util` about multi-subsys logging
  * `.accounting.__init__` about console log setup

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-23 12:22:48 -05:00
..
README.rst Flip to `.bs_mktid` in `ib` and `kraken` 2023-05-09 14:49:25 -04:00
__init__.py .kraken: start new `.symbols` submod and move symcache and search stuff there 2023-07-17 16:20:11 -04:00
api.py kraken: add crash-handling around `Pair()` init 2026-01-06 23:43:44 -05:00
broker.py Use `__name__` for loggers across most sub-mods 2026-02-23 12:22:48 -05:00
feed.py Bleh, move `.data.types` back up to top level pkg 2023-08-05 15:57:10 -04:00
ledger.py kraken: handle ws live trading API symbology 2023-08-30 16:32:34 -04:00
symbols.py kraken: `Pair.costmin` is now optional? 2026-01-06 23:43:44 -05:00

README.rst

kraken backend

though they don't have the most liquidity of all the cexes they sure are accommodating to those of us who appreciate a little xmr.

status

current support is production grade and both real-time data and order management should be correct and fast. this backend is used by core devs for live trading.

config

In order to get order mode support your brokers.toml needs to have something like the following:

[kraken]
accounts.spot = 'spot'
key_descr = "spot"
api_key = "69696969696969696696969696969696969696969696969696969696"
secret = "BOOBSBOOBSBOOBSBOOBSBOOBSSMBZ69696969696969669969696969696"

If everything works correctly you should see any current positions loaded in the pps pane on chart load and you should also be able to check your trade records in the file:

<pikerk_conf_dir>/ledgers/trades_kraken_spot.toml

An example ledger file will have entries written verbatim from the trade events schema:

[TFJBKK-SMBZS-VJ4UWS]
ordertxid = "SMBZSA-7CNQU-3HWLNJ"
postxid = "SMBZSE-M7IF5-CFI7LT"
pair = "XXMRZEUR"
time = 1655691993.4133966
type = "buy"
ordertype = "limit"
price = "103.97000000"
cost = "499.99999977"
fee = "0.80000000"
vol = "4.80907954"
margin = "0.00000000"
misc = ""

your pps.toml file will have position entries like,

[kraken.spot."xmreur.kraken"]
size = 4.80907954
ppu = 103.97000000
bs_mktid = "XXMRZEUR"
clears = [
 { tid = "TFJBKK-SMBZS-VJ4UWS", cost = 0.8, price = 103.97, size = 4.80907954, dt = "2022-05-20T02:26:33.413397+00:00" },
]