Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Message DirectionFormatBodyAdditional info (possible values)Example(Multi-leg)Example(Limit)
RequestJSON
Code Block
languagejs
{
	ticket:string,
	accountId:int,
	order:
	{
		Id:int,
		* SecurityId:int,
		* Quantity:double,
		* Type:int,		
		* Side:int,
		Price:double,
		StopPrice:double,
		Comment:string,
		TimeInForce:int,
		ExpireDate:int,
		AllOrNone:bool,
		Exchange:string
		TrailingStopAmountType:int,
		TrailingStopAmount:double,
		TrailingLimitAmountType:int
		TrailingLimitAmount:double 
		Legs: [order],
		ExtendedHours: string
		Contingent: 
		{
			PriceType: string,
			Direction: string,
			Threshold: double,
			SecurityId: int
		}
		"ExecutionInstructions":
[
			{
				"Key": "PerTradeCommission",
				"Value": "2.22"double
			},
			{
				"Key": "PerContractComission",
				"Value": "1.11"double
			}
		]

{







}



	}
}
* field is required

public enum OrderTrailingType
{
Absolute,
Persentage
}

 

Contingent:

PriceType values:

  • Ask
  • Bid
  • Last
Direction values:
  • Gt
  • Lt
ExtendedHours:
  • PRE
  • POST
  • ALL
  • REGPOST
  • PREREG
  • PREPOST

 

Trailing:
  • AmountType:

    0 - for absolute value (price change)

    1 - for percentage changes

 

PerContractCommission is specified for all securities at once. For example, if you intend to purchase 100 Apple stocks and levy a 2-cent fee on each stock, the PerContractCommission should be set to "2" ($2 split between 100 stocks — 2 cents per stock).

PerTradeCommission is applied to the entire transaction.

 

 

{

 "accountId":140,

 "executionTarget":1,

"order":{

"TrailingLimitAmount":0,

"Legs":[

{

"Quantity":100,

"Side":0,

"SecurityId":5,

"AllOrNone":0,

"Id":0

},

{

"Quantity":1,

"Side":0,

"SecurityId":738931,

"AllOrNone":0,

"Id":0

},

{

"Quantity":1,

"Side":4,

"SecurityId":738930,

"AllOrNone":0,

"Id":0

}

],

"Price":0,

"StopPrice":0,

"Type":0,

"AllOrNone":0,

"Exchange":"Auto",

"TrailingStopAmount":0,

"TimeInForce":0

}

}
{

"executionTarget":1,

"accountId":263,

"order":{

"Price":115.74,

"Exchange":"Auto",

"TrailingLimitAmount":0,

"AllOrNone":0,

"TrailingStopAmount":0,

"Type":1,

"Quantity":100,

"SecurityId":4,

"Side":0,

"TimeInForce":0,

"StopPrice":0

}

}
ResponseJSON
{   
 ResponseCode:int, 
 ticket:string,
 result:int
}
Where 'result' is your OrderId

Verification Order Errors 

  

...

Message DirectionHeadersFormatBodyAdditional info (possible values)Example
Request
  • x-api-key
  • x-api-routing
  • Content-Type: application/json
  • Accept: */*
 JSON
  • {
    • ticket:string,
    • accountId:int,
    • "order":
    • {
      • Id:int, SecurityId:int,
      • Quantity:double,
      • Price:double,
      • StopPrice:double,
      • Side:int,
      • Type:int,
      • Comment:string,
      • TimeInForce:int,
      • ExpireDate:int,
      • TrailingStopAmountType:int,
      • TrailingStopAmount:double,
      • TrailingLimitAmountType:int
      • TrailingLimitAmount:double
      • Contingent:
      • {
        • PriceType: string,
        • Direction: string,
        • Threshold: double,
        • SecurityId: int
      • }
      • "ExecutionInstructions" : 
      • [
        {
        "Key": "PerTradeCommission",
        "Value": "2.22"double
        },
        {
        "Key": "PerContractComission",
        "Value": "1.11"double
        }
        ]

    • }
  • }

Side: 

  • Buy = 0,

  • Sell=1,

  • SellShort=4,

  • BuyToCover=9

Type: 

  • Market = 0,

  • Limit = 1,

  • Stop = 2,

  • StopLimit = 3,

  • Pegged = 14,

  • TrailingStop = 19,

  • TrailingStopLimit = 20,

  • OneCancelOther = 21,

  • OneTriggerOther = 22,

  • External = 23

SecurityId - the internal security identifier

TimeInForce:

  • Day=0,

  • GoodTillCancel=1,

  • AtTheOpening=2,

  • ImmediateOrCancel=3,

  • FillOrKill=4,

  • GoodTillCrossing=5,

  • GoodTillDate=6

Contingent:

PriceType values:

  • Ask

  • Bid

  • Last

Direction values:

  • Gt

  • Lt

PerContractCommission is specified for all securities at once. For example, if you intend to purchase 100 Apple stocks and levy a 2-cent fee on each stock, the PerContractCommission should be set to "2" ($2 split between 100 stocks — 2 cents per stock).

PerTradeCommission is applied to the entire transaction.
{
 "ticket":"YOURTICKETHERE",
 "accountId":"INTERNALACCOUNTIDHERE",
 "order":
    {
    "Price":115.74,
    "Exchange":"Auto",
    "TrailingLimitAmount":0,
    "AllOrNone":0,
    "TrailingStopAmount":0,
    "Type":1,
    "Quantity":100,
    "SecurityId":4,
    "Side":0,
    "TimeInForce":0,
    "StopPrice":0
    }
}
Response  JSON
  • ResponseCode":"int", 0 - success

  • "Ticket":"string",

  • "Result":"result", - orderId number
 

 

...