Documentation Index
Fetch the complete documentation index at: https://mintlify.com/markzuckerbergas/gbmplus-api-python/llms.txt
Use this file to discover all available pages before exploring further.
gbm.tradingUSA provides access to the GBM+ Trading USA platform for buying US stocks. Unlike the Mexican market (gbm.orders), Trading USA orders reference instruments by instrument_id — an internal GBM identifier that must be fetched from getMarketsUSA() before placing an order. Order amounts are specified in MXN pesos and fractional purchases are supported. Access this module as gbm.tradingUSA on any GBMPlusAPI instance.
getMarketsUSA()
GET https://api.gbm.com/v1/markets/USA. Each instrument in the response includes a human-readable security_id (the stock ticker) and a GBM-internal instrument_id required when placing orders.
This endpoint returns a large dataset covering all available US instruments. The call may take several seconds to complete. Consider caching the result locally rather than calling
getMarketsUSA() before every order.security_id (ticker symbol) and instrument_id (GBM internal identifier).
Example:
generateOrderUSA(account_id, issuer, amount, instrument_id, order_type="buy")
POST https://api.trading-usa.gbm.com/v1/orders/contracts/{main_contract_id}/accounts/{account_id}/orders. The order is always submitted as a market order (order_type: "market") internally; the order_type parameter on this method controls the trade direction ("buy" or "sell").
You must retrieve
instrument_id via getMarketsUSA() before calling this method. The instrument_id is a GBM-internal identifier and is not the same as the stock ticker.The
account_id of your Trading USA strategy. Retrieve this from gbm.accounts.getAccounts() — use the account whose name corresponds to your Trading USA strategy. This is not legacy_contract_id.The stock ticker symbol, e.g.
"AMZN", "AAPL", or "TSLA". Sent to the API as security_id.The amount in MXN pesos to invest. Fractional shares are supported — you do not need to specify a whole number of units.
The GBM-internal instrument identifier for the stock. Must be retrieved from
getMarketsUSA() prior to calling this method.Trade direction. Use
"buy" (default) to purchase the instrument or "sell" to sell. Sent to the API as side.getOrdersUSA(account_id)
GET https://api.trading-usa.gbm.com/v1/orders/contracts/{main_contract_id}/accounts/{account_id}/orders.
The
account_id of the Trading USA strategy whose order history you want to retrieve.For a complete end-to-end example including market lookup and order placement, see Trading USA Example. To understand the
account_id identifier used throughout this module, see the Accounts reference.