我爱编程

Trading-Objects-and-Constants

2017-12-27  本文已影响0人  yzw0921

:chart: All content on this page is relevant for [[Trading Terminal]] only.

NOTE: If you use TypeScript - you can import this constants/interfaces/types from broker-api.d.ts file.

Broker Configuration

configFlags: object

This is an object that should be passed in the constuctor of the Trading Terminal to [[brokerConfig|Widget-Constructor#brokerConfig]]. Each field should have a boolean value (true/false):

durations: array of objects

List of expiration options of orders. It is optional. Do not set it if you don't want the durations to be displayed in the order ticket.
The objects have two kes: { name, value }.

Example:

durations: [{ name: 'DAY', value: 'DAY' }, { name: 'GTC', value: 'GTC' }]

customNotificationFields: array of strings

Optional field. You can use it if you have custom fields in orders or positions that should be taken into account when showing notifications.

For example, if you have field additionalType in orders and you want the chart to show a notification when it is changed, you should set:

customNotificationFields: ['additionalType']

Order

Describes a single order.

Position

Describes a single position.

Trade

Describes a single trade (individual position).

Execution

Describes a single execution. Execution is a mark on a chart that displays trade information.

ActionMetainfo

Describes a single action to put it into a dropdown or a context menu. It is a structure.

OrderType

Number constants to describe an order status.

OrderType.Limit = 1
OrderType.Market = 2
OrderType.Stop = 3
OrderType.StopLimit = 4

Side

Number constants to describe an order/execution side.

Side.Buy = 1
Side.Sell = -1

ParentType

Number constants to describe a bracket owner.

ParentType.Order = 1
ParentType.Position = 2

OrderStatus

Number constants to describe an order status.

OrderStatus.Canceled = 1 # order is canceled
OrderStatus.Filled = 2 # order is fully executed
OrderStatus.Inactive = 3 # bracket order is created but waiting for a base order to be filled
OrderStatus.Placing = 4 # order is not created on a broker side yet
OrderStatus.Rejected = 5 # order is rejected for some reason
OrderStatus.Working = 6 # order is created but not executed yet

OrderDuration

Duration or expiration of an order.

DOMEObject

Object that describes a single DOME response.

DOMELevel

Single DOME price level object.

OrderTicketFocusControl

Number constants to set focus when you open standard Order dialog or Position dialog.

OrderTicketFocusControl.StopLoss = 1 # focus stop loss control
OrderTicketFocusControl.StopPrice = 2 # focus stop price for StopLimit orders
OrderTicketFocusControl.TakeProfit = 3 # focus take profit control

Brackets

stopLoss: double

takeProfit: double

Formatter

An object with format method that can be used to format number to string.

上一篇下一篇

猜你喜欢

热点阅读