Appearance
Usage Patterns
Strategy Bootstrapping
python
from aqc_trading_sdk import TradingClient
client = TradingClient(strategy_id="AQC-P1A2B3C4")
# Readiness check
status = client.get_connection_status()
if not status["broker_ready"]:
raise RuntimeError("Broker not ready")
account = client.get_account()
positions = client.get_positions()Signal to Order
python
price = client.get_price("AAPL")
if price and price < 150:
client.buy_limit("AAPL", 10, price=149.50)Batch Market Data
python
quotes = client.get_tickers("SPY", "QQQ", "GLD")
for q in quotes:
print(f"{q.symbol}: ${q.last}")Options Selection by Delta
python
opt = client.get_option_by_delta(
symbol="SPX",
expiry="20250115",
target_delta=-0.35,
right="P",
trading_class="SPXW"
)
if opt:
client.place_order(
symbol="SPX",
quantity=1,
side="SELL",
order_type="MKT",
conid=opt["conid"]
)Bracketed Entry
python
client.place_bracket_order(
symbol="AAPL",
quantity=10,
side="BUY",
entry_price=150.0,
stop_loss=145.0,
take_profit=160.0,
force=True
)Trailing Stop
python
# Protect a long position with $2 trailing stop
client.sell_trail("SPY", 100, trail_amount=2.00)Multi-Leg Sequencing
python
# Place first leg, wait for acknowledgment, then place second
result = client.place_order(symbol="SPX", quantity=1, side="SELL", ...)
if result.success and result.order_id:
if client.wait_for_submitted(result.order_id, timeout=15):
client.place_order(symbol="SPX", quantity=1, side="BUY", ...)Async Strategy
python
import asyncio
from aqc_trading_sdk import AsyncTradingClient
async def run_strategy():
client = AsyncTradingClient(strategy_id="AQC-P1A2B3C4")
quote = await client.get_quote("SPY")
positions = await client.get_positions()
if quote.last < 700:
await client.buy_market("SPY", 10)
await client.close()
asyncio.run(run_strategy())Streaming Quotes
python
import asyncio
async def on_quote(data):
print(data)
asyncio.run(client.stream_quotes(["AAPL", "SPY"], on_quote))