Convert NO positions and conserve collateral across fixed negative-risk groups
This commit is contained in:
@@ -38,6 +38,17 @@ pub(crate) fn apply(tx: &Transaction, books: &Books, command: Command) -> Result
|
||||
}
|
||||
Ok(json!({"phase":"preopen"}))
|
||||
}
|
||||
Command::DefineNegRisk {
|
||||
group,
|
||||
event,
|
||||
markets,
|
||||
} => crate::neg_risk::define(tx, &group, &event, &markets),
|
||||
Command::Convert {
|
||||
group,
|
||||
account,
|
||||
no_markets,
|
||||
qty,
|
||||
} => crate::neg_risk::convert(tx, &group, &account, &no_markets, qty),
|
||||
Command::Split {
|
||||
market,
|
||||
account,
|
||||
@@ -286,6 +297,7 @@ fn finalize(tx: &Transaction, market: &str, winner: &str) -> Result<i64> {
|
||||
phase(tx, market, &["closed"])?;
|
||||
ensure!(matches!(winner, "YES" | "NO" | "VOID"), "invalid winner");
|
||||
resolution::authorize_finalization(tx, market, winner)?;
|
||||
crate::neg_risk::allocate_payout(tx, market, winner)?;
|
||||
// Close releases all outstanding reservations before finality.
|
||||
let changed=tx.execute(
|
||||
"UPDATE markets SET phase='resolved',winner=?1
|
||||
|
||||
Reference in New Issue
Block a user