-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kraken ws orders #349
Merged
Merged
Kraken ws orders #349
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
00378c3
First draft, working WS based order management
goodboy f79d986
Use `match:` syntax in data feed subs processing
goodboy ab08dc5
Make ems relay loop report on brokerd `.reqid` changes
goodboy df4cec9
Get order "editing" working fully
goodboy 84cab13
Drop uneeded count-sequencec verification
goodboy d9b4c4a
Factor msg loop into new func: `handle_order_updates()`
goodboy 9fa9c27
Factor status handling into a new `process_status()` helper
goodboy bbcc55b
Update ledger *after* pps updates from new trades
goodboy 8ab8268
Don't require an ems msg symbol on error statuses
goodboy bb2f8e4
Try out a backend readme
goodboy 89bcaed
Add ledger and `pps.toml` snippets
goodboy 804e9af
Pass our manually mapped `reqid: int` to EMS
goodboy ba93f96
Lol, gotta `float()` that vlm before `*` XD
goodboy a20a8d9
Use `aclosing()` around ws async gen
goodboy caecbaa
Cancel any live orders found on connect
goodboy b0d3d9b
TOSQUASH: lingering `.dict()`s
goodboy 5dc9a61
Use cancel level logging for cancelled orders
goodboy 57f2478
Fixes for state updates and clears
goodboy 22f9b25
Provide symbol norming via a classmethod + global table
goodboy abb6854
Make all `.bsuid`s the normed symbol "altname"s
goodboy 5b135fa
Handle pre-existing open orders specifically by checking for null `oid`
goodboy 2386270
Handle too-fast-edits, add `ChainMap` msg tracing
goodboy 0fca1b3
Also map the ws symbol set to the alt set
goodboy b96b7a8
Use `aclosing()` on all msg async-gens
goodboy 54008a1
Add balance and assets retreival methods, cache assets on startup
goodboy 3b79743
Finally get real-time pp updates workin for `kraken`
goodboy 64f920d
Accept direct fqsn matches on position msg updates
goodboy 319e68c
TOSQUASH: revert to 22Hz display throttle
goodboy aa7f24b
Drop old reversed order idea for rt-pp msg testing
goodboy b1419c8
Update ledger from api immediately, cruft cleaning
goodboy d502274
Add a `Client.get_xfers()` to retreive withdrawal transactions
goodboy 8b609f5
Add transfers knowledge to positions validation
goodboy 0fb3158
Go back to using `Position.size` property in pp loading audits
goodboy 168c986
Look for transfers after ledger + api trans load
goodboy d43ba47
Renames to `ppu`
goodboy e6a3e8b
Add warning msg for `openOrders.userref` always being 0
goodboy db564d7
Add casting method to our struct variant
goodboy b3058b8
Drop remaining `pydantic` usage, convert `OHLC` to our struct variant
goodboy 44e21b1
Drop field import
goodboy 808dbb1
Drop forgotten `pydantic` dataclass in binance backend..
goodboy dc8072c
WIP: use `userref` field over `reqid`...
goodboy 227a804
Use both `reqid` and `userref` in order requests
goodboy 1cbf45b
Use the ``newuserref`` field on order edits
goodboy 7f3f7f0
Merge pull request #370 from pikers/kill_pydantic_from_kraken
goodboy 69e5017
Drop status event processing at large
goodboy 1a29193
Drop subs ack handling from streamer
goodboy 30bcfdc
Emit fills from `openOrders` block
goodboy ef5829a
Merge pull request #368 from pikers/kraken_userref_hackzin
goodboy d280a59
Repair normalize method logic to only error on lookup failure
goodboy 3a0987e
Fix to-fast-edit guard case
goodboy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
``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: | ||
|
||
.. code:: toml | ||
|
||
[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: | ||
|
||
.. code:: toml | ||
|
||
[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, | ||
|
||
.. code:: toml | ||
|
||
[kraken.spot."xmreur.kraken"] | ||
size = 4.80907954 | ||
ppu = 103.97000000 | ||
bsuid = "XXMRZEUR" | ||
clears = [ | ||
{ tid = "TFJBKK-SMBZS-VJ4UWS", cost = 0.8, price = 103.97, size = 4.80907954, dt = "2022-05-20T02:26:33.413397+00:00" }, | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This schema actually changed in #365 so we might want to document the new column order and the
ppu
(aka breakeven price) stuff here as well.