Send a trading agent's decisions to Borro on Robinhood Chain: spot buy and sell, short, cover and lend tokenized stocks against USDG. Adapters for TradingAgents and ai-hedge-fund.
pip install borro-live==0.2.0 Copy PIP instructions
borro-live sends a trading agent's decisions to Borro for real: buy, sell, short, cover and lend tokenized stocks against USDG on Robinhood Chain. It comes with adapters for TradingAgents and ai-hedge-fund, which decide and simulate but place no orders.
It is a small Python package: one dependency (eth-account), no framework imported unless you have it. It talks to Borro's public MCP server (https://borro.markets/mcp, no key), which builds each transaction and simulates it; the package checks the simulation, signs with your agent's own key and sends through your own RPC.
pip install borro-live # or, from a clone: pip install -e . Three environment variables:
export BORRO_AGENT_KEY=0x... # the agent's own wallet key. Use a fresh wallet with little in it. export BORRO_RPC_URL=https://... # your own Robinhood Chain RPC (chain id 4663). There is no built-in one. export BORRO_LIVE=1 # leave this out until you mean it To try it with no key at all, set BORRO_WALLET=0x... to any address in place of BORRO_AGENT_KEY: every order is then a dry run simulated from that address, and nothing can be sent. A simulation passes only if that address holds the USDG the order needs.
Dry run (leave BORRO_LIVE out). It prints Borro's simulation of every step and sends nothing:
borro-live tickers borro-live buy NVDA 5 # a spot buy: 5 USDG of NVDA into the wallet borro-live positions Live. The wallet needs USDG for the order and a little ETH for gas:
BORRO_LIVE=1 borro-live buy NVDA 5 --live BORRO_LIVE=1 borro-live sell NVDA --live Each live order prints every transaction hash. A dry run needs no RPC and no key at all: borro-live buy NVDA 5 --wallet 0xYourAddress.
TradingAgentsGraph.propagate(ticker, date) returns (final_state, signal), where the signal is Buy, Overweight, Hold, Underweight or Sell (or REVIEW when the run reached no rating). One line wraps it:
from tradingagents.graph.trading_graph import TradingAgentsGraph from tradingagents.default_config import DEFAULT_CONFIG from borro_live import Broker from borro_live.tradingagents import go_live ta = go_live(TradingAgentsGraph(config=DEFAULT_CONFIG.copy()), Broker.from_env(), usdg=5) _, decision = ta.propagate("NVDA", "2026-09-01") print(decision, ta.borro_orders, ta.borro_error) propagate answers exactly as before. What the adapter does with each rating:
Without the graph: borro_live.tradingagents.execute(broker, "NVDA", "Buy", usdg=5). Runnable: python examples/tradingagents_example.py NVDA --decision Buy.
The portfolio manager's decisions ({ticker: {"action": "buy" | "sell" | "short" | "cover" | "hold", "quantity": shares}}, what run_hedge_fund returns under "decisions") go straight in:
from borro_live import Broker from borro_live.ai_hedge_fund import execute_decisions results = execute_decisions(Broker.from_env(), result["decisions"], scale=0.01) scale multiplies every quantity, since the model sizes in whole shares for a paper portfolio and the caps here are in USDG. Pick it so the largest order lands under your per-order cap (10 USDG unless you raise it): an order over the cap is refused, not shrunk. A sell sells that many shares of what the wallet holds, or all of it when it holds fewer. Each ticker gets its own answer; one refusal never stops the others. Runnable: python examples/ai_hedge_fund_example.py --buy NVDA 3.
The v2 engine (hedge_fund/, the aihf package) has a Broker protocol instead: positions(), cash() and place_order(order), whole shares on a signed book, fill completely or raise. borro_live.ai_hedge_fund.BorroBroker satisfies it. The engine's own commands use its simulated and paper brokers and take no other, so you call advance yourself and keep the state it hands back:
from hedge_fund.fund import Fund, load_spec from hedge_fund.pipeline.session import FundState, advance, next_state from borro_live import Broker from borro_live.ai_hedge_fund import BorroBroker broker = BorroBroker(Broker.from_env(max_order_usdg=500, max_day_usdg=2000), simulate_fills=True) # a dry run fund = Fund(load_spec("fund.yaml")) state = FundState.initial(broker.cash()) # the fund starts from what the wallet holds for session in sessions: # completed sessions, oldest first record = advance(fund, state, session, broker, data_client, universe) state = next_state(state, record) The engine's own data client needs its own key (FINANCIAL_DATASETS_API_KEY, or a wallet that pays per call through x402). borro-live gives the engine no market data, and data_client above is yours to supply.
Treat this adapter as experimental. What it does, and where it stops:
How far the engine's ledger reconciles. Before each session the engine checks that the broker holds exactly the whole shares, and the cash to the cent, that its last record says. A long-only fund on the fork test passed that check on four sessions a day apart: a day on, cash was the same to six decimals and every holding was within 0.001 of a whole share. A stock token held in the wallet does not move between sessions: nothing is lent and nothing is owed. Two things still break the check:
What was tested, and how: the unit tests, and three steps of the fork test that run the engine itself (Fund, advance, build_orders and reconcile at commit 5c553b5, version 2.7.2) with BorroBroker on a local fork: a dry run with simulated fills, four live sessions a day apart (buys, a trim, a close) and a short. Two stand-ins were used there: daily bars from Yahoo through yfinance in place of the engine's data client, and a stub analyst with set convictions in place of a model. Not tested: the engine's own data client, a model deciding the orders, minute funds, long-short mandates, and anything on Robinhood Chain itself. Those fork steps sent nothing to the real chain.
What a spot order costs. Each buy and each sell is one swap. Borro's fee comes out of the USDG inside the swap, and the pools take their own. Every answer's quote shows the fee (fee_usdg, fee_bps), the price the order really gets with the fees in it (average_price_usd), how far that is from Borro's price (vs_feed_pct) and the least the order accepts (least_accepted_stock or least_accepted_usdg). On the fork test, buying 5 USDG of NVDA and selling it again brought back 4.87 USDG. A swap is exact in: all of the USDG (or all of the shares) is spent, and at least the quote less the slippage allowed arrives (half a percent; Broker(slip_bps=...) changes it), or the swap reverts and nothing is spent.
The steps you sign. A spot order is up to three transactions: the token's approval to Permit2 (Uniswap's approval contract) for exactly the amount, Permit2's allowance for Uniswap's Universal Router for exactly the amount (it lapses after 30 minutes), then the swap. The kit refuses a spot order whose steps go anywhere else.
What is in the wallet is yours to move. A token buy bought sits in the wallet and earns nothing there. lend lends it on Borro, where it earns lending fees; stock that is lent is no longer in the wallet, so sell does not see it until you take it back on Borro.
Coming from 0.1. Before 0.2.0 Borro's MCP server had no spot tools, so buy opened a leveraged long at 1.01x and sell closed it. 0.2.0 needs a server that lists buy_stock and sell_stock; against one that does not, buy and sell raise SpotUnavailable and send nothing. A long opened by an older version is still there: positions()["longs"] lists it, and close_long (or borro-live close-long NVDA) closes it. sell does not touch it, and BorroBroker does not count it. Broker(leverage=...) is gone.
short deposits 1 USDG for each USDG shorted by default (short_deposit=1.0), and never less than a tenth over the least Borro asks. At that default a short is closed for you after a rise of roughly half; the quote in every answer gives the exact price (closed_for_you_at_price). A thinner deposit is closed sooner.
Borro shares its own fees with whoever brings the business (the Bookrunners programme). Give the broker a code and installs that carry it pay the code's owner:
Broker.from_env(builder_code="yourcode") # or BORRO_BUILDER_CODE=yourcode The wallet is bound to the code once, with one free signature (bind_builder, no transaction). From then on the code earns Borro's fee on the interest that wallet pays when it borrows (its shorts). A spot buy or sell borrows nothing, so it earns the code nothing. Lends go through the BorroBuilders contract with the code, so the code earns Borro's fee on what those deposits earn. The wallet keeps its vault shares. The share is all of Borro's fee for 12 months, half after, paid monthly in USDG to the wallet that registered the code. The user pays nothing extra. Fees float with demand: with no borrowing there is no fee to share. Register a code with your own wallet at borro.markets/bookrunners. First come, first served; only that wallet can move it. One code per wallet: the first binding stands. There is no default code. If you ship this in a framework, set yours.
python -m unittest discover -s tests -p 'test_unit.py' # 71 tests against recorded MCP answers, no network Borro also runs the kit end to end on a local fork of Robinhood Chain in its own repository: a dry run, a live spot buy, lend, short, cover and spot sell, both adapters, the caps, a builder code, and ai-hedge-fund's engine for four sessions. It reads the chain to check that a buy takes exactly the order's USDG and leaves the stock token in the wallet. BORRO_MCP_URL points the client at another MCP address, which is how that test reaches its local server.
walk.sh is the one real walk: one small live order per framework from a funded wallet. It asks before it sends.
Options, perps and Borro's dark pool are not part of this kit.
borro robinhood-chain tradingagents ai-hedge-fund mcp agents
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




