Outcome Tokens
Every Alpha prediction market has two outcome tokens:- YES tokens: Pay $1.00 if the event occurs
- NO tokens: Pay $1.00 if the event does not occur
Token Naming Convention
3078581851:
- YES token name:
Alpha Market 3078581851 Yes - NO token unit:
ALPHA-3078581851-N
The SDK automatically looks up YES and NO asset IDs from the market’s global state. You never need to hardcode them.
Position Type
The SDK uses aPosition type to represent YES or NO:
Split Shares
Splitting converts USDC into equal amounts of YES and NO tokens.Formula
Example
- Your USDC balance decreases by 10_000_000 microunits
- Your YES token balance increases by 10_000_000 microunits
- Your NO token balance increases by 10_000_000 microunits
Split Transaction Details
Split Transaction Details
From
src/modules/positions.ts, the split operation builds an atomic transaction group:- (Optional) Asset opt-in for YES token
- (Optional) Asset opt-in for NO token
- ALGO payment to market app (covers inner transaction fees)
- USDC transfer to market app
- App call:
market_app.split_shares()
Why Split?
Splitting is useful when you want to:- Sell one side to take a position without buying from the orderbook
- Provide liquidity by posting both YES and NO limit orders
- Arbitrage price discrepancies between YES and NO markets
Merge Shares
Merging converts equal amounts of YES and NO tokens back into USDC.Formula
Example
- Your YES token balance decreases by 5_000_000 microunits
- Your NO token balance decreases by 5_000_000 microunits
- Your USDC balance increases by 5_000_000 microunits
Merge Transaction Details
Merge Transaction Details
From
src/modules/positions.ts, the merge operation builds an atomic transaction group:- (Optional) Asset opt-in for USDC
- ALGO payment to market app (covers inner transaction fees)
- YES token transfer to market app
- NO token transfer to market app
- App call:
market_app.merge_shares()
Why Merge?
Merging is useful when you:- Exit a position without selling on the orderbook
- Lock in profits from both sides of a trade
- Reduce risk by converting tokens back to stablecoin
You can only merge if you hold equal amounts of YES and NO tokens. If you have 10 YES and 5 NO, you can only merge 5 pairs (leaving 5 YES).
Claiming Resolved Markets
After a market resolves, you can claim USDC by redeeming your outcome tokens.Redemption Rules
- Winning Tokens
- Losing Tokens
- Voided Markets
If you hold the winning outcome token, you get $1.00 USDC per token.
Claim Example
Claim Transaction Details
Claim Transaction Details
From
src/modules/positions.ts, the claim operation builds an atomic transaction group:- Token transfer to market app
- App call:
market_app.claim() - Asset opt-out (close remainder to market app)
Fetching Your Positions
To see all your token holdings across all markets:getPositions() returns raw token balances. For cost basis and P&L calculations, use the Alpha API’s position endpoints (requires API key).How getPositions() Works
How getPositions() Works
From
src/modules/positions.ts:- Read account info to get all ASA holdings
- Filter to Alpha Market tokens (unit name starts with
ALPHA-) - Parse market app ID from asset name:
"Alpha Market {appId} Yes" - Look up market global state to get both YES and NO asset IDs
- Group by market and return positions
Next Steps
Split Shares
Learn how to split USDC into YES/NO tokens
Claim Resolved Markets
Learn how to claim USDC from winning tokens
