Commit Graph

1159 Commits

Author SHA1 Message Date
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
Christian Kamm 0040a1477e
Client: Compute max perp trade amount (#231) 2022-09-21 11:45:05 +02:00
Christian Kamm 96218fb7ba Update IDL and merge issue fixups 2022-09-21 10:19:23 +02:00
Christian Kamm 52f8b61240 Merge remote-tracking branch 'origin/dev' 2022-09-21 10:14:34 +02:00
Christian Kamm a41a245e24 PerpLiqBankruptcy instruction 2022-09-21 09:46:54 +02:00
conj0iner 1c67b8ed5f
remove base_token_index from perps and include oracles (#224)
Co-authored-by: Conj0iner <conj0iner@users.noreply.github.com>
2022-09-21 09:42:45 +02:00
microwavedcola1 f96b9ded0d ts: fix event queue rawevents
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-20 19:50:21 +02:00
Christian Kamm ddb68b7991 Test build fix 2022-09-20 16:59:55 +02:00
Christian Kamm 8c91541d12 ts client: Fix serum3DeregisterMarket
The indexReservation arg wasn't passed.
2022-09-20 16:58:07 +02:00
Christian Kamm 6399e6cb6c Fix PerpMarket data layout breakage
The new fees_settled must be added at the end and the reserved amount
needs to be reduced.
2022-09-20 16:58:07 +02:00
Christian Kamm 347b225480 TokenEdit: remove bank_num arg 2022-09-20 14:22:25 +02:00
microwavedcola1 b7e79a4663
WIP: ts/perps (#220)
* ts: further fleshing out of perps code

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* cleanup scripts

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fixes from reviews

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-20 12:57:01 +02:00
Christian Kamm 11160ae2fe Health: Pass price to max_swap_source_for_health_ratio
Because it's not correct to think we'll always swap at oracle price.
That was an ok assumption for liquidations, where we'll swap at slightly
better than that, but not for jup.
2022-09-20 10:41:33 +02:00
Christian Kamm a6d25071cd Test: Fix test_alt compile 2022-09-15 19:06:46 +02:00
Christian Kamm 20eb61527b Compile fixups after merge 2022-09-15 09:40:14 +02:00
Christian Kamm 1b3a2b07db Update idl 2022-09-15 09:24:35 +02:00
Christian Kamm 14ca1dac35 Add alt_set / alt_extend instructions
alt_extend will only work in the future, when alt_set can receive lookup
tables where the authority is set to be the mango group pda.
2022-09-15 09:20:08 +02:00
Christian Kamm 899b51e91c ts: fix getMaxWithdrawWithBorrowForToken 2022-09-14 10:23:06 -04:00
Christian Kamm 50be520e99 Rename: LiqToken* -> TokenLiq* 2022-09-14 16:22:42 +02:00
Christian Kamm f3bdfec6a6
Perp settle pnl: Limit to maint spot health (#225)
Perp settle pnl: Limit to maint spot health

We want to isolate perp markets. As such, it's not acceptable to convert
arbitrary perp losses into spot token borrows.

The safe amount for this conversion is given by the account's
maint health -- with all perp markets ignored.
2022-09-14 13:26:29 +02:00
Christian Kamm 3e94ff4605 ts: fix getMaxWithdrawWithBorrowForToken 2022-09-14 09:03:29 +02:00
tjs 2b96965cc5 use send transaction in client 2022-09-14 01:44:00 -04:00
tjs b687435a37 v0.0.1-beta.2 2022-09-12 12:34:55 -04:00
Christian Kamm b579096264
Merge pull request #223 from blockworks-foundation/ckamm/perp-liq
Perp liquidation: force cancel orders, liq base position
2022-09-10 08:11:06 +02:00
Christian Kamm 5572242e6d Tests: PerpLiqBaseToken tests 2022-09-10 07:45:27 +02:00
Christian Kamm 45025a1145 Perp tests: Helper for market creation 2022-09-10 07:45:27 +02:00
Christian Kamm bb962c6781 Perp tests: Don't pass derivable accounts explicitly
This makes it impossible to test passing bad accounts for these through
this interface, but I think that's an ok tradeoff.
2022-09-10 07:45:25 +02:00