Declaration |
Visual Basic |
Sub OpenTradeELS (wcsAccountID as String, wcsInstrument as String, bIsBuy as Boolean, iAmount as Integer, dRate as Double, wcsQuoteID as String, iAtMarket as Integer, iSLType as Integer, dStop as Double, dLimit as Double, iTrailMinMoveStop as Integer, iTrailMinMoveLimit as Integer, iTIFType as Integer, ByRef Result as Variant) |
|
IDL |
[id(433)] HRESULT OpenTradeELS( |
[in]BSTR sAccountID, [in]BSTR sInstrument, [in]VARIANT_BOOL bBuy, [in]int iAmount, [in]double dRate, [in]BSTR sQuoteID, [in]int iAtMarket, [in]int iSLFlag, [in]double dStop, [in]double dLimit, [in]int iTrailMinMoveStop, [in]int iTrailMinMoveLimit, [in]int iTIFType, [out]VARIANT *pvResult);) |
|
Visual Basic |
Sub OpenTradeELSAsync (wcsAccountID as String, wcsInstrument as String, bIsBuy as Boolean, iAmount as Integer, dRate as Double, wcsQuoteID as String, iAtMarket as Integer, iSLType as Integer, dStop as Double, dLimit as Double, iTrailMinMoveStop as Integer, iTrailMinMoveLimit as Integer, iTIFType as Integer, ByRef psBatchId as Variant, ByRef pvRequestIDList as Variant) |
|
IDL |
[id(435)] HRESULT OpenTradeELSAsync( |
[in]BSTR sAccountID, [in]BSTR sInstrument, [in]VARIANT_BOOL vbBuy, [in]int iAmount, [in]double dRate, [in]BSTR sQuoteID, [in]int iAtMarket, [in]int iSLType, [in]double dStop, [in]double dLimit, [in]int iTrailMinMoveStop, [in]int iTrailMinMoveLimit, [in]int iTIFType, [out]VARIANT *psBatchId, [out]VARIANT* pvRequestIDList) |
|
Parameters |
wcsAccountID |
The identifier of the account. The account must exist in the accounts table. Use
the AccountID column to get the identifier of the account. |
wcsInstrument |
The instrument the trade must be opened in. The value must be one of the values of the Instrument
column of the offers table. The offers of the instrument must be subscribed. |
bIsBuy |
The flag indicating whether the trade must be opened using the
buy order (True , long position) or sell order (False , short position). |
iAmount |
The amount of the order.
Please note that limitations on the amount might be applicable:
- Amount must be equal to or greater than the value of the
BaseUnitSize ,
which can be retrieved using TradingSettingsProviderAut.GetBaseUnitSize method
of TradingSettingsProviderAut interface.
- Amount must be divisible by the value of the
BaseUnitSize ;
- Amount must not be greater than the value of the
AmountLimit in "Accounts" table.
- Amount must be between
Minimum Quantity and Maximum Quantity values,
which can be retrieved using TradingSettingsProviderAut.GetMinQuantity
and TradingSettingsProviderAut.GetMaxQuantity methods of
TradingSettingsProviderAut interface.
All these limitations except BaseUnitSize can be zero. Zero value means that the limitation for that specific parameter is not applied at all. |
dRate |
The rate at which it is desired to open the trade. The rate must be taken from the offers table.
Specify 0 to open the trade at the available market price. |
wcsQuoteID |
The identifier of the quote the rate value is taken from. The value can be obtained from the QuoteID column
of the offers table. In case the rate equals 0, this parameter must be an empty string. |
iAtMarket |
The distance in pips from the specified rate within which the trade can be opened at the market price in case
market moved at the moment of the order's execution.
If the dRate parameter is a certain rate, specify 0 to open the trade exactly at the specified rate.
If the dRate parameter is 0 , specify 0 to open the trade at the available market price. |
iSLType |
The type of the associated secondary stop and limit orders. The value defines interpretation of dStop and dLimit parameters.
Can be combination of the following values:
TradeDeskAut.SL_NONE
|
Use this value in case neither the secondary stop nor secondary limit orders must be added. |
TradeDeskAut.SL_STOP
|
Use this value in case the secondary stop order must be added. |
TradeDeskAut.SL_LIMIT
|
Use this value in case the secondary limit order must be added. |
TradeDeskAut.SL_PEGSTOPOPEN
|
Use this value in case the secondary stop order must be the pegged stop order
and its offset must be added to the open price
(see Order Types for information
about pegged orders).
The offset is specified in pips.
For buy positions, the secondary stop order must be below open price minus current
spread, i.e. offset must be negative
and must be less than "-" spread.
For sell positions, the secondary stop order must be above open price plus current spread,
i.e. offset must be positive
and must be bigger than spread. |
TradeDeskAut.SL_PEGSTOPCLOSE
|
Use this value in case the stop order must be the pegged stop order and
its offset must be added to the close price
(see Order Types for information
about pegged orders). 'Close price' means the bid price at the moment of the long position opening (buy) and
the ask price at the moment of short (sell) position opening.
The offset is specified in pips.
For buy positions, a secondary stop order must be below close price,
i.e. offset must be negative.
For sell positions, a secondary stop order must be above close price,
i.e. offset must be positive. |
TradeDeskAut.SL_PEGLIMITOPEN
|
Use this value in case the secondary limit order must be the pegged limit order and
its offset must be added to the open price
(see Order Types for information
about pegged orders).
The offset is specified in pips.
For buy positions, a secondary limit order must be above the open price,
i.e. offset must be positive.
For sell positions, a secondary limit order must be below the open price,
i.e. offset must be negative. |
TradeDeskAut.SL_PEGLIMITCLOSE
|
Use this value in case the secondary limit order must be the pegged limit order and
its offset must be added to the close price
(see Order Types for information
about pegged orders). 'Close price' means the bid price at the moment of the long position opening (buy) and
the ask price at the moment of short (sell) position opening.
The offset is specified in pips.
For buy positions, a secondary limit order must be above the close price
plus current spread, i.e. offset must be positive
and must be bigger than spread.
For sell positions, a secondary limit order must be below the close price
minus current spread. i.e. offset must be negative
and must be less than "-" spread. |
You can concatinate these values using arithmetical addition. For example:
To set the secondary limit order only, specify in this parameter:
tradeDesk.SL_LIMIT
To set the secondary limit and the secondary stop orders, specify in this parameter:
tradeDesk.SL_LIMIT + tradeDesk.SL_STOP
To set the pegged secondary stop order the offset of which will be added to the open price,
specify in this parameter:
tradeDesk.SL_PEGSTOPOPEN
To set the pegged secondary stop order the offset of which will be added to the close price
and the secondary limit, specify in this parameter:
tradeDesk.SL_LIMIT + tradeDesk.SL_PEGSTOPCLOSE |
dStop |
The rate or the offset in pips for the secondary stop order.
The interpretation of the parameter depends on the value of the
iSLType parameter.
The distance between the secondary stop level and the current close price must be greater than
the the minimal conditional distance.
You can retrieve the value of the minimal conditional distance
using methods of the TradingSettingsProviderAut interface. |
dLimit |
The rate or the offset in pips for the secondary limit order.
The interpretation of the parameter depends on the value of
the iSLType parameter.
The distance between the secondary limit level and the current close price must
be greater than the minimal conditional distance.
You can retrieve the value of the minimal conditional distance
using methods of the TradingSettingsProviderAut interface. |
iTrailMinMoveStop |
Controls the trailing mode for the secondary stop order.
In case the secondary stop order is not specified, specify 0 in this parameter.
In case the secondary stop order must not be a trailing stop, specify 0 in this parameter.
In case the secondary stop order must be trailing with a dynamic step, specify 1 in this parameter.
In case the secondary stop order must be trailing with a fixed step, specify the size in pips of the market movement after which the order must be moved following the market.
The value must be from the
TradingSettingsProviderAut.GetMinTrailingStepForEntryStop value
to the
TradingSettingsProviderAut.GetMaxTrailingStepForEntryStop value.
Note that trailing stop orders can be not available on the server.
To check whether trailing stop orders with a dynamic step are available, use the
PermissionCheckerAut.CanUseDynamicTrailingForEntryStop method.
To check whether trailing stop orders with a fixed step are available, use the
PermissionCheckerAut.CanUseFluctuateTrailingForEntryStop method. |
iTrailMinMoveLimit |
Controls the trailing mode for the secondary limit order.
In case the secondary limit order is not specified, specify 0 in this parameter.
In case the secondary limit order must not be trailing, specify 0 in this parameter.
In case the secondary limit order must be trailing with a dynamic step, specify 1 in this parameter.
In case the secondary limit order must be trailing with a fixed step, specify the size in pips of the market movement after which the order must be moved following the market.
The value must be from the
TradingSettingsProviderAut.GetMinTrailingStepForEntryLimit value
to the
TradingSettingsProviderAut.GetMaxTrailingStepForEntryLimit value.
Note that trailing limit orders can be not available on the server.
To check whether trailing limit orders with a dynamic step are available, use the
PermissionCheckerAut.CanUseDynamicTrailingForEntryLimit method.
To check whether trailing limit orders with a fixed step are available, use the
PermissionCheckerAut.CanUseFluctuateTrailingForEntryLimit method. |
iTIFType |
The Time In Force option for the market order.
The parameter must have one of the following values:
TradeDeskAut.TIF_GTC
|
Use this value in case the GTC order must be created.
NOTE: This value must be used only for orders to be executed at the available market price
(the dRate parameter is equal to 0). In case the value of the dRate parameter is not equal to 0,
specifying TradeDeskAut.TIF_GTC in this parameter will result in this method throwing an exception/error. |
TradeDeskAut.TIF_DAY
|
Use this value in case the DAY order must be created.
NOTE: This value must be used only for orders to be executed at the available market price
(the dRate parameter is equal to 0). In case the value of the dRate parameter is not equal to 0,
specifying TradeDeskAut.TIF_DAY in this parameter will result in this method throwing an exception/error. |
TradeDeskAut.TIF_IOC
|
Use this value in case the IOC order must be created. |
TradeDeskAut.TIF_FOK
|
Use this value in case the FOK order must be created. |
See FIX Order Types for more details. |
Result |
[output] Returns a collection of OrdersBatchResultAut objects.
Each element of the collection contains the result of the operation for each order from the batch.
Only for the OpenTradeELS method. See declarations above. |
psBatchId |
[output] An object that contains the identifier of the batch as string.
Only for the OpenTradeELSAsync method. See declarations above. |
psRequestIDList |
[output] An object of the StringEnumAut class. Contains the list of request identifiers.
Only for the OpenELSAsync method. See declarations above. |