- Where it is. Settings, under Margin keeper, for what holds for the whole wallet. The Strategies page, By group, for how each group stands now, with the keeper’s panel beside it.
- How it starts. A new wallet’s keeper is on. It moves nothing between venues until LaMarge is set up: it reads your strategies and tells you what stays short.
This keeper is off unless your executor starts with
KEEPER_ON_GROUPS=on. Without it, the keeper levels whole venue accounts as before,
with the settings you saved; a new wallet’s starts on, with Also keep isolated legs level on too. The setting goes once this keeper
has run on mainnet, and this page then describes every executor.What it looks at
Each strategy’s legs, never a venue account as a whole. For a leg that holds something, the keeper counts what backs it:- In cross margin: the leg’s margin, plus what the leg made or lost on its venue since its strategy began, plus what the keeper moved there for it, less what it moved out. A leg’s margin is what it held at entry over its leverage.
- In isolated margin: what its position holds of its own, its margin with its unrealized P&L.
When it moves, and when it doesn’t
- No move without a need. A need is what a strategy’s leg lost. Two accounts of different sizes aren’t one.
- A loss is shared between the two legs. The leg that lost is refilled from the other, so both end at the same level.
- A gain stays where it was made. A leg is refilled up to its margin, never above. Spreading a profit over two venues isn’t a need.
- Only past a threshold. A group moves once one of its venues is short by its threshold, 30 points of the margin its legs use there to begin with, and by its smallest move, $10 to begin with.
Groups
A group is strategies added up before deciding whether to move. On each venue, the keeper sums what the group’s cross legs are short of or hold over, against the margin they use there. Example: one group or two. On Hyperliquid, ETH is $50 short and BTC holds $20 over, each with $100 of margin there.- In one group, the group is $30 short of $200: 15 points, under a threshold of 30. Nothing moves.
- In two groups, each decides alone. ETH is $50 short of $100: 50 points. It moves.
How groups start
- Every strategy with both legs in cross margin is in one group, Cross strategies, marked Start group.
- A strategy holding an isolated leg is alone in a group of its own, marked Alone. Its position’s margin is its own, so it’s weighed on its own pair.
Compose them
On the Strategies page, By group, each strategy’s menu has Move to another group…: one of your groups, or New group, which you name. A strategy you placed stays where you put it, whatever its legs become. One holding an isolated leg can go back On its own, as it started. Each group’s line ends with Settings, which opens Group settings: its name and what it decides with. Any group can be renamed. A group you made can be deleted there with Delete group; its strategies go back where they start, with their own keeper options. A wallet keeps at most 50 groups of your own. Cross and isolated strategies may share a group. A strategy holding an isolated leg is still weighed on its own pair there: another strategy’s surplus on a venue doesn’t protect its position.One bridge for every move
Whatever the groups, moves decided at the same check are carried together. What one strategy gives on a venue and another needs there never leaves it: only the difference crosses. A bridge here is one crossing between two venues, through LaMarge. Example: opposite needs. ETH needs $50 to Hyperliquid, and BTC needs $20 to Polymarket Perps. Alone, $70 would cross. Together, $30 go from Polymarket Perps to Hyperliquid, and both strategies are level. The keeper’s panel and each strategy’s History say it:Bridged $30 instead of $70: ETH needed $50 to Hyperliquid, BTC needed $20 to Polymarket PerpsWhen the needs cancel out, nothing crosses at all, and the line reads “Moved $40 without a bridge: ETH needed $20 on Hyperliquid, BTC needed $20 on Polymarket Perps”. With three venues, no fixed giver. The keeper works out the moves that leave the least short within your settings, then the fewest dollars bridged. Polymarket Perps is $75 short, Hyperliquid holds $70 over and Aster $5 over: $70 leave Hyperliquid, and Aster’s $5, under the smallest bridge, stay where they are. Margin never passes through a third venue on its way. One move at a time. After a move, the keeper waits for the venues to show it before it decides another, 60 seconds to begin with.
Its settings
Each one says what its choice costs behind the info icon beside it. They apply from the keeper’s next check.For the wallet
In Settings, under Margin keeper, saved together with Save.
The same switch is on the keeper’s panel of the Strategies page. Turning it on there asks first, with what it will then do in a sentence. Turned off, it holds from the next check, and a move that runs goes to its end.
For a group
In Group settings, from the group’s line on the Strategies page or its tile in Settings.
Choosing the threshold. A small one keeps legs closer to their margin, at the price of more moves, each with its cost. A large one moves less often and lets a leg run further short first. At 30, with $200 of margin on Hyperliquid, the group moves once it's $60 short there.
Choosing the caps. A cap bounds what a mistake or a fast market can move. Its price: a leg the cap keeps from being refilled stays short, and the keeper tells you so.
Settings that contradict are said beside the setting they name, with a warning badge and its sentence on hover, as you type them: below. They don’t stop a save.
Ride along. ETH’s group, $50 short on Hyperliquid, moves. BTC's group holds $20 over there and is under its threshold. Off, $50 are bridged for ETH alone. On, BTC settles in the same bridge: $30 cross, and both end level.
For a strategy
Keeper options…, in the strategy’s menu on the Strategies page, or at the end of the strategy’s own Settings.
Free funds cover whole, or not at all. ETH is $50 short on Hyperliquid. With $350 free there, it’s covered: nothing moves, and its row reads Covered. With $49.99 free, it isn't, and the keeper sends its $50 as for any other.
The rest of the account
Also level the rest of the account is what the keeper did before it looked at strategies. On, it also evens out what your accounts hold beyond what backs your strategies’ cross legs: free funds, and positions of your own.- Level, each venue holds its share of the rest, in proportion to the margin your strategies’ cross legs use there.
- It asks for a move by itself, with a threshold, caps and a smallest move of its own, shown under the switch once it’s on: Level it when a venue is short by, Most a move takes for it, Most it moves for it over 24 hours, Smallest move for it and Smallest move for it applies to. They start as a group’s do.
- A strategy’s own surplus isn’t the rest. A gain that stays on a venue is that strategy’s, and levelling leaves it alone.
The smallest move
A group moves only once a venue is short by both its threshold and its Smallest move. On a small account, the second one decides.- **With $100 of margin on a venue,** 30 points are $30: the threshold decides.
- **With $20 of margin on a venue,** 30 points are $6, under $10: nothing moves until the leg is $10 short, half its margin.
- **With $10 of margin or less,** a $10 shortfall is the whole margin: the keeper would never move in time.
Each venue or all venues
Once a venue asked, Smallest move applies to says what the move must bring. It starts at All venues, as the keeper did before you could choose. Example: ETH and BTC, the other way round on Hyperliquid and Aster, in a group moving from $1, without LaMarge. ETH's short on Aster is $1.56 short and BTC’s on Hyperliquid $0.52: the group is $1.04 short on Aster and asks. All they can do is exchange $0.52 on each venue, on paper.- All venues: what the move brings to the group’s venues together reaches the smallest move. $0.52 and $0.52 make $1.04: it goes.
- Each venue: each venue the move brings anything to gets the smallest move at least. $0.52 on each is under $1: nothing moves, and ETH’s alert says so. A venue that would get less gets nothing, and the rest of the move still goes: a $30 refill isn’t held back by a few cents another strategy needs elsewhere.
- Either way, a venue asks for a move once it alone is short by the threshold and the smallest move. Smallest move for it applies to does the same for the rest of the account.
Settings that contradict
Some settings work against each other, or against what your strategies’ margin can ever give. The page says so beside the setting it names, measured at your strategies’ target size, and saves them anyway: you decide.
The rest of the account is checked against its own caps the same way, while it’s levelled.
What limits a move
A group that asks for a move gets what it lacks, cut down to what these allow:- your caps, per move and over 24 hours;
- what the giving venue lets leave, below;
- what LaMarge’s book fills at the cost you allow;
- the least a bridge carries, and the group’s smallest move. LaMarge’s book takes a least of its own each way, which the keeper learns from its quote: a bridge under it never starts;
- whether a bridge goes that way at all: none without LaMarge, and none through a third venue.
The withdrawal floor
Holding more than its margin isn’t being able to give. A venue keeps back part of an account before any withdrawal, and the keeper never asks for more than the venue says can leave.- Hyperliquid and Polymarket Perps keep the larger of the positions’ initial margin and 10% of the positions’ value, whatever their leverage. Past 10× leverage, that is more than the margin: at 20×, twice as much.
- Aster says what can leave as its own figure. A bridge from Aster is a transfer inside Aster, so it has no withdrawal fee.
What waits on the way
A bridge that stops midway can leave funds at your wallet’s address on a venue’s chain, or in your LaMarge balance there. They still count for the leg that gave them, and the next bridge from that venue spends them first. The Strategies page shows them under their account. Tokens an earlier Aster bridge left on BSC are exits only: they never count, no bridge spends them, and the alert after 30 minutes says to withdraw them in LaMarge’s app. What a bridge into Aster delivered and couldn’t yet go into its futures account waits in its Spot wallet, and the keeper asks again at each pass. What can wait, and where. A bridge in two takes, through a venue between, that stops there blocks its own way, and only that way: other bridges don’t wait for it. The keeper tells you at once what waits there. The way is free again once a bridge from the venue between to its end goes through, once the keeper reads the venue between’s account holding less than what waited in it, or after 6 hours at most, the alert then saying to check what still waits. A bridge found again after a restart counts once in what waits. A route through another venue.Isolated legs
A venue deposits to an account’s free balance and withdraws from it, never from a position. So for a strategy holding an isolated leg, the keeper works on the positions themselves, and on that strategy’s own pair. Example. A strategy holds $500 a leg at 10×, both isolated, so $50 of margin in each position. The price falls 3%: the long’s position holds $35 and the short's $65. The long is $15 short, 30 points of its margin: $15 move, and both hold $50. In profit, the move is smaller. Positions holding $35 and $95 for $50 of margin each: the first gets the $15 that bring it back to its margin, and the second keeps $80.How the margin moves
- Out of the giving position, to its account’s free balance. If the venue refuses, the whole move is undone before anything crosses.
- Across, in the same bridge as every other move decided then.
- Into the receiving position, what arrived.
- Back into the giving position, what was taken out and didn’t leave.
What a position can give
A position gives the least of:- what it holds above its initial margin: a position that gave stays as far from liquidation as one just opened at its leverage;
- what its venue lets leave it, below, less 5% where that is the limit, since the venue’s figure moves with the price;
- what its account could then withdraw, by the withdrawal floor.
Aster doesn’t document its figure: the keeper works it out by the rule of Aster’s API family, and Aster’s own refusal decides.
When a venue refuses a step
Each step is asked of its venue once. Only a venue’s refusal is asked again. A step its venue gave no answer to, a timeout or an answer lost on the way, may have been taken: it’s never asked again, and the strategy’s journal says so as it happens, with where to look.- Margin out of a position: nothing moved. The keeper leaves that strategy alone for 5 minutes, then twice as long after each refusal, up to an hour, and tries it again apart from the others.
- Margin into a position: what arrived waits in that account’s free balance, and the leg’s line shows a badge, such as $50 waits. The keeper counts it as backing that leg, bridges nothing more into that position meanwhile, and asks the venue again by itself: 5 minutes after the refusal, then twice as long after each refusal in a row, up to an hour. You can add it yourself with Adjust margin…, in the strategy’s menu: the wait ends once the position holds it. The strategy’s other leg is kept level as before.
- Margin back into the position it came from, when its bridge didn’t go: it waits in that account’s free balance too, and the keeper leaves the strategy alone for an hour. Nothing asks it again: add it back with Adjust margin….
Who keeps an isolated leg
One thing only, said by a badge on the leg’s card of the strategy’s page:- Own rule: the strategy’s own Move margin rule, when one is on. The keeper leaves that strategy alone.
- Keeper: otherwise, while the keeper is on and the strategy’s Kept level by the keeper is.
- Not kept: with neither. The margin stays in each position until you move it yourself.
Two options for isolated legs
- Let its strategies help each other, on a group. ETH’s position is $50 short on Hyperliquid, and BTC's holds $20 over there. Off, ETH bridges its $50 alone. On, $20 go from BTC’s position into ETH’s on Hyperliquid, as much goes the other way on their other venue, and $30 are bridged.
- Refill from the venue’s free funds, on a strategy. Off, a position is refilled from the strategy’s other leg, and nothing else on the venue is touched. On, the keeper first adds margin from the account’s free funds, at once and at no cost, with money from outside the strategy: the position goes back to its margin, and the loss is no longer shared with the other leg. Whether this option stays is still being decided.
What it doesn’t keep
- A venue your executor moves no margin into a position on. Hyperliquid, Polymarket Perps and Aster all take it.
- A venue account that isolates no position, as Aster’s in its Multi-Assets mode: no leg can be isolated there. Venue accounts says how to switch the mode.
- A leg of dust.
What it never does
It never makes up for a position outside your strategies. Each strategy is levelled between its own two legs, and that is all. Example. Hyperliquid held $120: $100 for the ETH strategy, $20 of rest. A SOL long you opened yourself loses $90, and $30 are left. The strategy lost nothing, so the keeper moves nothing. It tells you instead:Hyperliquid holds $70 less than your strategies count on there: $30 of equity for $100 counted, behind $100 of margin. It also holds positions outside your strategies: SOL, down $90. The keeper moves nothing for it: your strategies lost nothing there. Add margin there, or reduce what else the account holds; each strategy’s own rules are what closes it near liquidation.You’re told once the account lacks $10 and 30 points of the margin your cross legs use there, the threshold and smallest move of the rest of the account. With Also level the rest of the account on, that option may still bring free funds from your other venues to that account, within its own limits. It never takes a strategy’s margin for it. What protects the strategy then is its own rule. Emergency exit near liquidation closes both legs and pauses, whatever brought the leg there. The generic template starts with it. Rules. A strategy without it shows a warning, in the badge beside its status: No rule closes this strategy near liquidation. Nothing is added for you: add or enable a rule that closes both legs when the distance to liquidation falls. Two more things it doesn’t do:
- Count a move you made by hand. Margin you send to an account adds to that account’s rest, not to a strategy. The keeper still reads the leg as short and sends what it lacks, unless that strategy’s Let the account’s free funds cover is on. Whether a move by hand should count for the strategies on both accounts is still being decided.
- Follow a gain you withdrew. A leg’s backing counts all it made since its strategy began, wherever that money is now. Take a gain out of a venue, and it’s found missing only when that leg is asked to give: the move is then bounded by what the venue lets leave, and what stays short is told.
When it waits
What the keeper reads isn’t always where a strategy settles. It plans nothing for a strategy:- within 15 seconds of an order on one of its venues, whichever strategy sent it;
- while you close a strategy that has a leg on one of its venues, and for 2 minutes after;
- while its legs can’t be read on their venues, or what they made or lost isn’t read yet, as for a few seconds after a restart.
How a group stands
On the Strategies page, each group’s line says how it stands, with the reason beside it and the detail behind the badge.
A group’s level on a venue is 100% less what its legs are short of there, as a share of the margin they use: $30 short of $200 reads 85%.
Under a group, each leg shows its margin, then $50 short**, **$20 over or level, and how far its price is from liquidation. A strategy the keeper treats apart says so in a word: Not kept, Covered or Not planned, with why behind it.
Above the groups, each venue account’s card shows its own Level, its equity over the margin its cross legs use, and what it holds free of your strategies: the part the keeper leaves alone unless you ask it to level the rest.
The keeper’s panel lists its Latest moves. A move that went through whole shows how long LaMarge took. The others say how they ended: No bridge when the needs cancelled out, Partly moved, Not moved, or Undone when what had been taken out of the positions went back.
Its alerts
The keeper tells you only what you should act on, on the channels that receive Alerts, and in the History of each strategy concerned. Each alert says why, and what fixes it.
One alert per problem.
- A leg short on a venue is one problem, whatever leaves it so. When the reason changes, it’s told again, starting “Still so, for another reason now.”
- It’s told again only once it’s short of half as much again, and of $10 more at least, or an hour on while it lasts.
- A restart tells nothing again: your executor keeps what it told.
- A leg’s end is said an hour after it was last told, once, if the leg is level by then, such as “ETH is no longer short on Hyperliquid: nothing to do.” Said sooner, it could read “no longer short” while the leg is short again. A leg refilled a minute after the alert is in its strategy’s journal at once.
- Never while its strategy can’t be read. The end then waits until the strategy reads level again, and is told as the same problem if it reads short.
- The other problems are said over as they end: a bridge that ended, an account that holds again, a strategy read again. One that comes back within the hour of its telling isn’t told a second time.
A stop and a restart
When your executor stops, the keeper ends the reading or the step it has in hand, within 2 seconds, then starts nothing more: no new step, no new bridge, even when a quote comes back a moment later. A bridge already on its way goes on at LaMarge without it. The executor exits 8 seconds after the signal at the latest. One stop, however often it’s asked. One Ctrl+C often reaches your executor twice, from the terminal and from what started it: the second changes nothing. A third exits at once. Turning the keeper off is gentler than a stop. It holds from the next check, and a move that runs goes to its end. When it starts again, it finishes what the stop cut short before it plans anything:- A bridge already started is found again by its id, and never sent twice.
- Margin taken out of a position for a bridge that hadn’t started goes back into it.
- What arrived for a position goes into it.
- A step cut short while its venue was asked is never asked twice. You’re told once where that margin may be: in the position, or in its account’s free balance.
With your rules
- In cross margin, while the keeper keeps a strategy level, that strategy’s own Move margin rules wait. Turn Kept level by the keeper off for it, and they run again. The generic template has no margin rule for that reason.
- In isolated margin, it’s the other way round: the strategy’s own Move margin rule, once on, keeps its legs, and the keeper leaves that strategy alone.
- Either way, the emergency exits still run. They close the pair when a leg comes too close to liquidation, should margin not arrive in time.