a
    dijÄ  ã                   @   sf   d Z ddlZddlZddlZej dd¡ ddlZddlZ	dZ
dZdZdd„ Zed	krbe eƒ ¡ dS )
aî  ONE-OFF CAPABILITY PROBE: does Polymarket US accept a resting SELL order?

WHY THIS EXISTS. The three-leg maker strategy means SELLING all three outcomes.
Our Poly-US client has only ever sent ORDER_INTENT_BUY_LONG, so whether the venue
accepts a resting sell is untested -- and it is the last unknown blocking a
Poly-US version of the market maker. Everything else already checks out:

  - three outcome markets per event, each with a real two-sided book
    (Fluminense v Bahia: 0.53/0.54, 0.25/0.27, 0.19/0.21 -- 102c of asks)
  - ORDER_TYPE_LIMIT with a time-in-force, so orders can rest
  - MAKER REBATE of 0.0125*C*p*(1-p) CREDITED to the maker (docs.polymarket.us/fees,
    effective 2026-07-01) versus Kalshi's maker fee of exactly zero. Worth
    +0.76c/contract on the book above, and it drops the break-even gross from
    +2.38c (Kalshi) to +1.42c -- which makes ordinary 2c books profitable
  - taker fee 0.06*p*(1-p), cheaper than Kalshi's 0.07, for forced completions
  - book depth of 7-20 contracts versus Kalshi's 1,749-44,427, so a resting
    order is near the FRONT of the queue instead of behind a wall

WHY IT IS SAFE. Sells YES at 0.98 on a leg trading at ~0.21. Nobody pays 98c for
something worth 21c, so it cannot fill. Even if it somehow did, selling at 0.98
collects 98c against a maximum 100c liability -- max loss 2 CENTS on 1 contract.
The order is cancelled about two seconds later, and the script aborts before
sending anything if the book has moved somewhere unexpected.

This is a DELIBERATE one-off exception to the paper-only rule (both venues have
AUTO_TRADE_ENABLED=False since 2026-07-25). It is a capability probe, not a
trade: no directional view, no edge sought, cancelled immediately.

Run:  python research\polyus_sell_probe.py
é    NzE:\soccer\mainzatc-bra-flu-bah-2026-07-29-bahg\�Âõ(\ï?é   c               
   C   sð  t  t¡} | r|  d¡s,tdt› d�ƒ dS td| d › d| d › d| d	 › d
| d › d�	ƒ | d dkrˆtd| d › dt› d�ƒ dS tdt› dt› dtdt  d›d�ƒ ztjtttdd�}W nV t	�y } z<tdt
|ƒj› dt|ƒd d… › �ƒ tdƒ W Y d }~dS d }~0 0 tdt |¡d d… ƒ | d¡�pT| d ¡�pNi  d¡}td!|ƒ |�srtd"ƒ dS t d#¡ z(t |t¡}td$t |¡d d%… ƒ W n> t	�yâ } z$td&|› d'|› d(�ƒ W Y d }~dS d }~0 0 td)ƒ dS )*NZbestAskzno book for z% -- market may have closed. Aborting.r   z
book: bid ZbestBidz / ask z	  (depth ZbidDepthú/ZaskDepthú)g333333ã?zask z! unexpectedly high vs sell price z -- refusing to send. Aborting.z
placing SELL_SHORT z @ z (cannot fill; max loss $z.2fz if it somehow did)ZORDER_INTENT_SELL_SHORT)Zintentz
REJECTED: z: iX  zv
=> Poly-US does NOT accept this sell form. The maker strategy would need the buy-the-other-side construction instead.r   z

ACCEPTED:iô  ÚidÚorderz	order id:z8
!! no order id in response -- CANCEL MANUALLY in the UIé   z
CANCELLED:i,  z!! CANCEL FAILED: z
!! CANCEL z MANUALLY IN THE UIzŒ
=> Poly-US accepts resting sells. A Poly-US market maker is viable, and on current numbers looks better than Kalshi on every measured axis.)ÚPZget_bboÚSLUGÚgetÚprintÚ
SELL_PRICEÚQTYÚTZplace_limit_orderÚ	ExceptionÚtypeÚ__name__ÚstrÚjsonÚdumpsÚtimeÚsleepZcancel_order)ÚbÚrÚeZoidÚc© r   ú'E:\soccer\research\polyus_sell_probe.pyÚmain,   sL    
ÿÿ
ÿ

ÿ
&"

r   Ú__main__)Ú__doc__r   Úsysr   ÚpathÚinsertZpoly_us_pricesr   Zpoly_us_traderr   r	   r   r   r   r   Úexitr   r   r   r   Ú<module>   s   .