Commit Graph

63 Commits

Author SHA1 Message Date
Geoff Taylor e100895c75 Added perp redeemable pnl to dataframe and calculations. Added many more tests of perp valuations. 2022-03-11 21:43:40 +00:00
Geoff Taylor 790f379867 Removed use of abs() to get a Decimal absolute value - now use the copy_abs() method instead. 2022-03-09 12:02:18 +00:00
Geoff Taylor 4094e4a9e5 Fixed problem spot health calculations. 2022-03-04 15:21:58 +00:00
Geoff Taylor f1ea12e30f Can now withdraw to any wallet, not just current wallet. 2022-03-03 15:41:55 +00:00
Geoff Taylor 49c4353eb2 Added --account-target and --wallet-target to deposit and withdraw commands.
* Can now specify desired wallet or account balance and have the deposit or withdraw action make it so (if it can).
* Updated send-token to use same Associated Token Account creation approach as withdraw, instead of requiring an intermediate transaction - much slicker now.
2022-03-02 18:52:45 +00:00
Geoff Taylor d6a57f3859 Added subscribe() method to all AddressableAccounts. 2022-03-01 12:22:50 +00:00
Geoff Taylor 11a9fba065 Refactored instructions to have a more consistent naming pattern:
* build_serum_***
* build_spot_***
* build_perp_***
* build_mango_***
2022-02-28 12:10:13 +00:00
Geoff Taylor eef007758d Expanded porcelain functions, cleaned up old usage. 2022-02-24 19:40:05 +00:00
Geoff Taylor 28ef214212 Added deposit() and withdraw() directly on Account.
This involved some separation of interfaces for building instructions - something that may need to be expanded in the future.
2022-02-23 15:12:14 +00:00
Geoff Taylor 5063f14a16 Removed stale calculator cruft now that pandas is the main mechanism. 2022-02-21 12:28:23 +00:00
Geoff Taylor 8eb308d9be Removed some stale dataframe valuation code, implemented CSV output for dataframe. 2022-02-21 11:15:48 +00:00
Geoff Taylor 4a7c2456bc Improved account calculations and tests. 2022-02-18 19:40:57 +00:00
Geoff Taylor d2fb7e50e1 Added AccountInfo.load_by_program() to return AccountInfos since that's nearly always what we want. 2022-02-16 15:14:27 +00:00
Geoff Taylor 6d60fee84f Added account.base_slots_by_index to reduce confusion over account.spot_open_orders_by_index only working with non-quote slots. 2022-02-09 20:22:25 +00:00
Geoff Taylor e0fe4e1f6f Added a show-referrer command and the ability to fetch it from the Account. 2022-02-09 20:08:17 +00:00
Geoff Taylor 5c3b0befa9 Switched from autopep8 to black for code formatting. Reformatted all files. Updated dependencies. 2022-02-09 19:31:50 +00:00
Geoff Taylor 9fdccca3a3 Added reflink support in placing perp orders and with new commands register-referrer-id and set-referrer. 2022-02-09 18:31:29 +00:00
Geoff Taylor 485a6be3b1 Added some object accessors to make using the objects easier in client code. 2022-02-07 17:50:00 +00:00
Geoff Taylor c090e7f6dd Fixed bug in Account.is_liquidatable - it should have used maintenance health not initial health when deciding an account could be liquidated. 2022-02-01 09:06:46 +00:00
Geoff Taylor f1b14acdcf Added instructions and commands for account delegation. 2022-01-18 17:51:11 +00:00
Geoff Taylor f9b7d7b03f Updated Account layout for v3.3. 2022-01-18 14:35:01 +00:00
Geoff Taylor 4c31d05a13 Added description of some health calculation from ckamm in comment. 2022-01-11 19:39:25 +00:00
Geoff Taylor 627a68a166 Found an account where our calculations didn't match reality, so fixed bug and added it to testdata. 2022-01-08 17:34:32 +00:00
Geoff Taylor 70efa5f869 Removed include_unsettled_quote parameter in health calculation. 2022-01-07 17:40:48 +00:00
Geoff Taylor d8e61625cf Preliminary use of DataFrame calculations on Accounts. 2022-01-06 16:34:18 +00:00
Geoff Taylor 62b0332439 Removed Unicode monospaced-font rendering of class names because VSCode has started being annoying about it all. (Boo...) 2021-12-13 12:06:42 +00:00
Geoff Taylor 5f7bd3c04c Added interest rate calculations. Moved TokenInfo to TokenBank. 2021-11-13 19:23:11 +00:00
Geoff Taylor 88cb2fcdd4 Refactored Group and Account to remove requirement for Group to load all Root Banks. 2021-11-11 11:56:29 +00:00
Geoff Taylor 393ff6a899 Added unit tests for slot accessors in Group and Account. 2021-11-10 17:46:54 +00:00
Geoff Taylor 3f4ec995f0 Group and Account slots now contain their own matching indices. 2021-11-09 21:08:06 +00:00
Geoff Taylor 01cfae7fa4 Fixed problems with redeem-mango 2021-11-09 19:54:50 +00:00
Geoff Taylor d15e953ae7 Refactor of code to work with mypy --strict 2021-11-09 13:23:36 +00:00
Geoff Taylor 199c39130d Moved to having Instrument as a basis for Token, to allow for perp markets with no underlying SPL token. 2021-11-08 11:39:09 +00:00
Geoff Taylor 4a24f3df55 Some fixes for health calculations WIP. 2021-11-04 15:36:14 +00:00
Geoff Taylor 56599a1037 Added OrderBook instead of passing around bids and asks. Added it to ModelState too, and cleaned up usage. 2021-10-26 18:45:04 +01:00
Geoff Taylor 3ccca8bd01 Start of work on account calculations. 2021-10-04 18:27:07 +01:00
Geoff Taylor 26aabd23e9 Simplified and improved marketmaker hedging. 2021-10-02 12:28:16 +01:00
Geoff Taylor 2a424aa2d1 Added sweep command to sell all tokens in a market. 2021-09-02 18:51:43 +01:00
Geoff Taylor 8624afabdc Replaced command switch --account-index with --account-address because of inconsistent results when fetching multiple accounts - they could come back with different indices. 2021-09-02 17:19:17 +01:00
Geoff Taylor 8bf6384076 Added CollateralCalculator to calculate collateral in different market types. 2021-08-31 00:30:22 +01:00
Geoff Taylor 9159d615c4 Updated dependencies and fixed subsequent issues. 2021-08-27 20:37:23 +01:00
Geoff Taylor 261848f325 Big renaming of Context properties to make them more consistent and appropriate. 2021-08-26 10:31:02 +01:00
Geoff Taylor 97a5c41a39 Updated to latest group structures and IDs. 2021-08-17 19:42:11 +01:00
Geoff Taylor 3403555036 Added account name/info to output. 2021-08-13 12:15:17 +01:00
Geoff Taylor aa4406d68f Fixed account output/reporting. 2021-08-07 18:42:39 +01:00
Geoff Taylor f596d571f6 Big change - now uses our own 'Client' which handles some situations better from our point of view:
* Being able to specify commitment on the Client instead of every call.
* Better error handling (more exception details, and specific rate limiting exceptions)
* More obvious return values, instead of always having to dereference "result".
2021-08-07 15:07:19 +01:00
Geoff Taylor 613d964051 Perp Accounts accrue benefits in MNGO so improved handling of it. 2021-08-05 15:35:08 +01:00
Geoff Taylor 7033a080bf Better logging of failing instructions. 2021-08-04 17:50:38 +01:00
Geoff Taylor cc6f62c312 Expanded use of Group and Account baskets. 2021-08-04 13:08:34 +01:00
Geoff Taylor 88fa2181d2 Change Group to use a more basket-orientated approach instead of multiple properties requiring indexes. 2021-08-03 18:32:12 +01:00