Orc Trader Spreadsheet Link
Orc Trader Spreadsheet Link
1. Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2. Orc Trader Spreadsheet Link reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3. Orc Trader Spreadsheet Link VBA library reference . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Orc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
OrcContracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
OrcMarkets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
OrcOrders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
OrcPortfolios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
OrcRtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
OrcStrategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Volatility surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
OrcUnderlyings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Class Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
OrcDefines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Copyright © 2014, Orc Group
3
Copyright © 2014, Orc Group
Getting started
Setting up an Orc-Excel link
To set up a link to an Excel sheet from a trading page, a Parameter Overview window, or a Portfolio window:
1. Open OrcTraderSpreadsheetLink.xlam.
The Excel add-in .xlam file can be found in the Start menu under \Orc\Orc Trader Spreadsheet Link\Orc Trader
Spreadsheet Link Excel Library or installed under \Program files\Orc\Orc Trader Spreadsheet Link\
2. In the Orc Trader+ window (Trading page/Parameter Overview window/Portfolio window), select a region of cells or
possibly the whole window pane.
4. In Excel, select Excel menu bar>Edit>Paste to insert the selected columns from the active Orc window into your
Excel sheet.
The Excel column values are then updated in real time to always correspond with the values in the Orc window
columns.
5. When you save your Excel file, make sure you save it as a Excel Macro-Enabled Workbook (*.xslm).
Pasting a large number of links between Orc Trader+ and Excel might take some time to process. Note
that it is not recommended to open a workbook containing many links, or to paste many links to a
worksheet, while receiving updates to those cells in OT+.
Open the Excel document named OrcTraderSpreadsheetLink.xlam found in \Program files\Orc\Orc Trader
Spreadsheet Link. This will load the Visual Basic for Applications (VBA) library that contains functions needed to
communicate with Orc Trader+.
When loading OrcTraderSpreadsheetLink.xlam, you will be prompted with a Microsoft Excel Security
Notice if you have not enabled macros. Click Enable Macros to continue and access the Orc Trader
Spreadsheet Link functionality.
Create a new workbook by selecting Blank workbook on the File menu (File>New>Blank workbook).
For example, to link the bid price of a contract with the Feedcode 10007 on the MGF Test SD market (Market ID =
471) in Orc Trader+ to Excel, enter the following code in the Excel spreadsheet cell:
The example is using "," as list separator. Depending on your regional settings, you may have to use ";"
as list separator instead.
For more contract field examples and other ways to identify contracts, see Orc Trader Spreadsheet Link reference.
4
Copyright © 2014, Orc Group
5
Copyright © 2014, Orc Group
Sub AddOrder()
Error:
MsgBox "Order could not be added: " & Err.Description
End Sub
Order types
Order type is specified as a string. Should equal the value in the Type list menu in the Orc Trader+ order panel.
If the order type is misspelled, Orc Trader+ will add the order as a standard Limit order.
Orc Trader Spreadsheet Link supports all order types that Orc Trader+ supports, provided that the required order type fields
are among the supported order fields specified in the OrcDefines section of the Orc Trader Spreadsheet Link VBA library
reference.
Slice orders are also supported, see the OrcOrders section in Orc Trader Spreadsheet Link VBA library reference for
information and usage example.
Additional data
To add additional data to an order sent from Excel, add the additional data key to the order dictionary in the
previous example. For more information on additional data keys, refer to the Orc Protocol Specification. The
following shows an example using the additional data Valid until time (_VT) and Counterpart (_CP):
6
Copyright © 2014, Orc Group
Hints
Application.RTD.ThrottleInterval = 1000
4. To verify that throttling rate is set correctly, enter the following and press Enter:
? Application.RTD.ThrottleInterval
7
Copyright © 2014, Orc Group
<system.diagnostics>
<sources>
<source name="Orc.SpreadsheetLink"
switchName="sourceSwitch"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="otListenerShared" />
</listeners>
</source>
</sources>
<switches>
<!-- Change the following line to enable more logging on Spreadsheet link -->
<!--<add name="sourceSwitch" value="Verbose"/>-->
<add name="sourceSwitch" value="Warning"/>
</switches>
<sharedListeners>
<add name="otListenerShared" type="Orc.SharpBridge.OrcLibraries.Tracing.OrcTraceListener,
Orc.SharpBridge"/>
</sharedListeners>
To print more details to the log file, the sourceSwitch setting should be changed to Verbose according to the
comment in the above code snippet.
OtEnableVerboseLog True
OtEnableVerboseLog False
The resulting log file will be located in %LOCALAPPDATA%\Orc\Orc.SpreadsheetLink and the path will expand to
something like C:\Users\MyUsername\AppData\Local\Orc\Orc.SpreadsheetLink.
8
Copyright © 2014, Orc Group
Error handling
9
Copyright © 2014, Orc Group
ECUI
=OtRtdContractFieldEcui(ecui, contractField)
=OtRtdContractFieldEcui(ecui; contractField)
details:
Tag
=OtRtdContractFieldTag(tag, contractField)
=OtRtdContractFieldTag(tag; contractField)
details:
Market + Feedcode
=OtRtdContractFieldMfc(marketId, feedcode, contractField)
=OtRtdContractFieldMfc(marketId; feedcode; contractField)
details:
10
Copyright © 2014, Orc Group
... ...
To get the name of a specific field, add the column to a Trading window in Orc Trader+ and select Copy Link (Orc
menu bar>Edit>Copy Link) to get a working Real Time Data (RTD) link in which the field name can be seen.
details:
11
Copyright © 2014, Orc Group
To get the name of a specific field, add that column to a Trading window in Orc Trader+ and select Copy Link (Orc
menu bar>Edit>Copy Link) to get a working Real Time Data (RTD) link in which the field name can be seen.
=OtRtdPortfolioPositionCount(portfolioName)
details:
Tag
=OtRtdPositionFieldTag(portfolioName, currency, tag, field)
=OtRtdPositionFieldTag(portfolioName; currency; tag; field)
details:
12
Copyright © 2014, Orc Group
Market + Feedcode
=OtRtdPositionFieldMfc(portfolioName, currency, marketId, feedcode, field)
=OtRtdPositionFieldMfc(portfolioName; currency; marketId; feedcode; field)
details:
CONTENTSCONTRACTCOLUMN Contract
CONTENTSPOSITIONCOLUMN Position
CONTENTSINVESTEDCOLUMN Invested
... ...
To get the name of a specific field, add that column to a Trading window in Orc Trader+ and select Copy Link (Orc
menu bar>Edit>Copy Link) to get a working Real Time Data (RTD) link in which the field name can be seen.
Link Instance Id
=OtGetStrategyFieldForId(strategyId, parameterName)
=OtGetStrategyFieldForId(strategyId; parameterName)
details:
strategyId Link Instance Id of strategy. Must be a string since instance ids can be too String
big to fit in a Long
13
Copyright © 2014, Orc Group
Strategy Name
=OtGetStrategyFieldForName(strategyName, parameterName)
=OtGetStrategyFieldForName(strategyName; parameterName)
details:
For more information on available parameters for spreader strategies, refer to the Parameter summary section of
the Orc Spreader manual.
=OtGetVolatilitySurfaceForName(surfaceName)
=OtGetVolatilitySurfaceForTag(surfaceTag)
For information on index of parameters for different volatility models, see Volatility parameter mappings in the Orc
Trader Spreadsheet Link VBA library reference - Volatility surfaces section.
To print all parameters and values:
14
Copyright © 2014, Orc Group
15
Copyright © 2014, Orc Group
16
Copyright © 2014, Orc Group
Modules
This section contains information on the following modules:
Orc
OrcContracts
OrcMarkets
OrcOrders
OrcPortfolios
OrcRtd
OrcStrategies
Volatility surfaces
OrcUnderlyings
17
Copyright © 2014, Orc Group
Orc
OtArrayLength(TheArray As Variant) As Long
Returns the length of an array, taking the lower and upper bounds of the array into account.
OtArrayLength() Example:
Sub CheckArrayLength()
End Sub
OtCreateDictionary() As OtDictionary
Creates a new OtDictionary that can be used for order data and order updates.
OtCreateDictionary() Example:
Sub CreateOrderDictionary()
End Sub
OtEnableVerboseLog(VerboseLog As Boolean)
Enable (True) or disable (False) detailed logging in a file. This file is saved in folder
"%LocalAppData%\Orc\Orc.SpreadsheetLink".
OtEnableVerboseLog() Example:
Sub EnableVerboseLogging()
OtEnableVerboseLog True
End Sub
18
Copyright © 2014, Orc Group
OrcContracts
OtCreateContractKey(Market As Long, Feedcode As String) As OtContractKey
Creates OtContractKey for specified Market and Feedcode. This key can be used in other functions to identify a
contract.
OtCreateContractKey() Example:
Sub CreateContractKey()
End Sub
Returns an array of contract keys as OtContractKey for all contracts for specified underlying. The keys can be used
in other functions to identify a contract. Specify an empty string to get all contracts for all markets.
OtGetContracts() Example:
Sub DisplayContracts()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
Experimental feature! Currently returning contracts that Orc Trader+ has a subscription for.
Returns an array of contract keys as OtContractKey for all contracts for specified underlying identified by OtUnderlyi
ngKey.
19
Copyright © 2014, Orc Group
OtGetContracts() Example:
Sub DisplayContracts()
Else
MsgBox ("No underlyings found.")
End If
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
20
Copyright © 2014, Orc Group
OrcMarkets
OtGetMarkets() As OtMarketKey()
Experimental feature! Currently returning all markets that have a contract in the Client Data
Server (CDS).
OtGetMarkets() Example:
Sub DisplayMarkets()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
21
Copyright © 2014, Orc Group
OrcOrders
Order Types
Order type is specified as a string. Should equal the value in the Type list menu in the Orc Trader+ order panel.
If the order type is misspelled, Orc Trader+ will add the order as a standard Limit order.
OtCreateOrderKey() Example:
Sub AddAndRemoveOrder()
OtOrderRemoveKey key
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtGetOrderField() Example:
Sub ViewOrderComment()
MsgBox (orderComment)
Exit Sub
Error:
MsgBox ("Could not get order field: " & Err.Description)
End Sub
22
Copyright © 2014, Orc Group
OtGetOrderFieldKey() Example:
Sub ViewOrderComment()
MsgBox (orderComment)
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtGetOrders() As OtOrderKey()
Experimental feature! Currently returning all orders that Orc Trader+ has loaded, regardless of
status.
Returns an array of OtOrderKeys for all orders. The keys can be used in other functions to identify orders.
OtGetOrders() Example:
Sub DisplayOrderTags()
Error:
MsgBox ("Error: " & Err.Description)
End Sub
23
Copyright © 2014, Orc Group
OtOrderAdd() Example:
Sub AddOrder()
Error:
MsgBox "Order could not be added: " & Err.Description
End Sub
OtOrderAddSliceOrderMfc() Example:
Sub AddSliceOrder()
' Add slice order with slice volume 25. Not specifying number of slices will automatically
divide
' the order into 100 / 25 = 4 slices
Set order = OtOrderAddSliceOrderMfc(471, "C14100", OtOrderSideSell, 100, 75, 25, IsActive:=True,
Portfolio:="Portfolio2")
MsgBox "Slice order added, tag of parent order: " & order.Tag
' Add slice order with 2 slices. Not specifying slice volume will automatically calculate the
' slice volume, in this case slice volume will be 200 / 2 = 100
Set order = OtOrderAddSliceOrderMfc(471, "C14100", OtOrderSideBuy, 200, 70, NumberOfSlices:=2,
IsActive:=True, Portfolio:="Portfolio2")
MsgBox "Slice order added, tag of parent order: " & order.Tag
Exit Sub
Error:
MsgBox "Slice order could not be added: " & Err.Description
End Sub
24
Copyright © 2014, Orc Group
OtOrderAddSliceOrderTag() Example:
Sub AddSliceOrder()
MsgBox "Slice order added, tag of parent order: " & order.Tag
Exit Sub
Error:
MsgBox "Slice order could not be added: " & Err.Description
End Sub
OtOrderAddStandardMfc() Example:
Sub AddOrder()
Error:
MsgBox "Order could not be added: " & Err.Description
End Sub
25
Copyright © 2014, Orc Group
OtOrderAddStandardTag() Example:
Sub AddOrder()
Error:
MsgBox "Order could not be added: " & Err.Description
End Sub
GroupData does not need to contain anything since it is possible to call on OtOrderGroupAdd
with GroupData as an empty OtDictionary or as Nothing.
26
Copyright © 2014, Orc Group
OtOrderGroupAdd() Example:
Sub AddGroupedOrders()
If groupResult.Parent.Success Then
Cells(1, 1).Value = "Group order tag: " & groupResult.Parent.OrderKey.Tag
Else
Cells(1, 1).Value = "Group order could not be added: " & groupResult.Parent.ErrorMessage
End If
Error:
MsgBox ("Error: " & Err.Description)
End Sub
27
Copyright © 2014, Orc Group
OtOrderPrepareSliceOrder() Example:
Sub PrepareAndCompleteSliceOrder()
Error:
MsgBox ("Could not add order: " & Err.Description)
End Sub
OtOrderPrepareStandard() Example:
Sub PrepareAndCompleteOrder()
Error:
MsgBox ("Could not add order: " & Err.Description)
End Sub
28
Copyright © 2014, Orc Group
OtOrderRemove() Example:
Sub RemoveOrder()
MsgBox "Order with tag " & orderTag & " has been removed."
Exit Sub
Error:
MsgBox "Order with tag " & orderTag & " could not be removed: " & Err.Description
End Sub
OtOrderRemoveKey(Key As OtOrderKey)
Removes an order from Orc Trader+ using an OtOrderKey to identify the order. Throws exception if it fails.
OtOrderRemoveKey() Example:
Sub RemoveOrder()
'Place order
Dim order As OtDictionary
Set order = OtCreateDictionary
'Remove order
OtOrderRemoveKey orderKey
MsgBox "Removed order with tag: " & orderKey.Tag
Exit Sub
Error:
MsgBox "Error: " & Err.Description
End Sub
29
Copyright © 2014, Orc Group
OtOrderUpdate() Example:
Sub UpdateOrder()
Error:
MsgBox ("Error: " & Err.Description)
End Sub
30
Copyright © 2014, Orc Group
OtOrderUpdateKey() Example:
Sub UpdateOrder()
Error:
MsgBox ("Error: " & Err.Description)
End Sub
It is not recommended to use this function repeatedly to update multiple order fields since Orc
Trader+ will be busy with previous updates and might not be able to perform the update
successfully. When updating multiple order fields, use OtOrderUpdate or OtOrderUpdateKey ins
tead.
31
Copyright © 2014, Orc Group
OtSetOrderField() Example:
Sub SetOrderField()
Error:
MsgBox ("Error : " & Err.Description)
End Sub
It is not recommended to use this function repeatedly to update multiple order fields since Orc
Trader+ will be busy with previous updates and might not be able to perform the update
successfully. When updating multiple order fields, use OtOrderUpdate or OtOrderUpdateKey ins
tead.
OtSetOrderFieldKey() Example:
Sub SetOrderField()
Error:
MsgBox ("Error : " & Err.Description)
End Sub
32
Copyright © 2014, Orc Group
OrcPortfolios
OtCreatePortfolioKey(Name As String)
Returns an OtPortfolioKey for the specified portfolio name.
OtCreatePortfolioKey() Example:
Sub PortfolioKey()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtCreatePositionKey() Example:
Sub PositionKey()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtGetPortfolios()
Returns array of portfolio keys as OtPortfolioKey for all portfolios.
33
Copyright © 2014, Orc Group
OtCreatePositionKey() Example:
Sub PrintAllPortfolios()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtGetPositions(PortfolioName As String)
Returns array of position keys as OtPositionKey for all positions for the specified portfolio.
OtCreatePositionKey() Example:
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtRtdPortfolioPositionCount(PortfolioName As String)
Setup cell for RTD for the number of positions for the specified portfolio that will update if the number of positions
changes. Can be used to detect when positions are added or removed from the portfolio.
34
Copyright © 2014, Orc Group
OrcRtd
The following functions are used to set up an Excel cell for RTD and should be used directly in Excel worksheet
cells. For more information, see Orc Trader Spreadsheet Link reference.
To access strategy fields in VBA, use OtGetstrategyField function documented in OrcStrategies.
Note that while Orc Trader+ allows square brackets ']' in portfolio names, this
character is not handled when subscribing to a position in Orc SpreadSheet Link.
35
Copyright © 2014, Orc Group
OrcStrategies
Orc Trader Spreadsheet Link can identify strategies by their name. If you are using multiple
strategies with the same name, any cell with a link to these strategies will display the error
message: Strategy not unique.
Identifying a strategy by link instance Id requires link instance Id to be used as string since they
can be too big to fit in a Long.
OtCreateStrategyKey() Example:
Sub StrategyIdKey()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
OtCreateStrategyKey() Example:
Sub StrategyNameKey()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
36
Copyright © 2014, Orc Group
OtGetStrategyField() Example:
Sub GetStrategyField()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
For more information on available parameters for spreader strategies, refer to the Parameter summary section of
the Orc Spreader manual.
OtGetStrategyField() Example:
Sub GetStrategyField()
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
For more information on available parameters for spreader strategies, refer to the Parameter summary section of
the Orc Spreader manual.
OtSetStrategyField() Example:
Sub DoubleVolume()
Error:
MsgBox ("Error: " & Err.Description)
End Sub
37
Copyright © 2014, Orc Group
For more information on available parameters for spreader strategies, refer to the Parameter summary section of
the Orc Spreader manual.
OtSetStrategyField() Example:
Sub DoubleVolume()
Error:
MsgBox ("Error: " & Err.Description)
End Sub
For more information on available parameters for spreader strategies, refer to the Parameter summary section of
the Orc Spreader manual.
OtStartStrategyForId(Id As String)
Attempts to start the strategy identified by the link instance Id. Read parameter "OtStrategyStatus" to see if the
strategy is started.
OtSetStrategyField() Example:
Sub StartStrategy()
OtStartStrategyForId "1023954732"
End Sub
OtStartStrategyForName(Name As String)
Attempts to start the strategy identified by name. Read parameter "OtStrategyStatus" to see if the strategy is started.
OtSetStrategyField() Example:
Sub StartStrategy()
OtStartStrategyForName "SpreadTest Combo 1"
End Sub
OtStopStrategyForId(Id As String)
Stops the strategy identified by link instance Id. Read parameter "OtStrategyStatus" to see if the strategy is stopped.
OtSetStrategyField() Example:
Sub StopStrategy()
OtStopStrategyForId "1023954732"
End Sub
OtStopStrategyForName(Name As String)
Stops the strategy identified by name. Read parameter "OtStrategyStatus" to see if the strategy is stopped.
38
Copyright © 2014, Orc Group
OtSetStrategyField() Example:
Sub StopStrategy()
OtStopStrategyForName "SpreadTest Combo 1"
End Sub
39
Copyright © 2014, Orc Group
Volatility surfaces
OtGetVolatilitySurfaceForName(Name As String) As OtDictionary
OtGetVolatilitySurfaceForTag(SurfaceTag As Long) As OtDictionary
Get volatility surface for a surface name or tag.
OtGetRiskSurfaceForContractTag(Tag As Long)
OtGetRiskSurfaceForContractMfc(Market As Long, Feedcode As String)
OtGetQuoteSurfaceForContractTag(Tag As Long)
OtGetQuoteSurfaceForContractMfc(Market As Long, Feedcode As String)
Get risk or quote surface for contract specified by contract tag or market/feedcode.
This method returns the effectively used surface. If a contract is set to use risk surface from underlying, the surface
set on the underlying will be returned.
Notes:
If no surface is specified this method will return the constant OtVolatilityNoSurface in the name field.
The separate Orc Trader+ global setting Volatility for quoting specifies if quote surface is set separately or
not (Orc menu bar>Orc>Preferences>Volatility>Volatility for quoting). If Volatility for quoting is set to
Risk surface, OtGetQuoteSurface query will return OtVolatilityNoSurface for a contract although the risk
surface is set correctly.
Notes:
40
Copyright © 2014, Orc Group
For a parameter model, for example the Wing model, all parameters must be set when the curve is created. If
an invalid set of parameters is supplied the surface will be invalid. That is, the curve cannot be opened in Orc
Trader+ and the surface cannot be modified using the SpreadSheet link.
Specify a new expiry to create a new curve (an expiry for which there is no curve present in the surface).
Specifying an existing expiry for a parameter curve will update all supplied parameters (not specified
parameters will not be overwritten).
If a point curve is supplied, all existing points will be deleted and replaced with the new points.
Note that the AddDictionary method is used to add a new dictionary into an existing dictionary in VBA code.
OT parameter OP index
Beta index=0
Alpha index=1
correlation index=3
SSR index=4
41
Copyright © 2014, Orc Group
OT OP index
parameter
Vol.ref index=0
Slope.ref index=1
Down index=4
cutoff
Up cutoff index=5
Ref price Ref price is not available for the Wing model. For more information, see Volatility messages sectio
n of the Orc Protocol Specification.
VCR index=7
SCR index=8
SSR index=9
Down Sm index=10
Up Sm index=11
42
Copyright © 2014, Orc Group
OT OP OP OP index
parameter index index stddev
Dynamic
Static
Rigidity index=0
Curr. index=2
Slope
Alpha index=7
Up smooth index=8
Down index=9
smooth
Ref price Ref price is not available. For more information, see Volatility messages s
ection of the Orc Protocol Specification.
OtCreateVolatilitySurface(Surface As OtDictionary)
Create new volatility surface using the Wing model.
43
Copyright © 2014, Orc Group
44
Copyright © 2014, Orc Group
OtDeleteVolatilitySurfaceForName(SurfaceName As String)
OtDeleteVolatilitySurfaceForTag(SurfaceTag As Long)
Delete volatility surface.
OtDeleteVolatilitySurfaceForName "Surface3"
OtDeleteVolatilitySurfaceForTag 11
45
Copyright © 2014, Orc Group
The reference price is returned for a combination of surface, underlying and expiry.
Error messages:
a. If the surface does not exist an exception is thrown.
b. If no referenceprice can be found for the supplied combination of underlying and expiry a constant value is
returned: INF# (positive infinity).
46
Copyright © 2014, Orc Group
OrcUnderlyings
OtGetUnderlyings(Market As Long) As OtUnderlyingKey()
Experimental feature!
Returns an array of underlyings as OtUnderlyingtKey for specified market. The market is specified using Market Id.
See OtUnderlyingtKey in Class Modules section.
OtGetUnderlyings() Example:
Sub GetUnderlyings()
Dim i As Long
If OtArrayLength(underlyings) <> 0 Then
For i = 0 To UBound(underlyings)
Cells(i + 1, 1).Value = underlyings(i).Name
Next i
End If
Exit Sub
Error:
MsgBox ("Error: " & Err.Description)
End Sub
47
Copyright © 2014, Orc Group
Class Modules
OtContractKey
Details:
OtMarketKey
Details:
OtOrderEntryResult
Success in OtOrderEntryResult only indicates if the order was successfully added to Orc
Trader+ and does not show if the order was successfully added to the market or not.
Note that the boolean field Success is only used for grouped order entry. For order operations
on a single order, an exception will be thrown if it fails.
Details:
Success True if order was added in Orc Trader+. False if not added in Orc Trader+. See Boolean
ErrorMessage for information. Note that OrderKey Is Nothing in this case.
For grouped orders: Also False when the order could be added but not linked
to the grouped order. In this case OrderKey contains the added order.
OrderKey An OtOrderKey object for the added order, if the order was added successfully. OtOrderKey
OtOrderGroupEntryResult
Details:
48
Copyright © 2014, Orc Group
OtOrderKey
Details:
OtPortfolioKey
Details:
OtPositionKey
Details:
OtStrategyKey
OtStrategyKey is currently not used by other strategy functions.
Id Strategy link instance id. Must be a string since instance ids can be too big to fit String
in a Long
OtUnderlyingKey
Details:
49
Copyright © 2014, Orc Group
50
Copyright © 2014, Orc Group
OrcDefines
Columns
OtAdditionalDataPrefix
Prefix used for additional data. Type: String
Order columns
OtOrderComment
Comment to be added to order. Type: String
OtOrderContractFeedcode
Feedcode for the contract that the order should be placed on. Type: String
OtOrderContractMarket
Market (market id) that the order should be placed on. Type: Long
OtOrderContractTag
Tag of the contract that the order should be placed on. Type: Long
OtOrderCustomer
Customer for the order. Type: String
OtOrderIcebergVolume
Volume for an iceberg order. Type: Long
OtOrderIsActive
Defines if an order is active or not. Type: Boolean
OtOrderIsDeleted
True if order is deleted, False otherwise. Type: Boolean
OtOrderIsOnExchange
Defines if the order is on the exchange or not. Type: Boolean
OtOrderKind
Kind of order. Type: Not specified means standard order. Possible values: OtOrderKindStandard, OtOrderKindSlice.
OtOrderMarketError
Error description coming from the market if order is invalid. Type: String
OtOrderNumberOfSlices
The amount of slices to create for a slice order. It not specified, but OtOrderSliceVolume is, the number of slices will
be calculated automatically. Type: Long
OtOrderPortfolio
Portfolio that the order belongs to. Type: String
51
Copyright © 2014, Orc Group
OtOrderPrice
Price for the order. Type: Double
OtOrderReference
Reference for the order. Type: String
OtOrderSide
Side of the order. Type: OtOrderSideBuy, OtOrderSideSell
OtOrderSliceInterval
Slice interval in seconds. Type: Long
OtOrderSliceManualStart
Instant (False) or manual (True) start of slice order. Type: Boolean
OtOrderSlicePriceModificationTick
Tick adjustment when modifying price of a slice order. Type: Long
OtOrderSlicePriceModificationType
When modifying price of a slice order, the type of modification. Type: OtOrderSlicePriceModificationTypeBid,
OtOrderSlicePriceModificationTypeAsk, OtOrderSlicePriceModificationTypeLast.
OtOrderSliceVolume
Volume for each slice of a slice order. If not specified, but OtOrderNumberOfSlices is, the slice volume will be
calculated automatically. Type: Long
OtOrderSliceWithPriceModification
Enable (True) or disable (False) price modifications of a slice order. Type: Boolean
OrderStatus
Status of the order in Orc Trader+. Type: OtOrderStatusOK, OtOrderStatusMarketError,
OtOrderStatusNoMarketAccess, OtOrderStatusInternalError, OtOrderStatusSafetyLimitsExceeded,
OtOrderStatusValidationFailed, OtOrderStatusInternalDelete, OtOrderStatusExternalDelete,
OtOrderStatusNotSupported, OtOrderStatusInternalAdd.
OtOrderStopPrice
Stop price for order. Type: Double
OtOrderTag
Tag that identifies the order.Type: Long
OtOrderTemplate
Order template that the order should use. Type: String
OtOrderType
Order type. Type: String
OtOrderValidity
Order validity. Type: OtOrderValidityImmediate, OtOrderValidityToday, OtOrderValidityUntilCancelled
52
Copyright © 2014, Orc Group
OtOrderVolume
Volume for the order. Type: Long
OtOrderKindSlice
Slice order. OtOrderSliceVolume, OtOrderNumberOfSlices, or both must be specified for this kind of order.
OtOrderKindStandard
Standard/normal order.
OtOrderSideBuy
Defines a buy side order.
OtOrderSideSell
Defines a sell side order.
OtOrderSlicePriceModificationTypeAsk
Base the price modification on the Ask price.
OtOrderSlicePriceModificationTypeBid
Base the price modification on the Bid price.
OtOrderSlicePriceModificationTypeLast
Base the price modification on Last market price.
OtOrderStatusExternalDelete
Order is being delete.
OtOrderStatusInternalAdd
Order is being added. An order cannot be modified/deleted in this state.
OtOrderStatusInternalDelete
Order is being deleted.
OtOrderStatusInternalError
Internal order error.
OtOrderStatusMarketError
Rejected by market.
OtOrderStatusNoMarketAccess
Market not accessible.
OtOrderStatusNotSupported
Order not supported.
53
Copyright © 2014, Orc Group
OtOrderStatusOK
Order OK.
OtOrderStatusSafetyLimitsExceeded
Order outside safety limits.
OtOrderStatusValidationFailed
Order validation failed.
OtOrderValidityImmediate
Order only valid at time of entry.
OtOrderValidityToday
Order valid today.
OtOrderValidityUntilCancelled
Order valid until cancelled.
Volatility surfaces
OtVolatilitySurfaceName
Volatility surface name
OtVolatilitySurfaceTag
Volatility surface tag
OtVolatilitySurfaceModel
Volatility surface model. The name must equal the model name visible in OT+ volatility surfaces manager, for
example "Wing", "SABR model", "Cybic spline (dynamic)".
OtVolatilitySurfaceCurves
Dictionary containing curves belonging to a volatility surface
OtVolatilitySurfaceParameters
Parameters for a volatility curve
OtVolatilitySurfacePoints
Points for a volatility curve
Strategy columns
OtStrategyStatus
Running state of the strategy. Type: OtStrategyStatusStarted, OtStrategyStatusStopped, OtStrategyStatusFailed.
Strategy constants
OtStrategyStatusStarted
Strategy is running.
54
Copyright © 2014, Orc Group
OtStrategyStatusStopped
Strategy is not running.
OtStrategyStatusFailed
Strategy could not be started or stopped running due to an error condition.
Portfolios
OtPortfolioName
Name of the portfolio.
OtPortfolioPositionCount
Field name of the field to use when getting the number of positions for a portfolio.
Positions
OtPositionPortfolio
Name of the portfolio of the position.
OtPositionCurrency
Currency (three letters) of the position.
OtPositionContractTag
Tag of the contract of the position.
OtPositionContractMarket
Market of the contract of the position.
OtPositionContractFeedcode
Feedcode of the contract of the position.
55
Copyright © 2014, Orc Group
56
Copyright © 2014, Orc Group
57
Copyright © 2014, Orc Group
58
Copyright © 2014, Orc Group
59