Architect Documentation
  • User Guide
  • SDK Documentation
  • Algos Book
  • Architect Add-In For Excel
  • Introduction
  • Creating an API key
  • Getting started with Python
  • Getting started with Rust
  • Concepts
    • Symbology
    • Orderflow
    • Accounts and portfolio management
    • Systems and connectivity diagram
    • Authentication
    • Pagination
  • SDK Reference
    • Symbology and instrument info
    • Marketdata
    • Order entry
    • Portfolio management
    • Connection management
Powered by GitBook
On this page
  • Place limit order
  • Order request fields
  • Order types
  • Time-in-force instructions
  • Cancel order
  • Cancel all orders
  • Orderflow channel
  • Stream orderflow
  • Get open orders
  • Get historical orders
  • Get fills
  • Fill IDs
  1. SDK Reference

Order entry

PreviousMarketdataNextPortfolio management

Last updated 7 days ago

Place limit order

Place a limit order for a tradable product. If an execution venue isn't specified, the default venue for the symbol will be used. Depending on the time-in-force instruction, the order may require additional parameters.

from decimal import Decimal
from architect_py import OrderDir

order = await client.place_limit_order(
    symbol="BTC Crypto/USD",
    execution_venue="COINBASE",
    account=None,                   # required for some venues
    dir=OrderDir.BUY,
    quantity=Decimal(1),
    limit_price=Decimal(10000),
    post_only=True,                 # optional
)

print(order.status)

Order request fields

Field
Required
Description

id

N

Order ID to assign to the order; if not specified, the Architect OEMS will assign one randomly.

symbol

Y

Tradable product

dir

Y

Order side; BUY or SELL

quantity

Y

Order quantity

trader

N

Trader effecting the order; if not specified, Architect uses the logged-in user

account

N

Account for the order; if not specified, Architect will use the trader's default account configured for the execution venue.

order_type

Y

Order type

limit_price

N*

Required for certain order types

post_only

N*

Required for certain order types

trigger_price

N*

Required for certain order types

time_in_force

Y

Order time-in-force instruction

execution_venue

N

Execution venue for the order; if not specified, Architect will use the primary venue for the symbol.

Order types

Order type
Description
Required fields

LIMIT

Limit order; execute no worse than the limit price specified.

  • limit_price

  • post_only: only place the order if it would rest in the book; do not take

STOP_LOSS_LIMIT

Stop-limit order; if the trigger price is breached, place a limit order at the price specified.

  • limit_price

  • trigger_price

TAKE_PROFIT_LIMIT

Take-profit order; if the trigger price is breached, place a limit order at the price specified.

  • limit_price

  • trigger_price

Time-in-force instructions

TIF instruction
Description

GTC

Good-til-cancel

GTD

Good-til-date; datetime must be specified

DAY

Day order

IOC

Immediate-or-cancel

FOK

Fill-or-kill

ATO

At-the-open

ATC

At-the-close

Cancel order

Request to cancel an order by order ID. Cancel requests are asynchronous and return immediately. The order is canceled when the exchange confirms the cancellation.

A working order is only canceled when the exchange confirms the cancellation, which can be checked by polling the order status.

cancel = await client.cancel_order("12345678-1234-5678-1234-567812345678:0")  

print(cancel.status)

Cancel all orders

Request to cancel all orders matching the selectors.

await client.cancel_all_orders(execution_venue="CME")

Orderflow channel

The most efficient way to trade using the Architect OEMS is to use the bidirectional orderflow channel. This is similar to a websocket or FIX session where one connection is opened and maintained for an entire trading session. The client will send place order and cancel order requests and receive order status updates and fills in realtime.

The specific mechanics of using the orderflow channel depend on the specific language SDK's implementation.

Example coming soon

Stream orderflow

Subscribe to orderflow events, order status updates, fills from the Architect OEMS. The events streamed are the same as those received by the orderflow bidirectional channel.

async for event in client.stream_orderflow():
    print(event)

Get open orders

Get all open orders matching the selectors.

orders = await client.get_open_orders()

for order in orders:
    print(order.id)

Get historical orders

Get all historical orders (orders whose statuses are not PENDING nor OPEN) matching the selectors. If order_ids is not specified, then from_inclusive and to_exclusive are required.

orders = await client.get_historical_orders()

for order in orders:
    print(order.id)

Get fills

Get all fills matching the selectors.

res = await client.get_fills()

for fill in res.fills:
    print(fill.id)

Fill IDs

Architect attempts to uniquely identify fills, executions, or trades across all venues. They are typically UUIDv5s which are derived from exchange fill IDs and other characteristics of the fill necessary to make the identifications unambiguous.

See for a more comprehensive example.

Order entry
Place limit order
Order request fields
Order types
Time-in-force instructions
Orderflow channel
Stream orderflow
Cancel order
Cancel all orders
examples/orderflow_streaming.py