Orders

The open orders feed tracks updates to all of your users' open orders.

An update from this feed will include the user_id of the user to identify which user's account the update is for, as well as, the latest information for 1 or more open orders in the account.

Subscription Instructions

Feed Name

private.enterprise.users.open-orders

Order Object

Order updates received will include the following object per order:

Field
Type
Description

id

int

sFOX-generated order ID, assigned on order creation.

action

string

Order side. Possible values: buy (buy order), sell (sell order)

algorithm_id

int

Order type / algorithm ID. Possible values: Order Types & Algorithms.

type

string

Order type / algorithm name. Possible values: Order Types & Algorithms.

pair

string

Pair or product in the format basequote . e.g. btcusd, ethbtc, ethusdc

quantity

number

Order size in base currency quantity.

price

number

Order limit price.

amount

number

Amount (quote currency) to spend when buying.

net_market_amount

number

amount net fees for Market (100) orders.

filled

number

Unsigned, cumulative base currency quantity filled.

vwap

number

Cumulative volume-weighted average fill price of the order.

filled_amount

number

Unsigned, cumulative quote currency amount filled.

fees

number

Unsigned, cumulative quote currency fee amount accrued to this order.

net_proceeds

number

Signed, cumulative quote currency proceeds amount net fees.

status

string

Status name. Possible values: Order Statuses.

routing_option

string

Special order routing instructions.

routing_type

string

Order routing type.

time_in_force

string

Order time in force specified at order creation.

expires

datetime

Expiration date of the order (for time_in_force = GTD orders)

dateupdated

datetime

Date of the most recent update to this order.

date_added

datetime

Date the order was created.

client_order_id

string

User-specified ID for this order.

algorithm_options

string[]

Additional object specifying special order parameters.

destination

string

Order destination.

Order Statuses

Orders may have any of the following statuses.

Status
Status Code
Description

Started

100

  • The order is open and active

  • Filled quantity may be >= 0

  • Filled quantity is < the order quantity

Cancel Pending

90

  • The order is in the process of being canceled but cancellation has not been completed

  • The order may still receive fills

Canceled

10

  • The order was successfully canceled

  • Order may have been partially filled prior to cancellation

Filled

210

  • The order has fully filled

  • The order has not yet settled

Done

300

  • The order was is completed, no longer active, and settled successfully

  • Filled quantity = order quantity

  • The order will not receive new fills

Example Code

const WebSocket = require('ws')

const ws = new WebSocket('wss://ws.sfox.com/ws')

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: `${process.env.ENTERPRISE_API_KEY}`,
   enterprise: 'true'
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to user open orders feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['private.enterprise.users.open-orders']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated