Orders

Order Endpoints

Important

The user is limited to 10 orders per minute, with a refresh at the start of each new minute. The SDK will automatically handle this.

Client.place_order(id: str, price: float, qty: int = 1, side: str = 'buy', phase: str = 'ipo', **kwargs) Union[jockmkt_sdk.objects.Order, Dict]

Places an order of the user’s chosen tradeable (player) and the chosen price. It defaults to buy 1 share during the ipo phase. The user may specify an amount of money they want to buy and automatically buy x shares at the chosen price (param: order_size), such that the total cost is less than their specified amount. If the user wants to make a live they must specify phase=’live’, or if they want to sell a share side=’sell’.

Parameters
  • id (str, required) – The chosen player’s tradeable id, obtained by calling a Tradeable object

  • price (int, required) – The user’s chosen price at which to place their order

  • side (str, optional) – default: ‘buy’ - the user must specify ‘sell’ if they wish to sell

  • phase (str, optional) – default: ‘ipo’ - If the Event.status is ‘ipo’, should be ipo, else specify ‘live’

  • qty (int, optional) – default: 1 - The desired number of shares the user wants to buy, the user may specify order_size instead.

  • order_size (int, optional) – The user can specify the total amount they wish to spend on shares of a player. Calculated by: (order_size)//price (it will always round down)

Returns

A json response with information about the order that was sent

Example:

tradeable = client.get_event_tradeables(event_id)[0] #the first tradeable in the list
client.place_order(id=tradeable.id, price=5, side='buy', phase='ipo', order_size=50)
# Side must either be 'buy' or 'sell'
# Phase must either be 'live' or 'ipo'
# param qty is an int, number of shares the user wants to buy
# OR order_size is an int, max amount of money the user wants to spend
# such that: quantity = order_size // price

Raises error if the tradeable id is incorrect, or if the user hits the rate limit

Returns status of the order being placed

Client.get_orders(start: int = 0, limit: int = 100, event_id: Optional[str] = None, active: bool = False, updated_after: Optional[int] = None, include_count=False) Union[List[jockmkt_sdk.objects.Order], Tuple[List[jockmkt_sdk.objects.Order], int]]

Get all of a user’s orders. The user is required to paginate if they want to see more than 1 page

Parameters
  • start (int, optional) – Page at which the user wants to start their search, default: 0 (first page of entities)

  • limit (int, optional) – Number of entities the user wants to display, default: 100 (displays 100 entities)

  • event_id (str, optional) – the event_id for your chosen event, (e.g. evt_60dbec530d2197a973c5dddcf6f65e12)

  • active (bool, optional) – Whether to display only orders that are active (either created or accepted), default = False

  • updated_after (int, optional) – filter orders updated after 13 digit epoch timestamp (orders with fills, partial fills, cancellations, outbids, etc. after that time)

  • include_count (bool, option) – Include the number of TOTAL orders in the return value.

Returns

a list of objects.Order objects | a tuple of a list of objects.Order and an int representing total order count.

Return type

objects.Order

Returns a list of objects.Order objects

Client.get_order(order_id: str) jockmkt_sdk.objects.Order

get information about a specific order

Parameters

order_id (str, required) – Order id for which the user is searching (e.g. ord_601b5ad6538ec34875ee1687c4a657f8)

Returns

objects.Order

Return type

Order

Returns a single objects.Order

Client.delete_order(order_id: str) Dict

delete a specific order

Parameters

order_id (str, required) – order id for which the user is attempting to delete (e.g. ord_601b5ad6538ec34875ee1687c4a657f8)

Returns

json response with information about the order deletion

Can only be used if the order was placed during live trading. Will return information about whether the cancellation was successful

Order Objects

class jockmkt_sdk.objects.Order(order: dict)

object dedicated to storing information about orders that the user has placed

Variables
  • account – The account associated with the order, only available from event_activity endpoint from ws feed.

  • order_id – the order’s specific identification

  • tradeable_id – the tradeable that the order was placed for

  • entity_id – the underlying entity_id for which the order was placed

  • event_id – the event in which the order was placed

  • status – current status, one of: created, accepted, filled, outbid, cancelled, or expired

  • side – side of the order (buy or sell)

  • phase – phase during which the order was placed (live or ipo)

  • quantity – amount of shares the user wants to buy

  • limit_price – the price the user specified in their order

  • cost_basis – how much the user spent on shares (only present on buy orders)

  • fee_paid – sum of fees paid for the order

  • proceeds – how much the user received for their sell order (if it was a sell order)

  • filled_quantity – quantity of shares that have been filled,

  • created_at – timestamp at which the order was created

  • accepted_at – timestamp at which the order was accepted

  • updated_at – timestamp at which the order last updated (some shares bought or sold)

  • filled_at – time at which the order was completely filled

  • cancellation_requested_at – when a cancellation was requested

class jockmkt_sdk.objects.PublicOrder(order: dict)

Public order object for use with websockets

Variables
  • user_id – the user’s unique identifier

  • user_tags – the user’s tags (if they are a marketmaker, etc.)

  • username – the user’s display name

  • member_since – when the user joined

  • event_id – the event id to which this order applies

  • tradeable_id – the player who is being traded’s event-specific id

  • entity_id – the player’s global JM identifier

  • side – the side of the order (buy or sell)

  • phase – the phase in which the order was placed (ipo or live)

  • created_at – when the order was created

class jockmkt_sdk.objects.Trade(trade)

Public trade info including price and quantity. Available only with websockets.

Variables
  • trade_id – The id of the trade

  • price – The price at which the trade went through

  • quantity – The size of the trade

  • tradeable_id – The id of the player stock that was traded

  • created_at – Time at which the order went through