Bot setup & testing · Digital guide
Portfolio Exposure Limits for a Crypto Bot
Test total exposure across open positions and pending orders. The Grok guide includes risk prompts for portfolio limits in a simulated Solana desk.
View the guide →One-time payment · Instant download
- Level
- Intermediate
- First pass
- About 3 hours
- Mode
- Research and simulation only
- Format
- Digital guide, self-paced
What you’ll work on
Position sizing limits one request. An exposure limit covers multiple requests or balances, including orders that are still waiting for a result. Without a shared view, two valid test signals can both commit the same simulated funds.
What you need before you start
- A paper desk with open positions and pending orders
- A defined valuation basis for exposure
- A reservation record for pending requests
- Hypothetical budget numbers for tests
How to approach the project
Define the budget the checks share
Write down what counts toward total simulated exposure, including existing positions and reserved amounts for pending test orders. Pick a consistent valuation basis and record what happens when a price is missing. Use hypothetical numbers to test the behavior without making a recommendation about anyone’s real portfolio.
Simulate two candidates arriving together
Create a fixture where either candidate fits the remaining amount and both together would exceed it. Run them in the same batch and record which request reserved funds first. Check that a rejected, timed-out or failed request is handled explicitly, so its reservation cannot quietly disappear or stay forever.
Exercise reductions as well as entries
Send a simulated partial fill and then a reduction or cancellation. Compare requested, reserved and completed amounts in the journal. Ask the code assistant to explain when each counter changes and add a check that only a confirmed state transition frees the amount assigned to a test request.
Worked example: Two valid candidates, one budget
| Step | Amount | Result |
|---|---|---|
| Total exposure limit (hypothetical) | 1,000 | - |
| Existing positions | 600 | Remaining 400 |
| Candidate A requests | 300 | Reserves 300, remaining 100 |
| Candidate B requests | 300 | Rejected: exceeds remaining 100 |
| A fails to fill, reservation released | 300 | Remaining 400 again |
Invented budget. A failed request must release its reservation, and only after the state change is confirmed.
Common mistakes to avoid
Checking each order alone
Two valid orders can exceed the total. Use a shared view of exposure.
Reservations that never release
Timed-out or failed requests must free their amount explicitly.
Valuing without a price
Decide how to value a position when its price is missing.
You’re done when…
- Exposure includes open positions and pending reservations
- Simultaneous candidates are processed in a defined order
- Failed and cancelled requests release their reservation
- The journal shows requested, reserved and completed amounts
Frequently asked questions
How is exposure different from order size?
Order size describes a single request. Exposure can include all open positions and pending commitments, even when each individual request meets its own size rule.
Does the guide tell me which exposure limit I should choose?
It teaches how to implement and test configurable limits. The examples do not determine a suitable risk level for your circumstances.
What limit should I choose?
The guide cannot decide that for you. It shows how to implement and test configurable limits.
Is exposure the same as position size?
No. Position size is per order. Exposure is the total across positions and pending commitments.
Grok Trading Bot Prompt Guide
Build a six-agent Solana trading desk with prompts for screening, simulated trades, alerts and testing.
Explore the guide · $37Educational material only, not financial advice. Example figures on this page are invented to illustrate the method. Crypto assets are volatile and you can lose money. Test in simulation and check current provider terms before using any service.