microwavedcola1
8e919bb741
ts: perp improvements ( #263 )
...
* ts: perp improvements
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-10-07 13:52:04 +02:00
microwavedcola1
6808171ee3
ts: disable versioned txs for now because wallets dont support them
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-10-07 08:28:05 +02:00
Christian Kamm
f2cc869795
Perps: Prepare for settlement token != oracle token
...
Make sure the setting is available and that the needed accounts are
passed to the perp instructions.
2022-10-06 08:32:58 +02:00
tjs
dfcb9117b6
Merge branch 'main' into dev
2022-10-04 16:35:46 -04:00
tjs
dd4175b401
add back get serum3marketbypk
2022-10-04 16:35:38 -04:00
tjs
8cdd0233d4
fix merge issues
2022-10-04 15:13:24 -04:00
tjs
56313b6eac
Merge branch 'dev' into main
2022-10-04 14:54:42 -04:00
microwavedcola1
5b549fb59f
program: fix bug where expansion would not move positions whose size remained same ( #262 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-10-03 13:06:04 +02:00
Christian Kamm
b906e3dc78
Token deposit: Split into signed and permissionless ix
...
Token accounts are a limited resource, so allowing other users to make
use of them can cause problems.
2022-10-02 16:06:39 +02:00
microwavedcola1
bafaf73745
Mc/ts numbers - cleanup usage of all numbers ( #259 )
...
* ts: a higher error tolerance is sufficient
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: move stuff around
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: string representation while printing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: number cleanup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix tsc errors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: cleanup creation of I80F48 from BN
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixed from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* revert
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix from call
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 15:07:43 +02:00
microwavedcola1
d1079bb1b9
Mc/ts increase error tolerance for binary search ( #258 )
...
* ts: a higher error tolerance is sufficient
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* program: fix error size
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 14:59:12 +02:00
microwavedcola1
a2f4cef940
mc/ts derive and not hardcode size ( #257 )
...
* ts: simplify getOrCreateMangoAccount
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: derive and not hardcode sizes for perp accounts when creating
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: remove todo, not relevant anymore
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 13:33:21 +02:00
microwavedcola1
4b52d9a072
ts: simplify getOrCreateMangoAccount ( #256 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-30 12:16:24 +02:00
microwavedcola1
c22302a1da
ts client improvement ( #254 )
...
* Perps: Support trusted markets
* ts: health on client side
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: change perp lookup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: reword error messages, refactor common uses of lookups
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: reformat
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: improve typing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix some todos
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fix some todos
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: type aliasing
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: remove '| undefined' where not required as return type
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: use trusted market flag for perp health
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-09-29 15:51:09 +02:00
Christian Kamm
7e180c7b3a
Perps: Support trusted markets
2022-09-29 15:40:31 +02:00
Christian Kamm
8ba52f46c2
Perp settle pnl: incentive for settler ( #252 )
...
This adds three new options to perp markets:
- a flat fee, that is paid for all perp settlements
- given that they exceed the configured min settle amount threshold to
be eligible for fees
- and a fractional fee, that only applies when the benefiting account
has low health and gradually becomes bigger as the account slides
towards liquidation
2022-09-29 12:59:55 +02:00
Nicholas Clarke
01a958cd22
Clarkeni/onchain interest ( #244 )
...
* Onchain interest calculation
* Fix to TokenBalanceLog for token_liq_bankruptcy (was previously using liqee liab position for liqor liab position).
* Log cumulative interest when token position is deactivated.
2022-09-28 23:04:33 -07:00
Christian Kamm
984695e8d0
liquidator: Call liq_perp_bankruptcy
2022-09-29 07:36:00 +02:00
Christian Kamm
12864e15a6
Merge pull request #245 from blockworks-foundation/ckamm/perp-settle
...
Liquidator: Settle pnl on perp accounts
2022-09-29 07:35:37 +02:00
Christian Kamm
77abfd0529
Perp liq: Fix base position liquidation amount computation
...
It was wrong for quote weights != 1.
2022-09-29 07:34:52 +02:00
microwavedcola1
dd83aeb156
ts: ALTs integration
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-28 17:09:59 +02:00
Christian Kamm
15d3a0cdfa
ts client: fix reading perp event queue
2022-09-28 10:48:41 +02:00
Christian Kamm
15d0a98c94
liquidator: settle pnl on liquidatable accounts
2022-09-28 10:48:41 +02:00
Christian Kamm
11daf4d0eb
client: fetch top settle pnl counterparties
2022-09-28 10:48:41 +02:00
Christian Kamm
9cbc352197
liquidator: force-cancel perp orders, liq perp base positions
2022-09-28 10:47:05 +02:00
conj0iner
a97b40a521
Merge pull request #234 from blockworks-foundation/cj/ioc_fees
...
Extra fees for IOC orders
2022-09-28 00:05:25 +08:00
tjs
1380481781
script to view unowned mango account
2022-09-27 11:40:22 -04:00
microwavedcola1
8d86883190
ts: remove debug code
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-27 17:33:51 +02:00
microwavedcola1
b57e50c75b
ts: fix tsc issues
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-27 13:59:00 +02:00
tjs
0def209608
allow fetching mango account by publickey
2022-09-26 17:12:58 -04:00
tjs
5b4a810c5e
push latest client
2022-09-26 10:10:01 -04:00
tjs
3b1ea91903
consistent naming to get serum markets
2022-09-25 21:11:38 -04:00
tjs
92a33a0bf5
return the correct type
2022-09-25 20:27:44 -04:00
tjs
b6bcc55fcb
add type guard
2022-09-25 20:26:02 -04:00
tjs
f486a6c381
helper fn to get serum3 external market
2022-09-25 16:23:43 -04:00
microwavedcola1
b7aa6dbd5d
ts: tiny liabs pushes health ratio beyond what I80F48 can support ( #243 )
...
* ts: tiny liabs pushes health ratio beyond what I80F48 can support
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add alias
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-24 07:11:57 +02:00
tjs
fa1a483493
func to load serum open orders accts for get balances
2022-09-23 23:14:12 -04:00
Nicholas Clarke
e509a3ae9c
Clarkeni/overall pnl ( #232 )
...
* Add getPNL client function
2022-09-23 11:39:51 -07:00
Nicholas Clarke
1320451e1a
Add serum open orders balance logging. Remove price from token and perp balances. ( #236 )
2022-09-23 10:42:43 -07:00
Christian Kamm
f6c9a93ac5
Health: Avoid overflow panic in health ratio for tiny liabs
...
Spotted by microwavedcola
2022-09-23 12:04:14 +02:00
microwavedcola1
bb6790e678
ts: use price factor in maxSourceForSwap + max perp bid and ask + tests ( #237 )
...
* ts: use price factor in maxSourceForSwap
ts: max perp bid and ask
ts: mocha test for max swap
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* ts: comemnt
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 11:43:26 +02:00
Christian Kamm
39bdf20813
ts: Add group.findPerpMarket()
2022-09-23 09:48:35 +02:00
microwavedcola1
4090cf407e
ts: fix max serum bid and ask that can be placed by a mango account ( #241 )
...
* ts: fix getMaxQuoteForSerum3BidUi and getMaxBaseForSerum3AskUi where the zero amount was not tight enough for binary search
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 09:34:28 +02:00
microwavedcola1
59bb60c405
ts: fix max serum bid and ask that can be placed by a mango account ( #241 )
...
* ts: fix getMaxQuoteForSerum3BidUi and getMaxBaseForSerum3AskUi where the zero amount was not tight enough for binary search
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 09:34:08 +02:00
Christian Kamm
d86b3dd757
Rust client: Fix remaining accounts perp oracles
2022-09-23 09:07:51 +02:00
Christian Kamm
ecbd4028f7
ts client: Fix remaining accounts when opening a perp position
2022-09-23 08:42:01 +02:00
microwavedcola1
3c98a9fd0a
keeper: Fix logging of how many events are consumed ( #235 )
...
* keeper: Fix logging of how many events are consumed
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* format
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-23 08:23:37 +02:00
Conj0iner
a8ae59f0fe
IDL and client changes
2022-09-23 01:03:45 +08:00
Conj0iner
55f77ad6c6
Added IOC penalty
2022-09-23 00:55:12 +08:00
microwavedcola1
ae42356b22
program: remove todos for ix which have now been implemented or not relevant ( #240 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-22 17:43:01 +02:00