Managing Orders

The TradeClient supports three order management commands:

Scheduling a Trade Updating a Trade Cancelling a Trade


3.1 Scheduling a Trade

Method: submit_trade(payload: dict) -> dict

Schedules a trade order for future execution.

Parameters

Parameter
Type
Description

symbol

str

Trading symbol (e.g., "AAPL")

quantity

float

Number of shares

side

str

"buy" or "sell"

time_in_minutes

int

Time delay for execution (minutes)

Example Usage

from blockhouse import TradeClient
client = TradeClient("your_api_key")

payload = {
    "symbol": "AAPL",
    "quantity": 100,
    "side": "buy",
    "time_in_minutes": 30
}
response = client.submit_trade(payload)
print(response)

3.2 Updating a Trade Order

Method: update_trade(payload: dict) -> dict

Updates an existing scheduled order.

Example Usage

from blockhouse import TradeClient
client = TradeClient("your_api_key")

payload = {
    "order_id": "12345",
    "symbol": "AAPL",
    "quantity": 150,
    "side": "buy",
    "time_in_minutes": 45
}
response = client.update_trade(payload)
print(response)

3.3 Cancelling a Trade Order

Method: cancel_trade(order_id: str) -> dict

Cancels a scheduled trade order.

Example Usage

from blockhouse import TradeClient
client = TradeClient("your_api_key")

response = client.cancel_trade("12345")
print(response)

Last updated