SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014...

28
SYMPHONY FINTECH SOLUTIONS PVT LTD Symphony Presto TM FuseXL Reference Manual Version 1.0

Transcript of SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014...

Page 1: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

SYMPHONY FINTECH SOLUTIONS PVT LTD

Symphony PrestoTM FuseXL Reference Manual Version 1.0

Page 2: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 2 of 28

DOCUMENT CONTROL

INFORMATION

AUTHOR Akanksha Tiwari, K. S. Ajitkumar

DOCUMENT Symphony PrestoTM

FuseXL Reference Manual

VERSION 1.1

REVIEW NOTES

KEYWORDS

Page 3: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 3 of 28

CONTENTS:

1. INTRODUCTION 4

2. SOFTWARE REQUIREMENTS 5

3. SYSTEM REQUIREMENTS 5

4. STEPS TO RUN FuseXL 5

5. DEVELOPER SECTION 15

5.1 Import FuseXL COM 15

5.2 Initialization of Objects 15

5.3 Client Implementation Class 16

5.4 Trap Change in Cells 17

5.5 Service Functions 19

5. 5.1 Send Order () 18

5. 5.2 Replace Order () 19

5. 5.3 Cancel Order () 21

5. 5.4 Get Execution Report Count 21

5. 5.5 Square off () 21

5. 5.6 Get Execution Report in Cells 23

Page 4: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 4 of 28

1. INTRODUCTION

The document explains the use of PrestoFuseXL - the Excel Plug-in for trading with Symphony

Presto. This document includes all the steps, requirements and configurations related to

PrestoFuseXL. Features, such as, how orders are placed, replaced and canceled are explained.

This document also includes how to get execution reports in Excel Sheet’s cells.

We have tried to make this document user friendly and detailed to enable the user to

understand the functions and write his/her own VBA script without any difficulty.

Page 5: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 5 of 28

2. SOFTWARE REQUIREMENTS

MS Excel: - It is the main part of the application. As the name of the project indicates

PrestoFuseXL is an application related to Excel. Trading functions will be called from inside an

Excel Sheet and execution reports will also be displayed in cells of Excel Sheet.

.Net Framework 3.5:- It is necessary to make the Component Object Model (COM) which is

imported in Excel to perform service functions.

RTD Server: - Real Time Data Server is used to provide market data to Excel.

PrestoFuseXL Components: - PrestoFuseXL.dll, PrestoFuseXL.tlb etc. provided by Symphony

PrestoServer: - PrestoServer is Symphony’s trading platform. PrestoFuseXL will send the orders

to PrestoServer. Also, PrestoServer will provide market data feed.

3. SYSTEM REQUIREMENTS

PrestoFuseXL is tested on Windows XP with Intel Pentium(R) processor and 4 GB of RAM.

System requirements are as follows:

Windows XP

Intel Pentium(R) processor

4 GB RAM

4. STEPS TO RUN PrestoFuseXL

Put PrestoFuseXL.dll, PrestoFuseXL.tlb, PrestoFuseXL.pdb, PrestoIBridge.dll, log4net.dll &

RegisterFuseCOMIB.bat in same folder on your system. Now run RegisterFuseCOMIB.bat.

Start PrestoServer (on the server machine)

Start RTD Server or DDE Server

Open MS Excel & load ‘FuseXL.xlsm’

Enable Macros to run the VBA code and also enable the link.

These steps will now be explained in more detail.

Page 6: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 6 of 28

1. Start RTD server or DDE Server for market data and subscribe a given symbol with its given

id.RTD server and DDE server provide Best Buy Quantity, Best Buy Price, Best Sell Price, Best

Sell Quantity, Last Traded Price (LTP), Last Traded Quantity (LTQ), Open, Close, Low and High

as market watch. After this click on ‘Export to Excel’ button in RTD Server or ‘Export’ in DDE

Server. Now the market data will be shown in an Excel Sheet, we will call this the ‘data’ excel

sheet.

2. To use this market data in your ‘trading’ Excel sheet (which is already loaded with the xlsm file)

we will have to copy the formula directly from ‘data’ Excel sheet which is already populated by

RTD server or DDE Server to the ‘trading’ excel sheet using “paste special” menu in Edit.

3. Open the ‘trading’ Excel sheet and activate developer (VBA).

Page 7: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 7 of 28

4. There is another option for market feed without doing copy/paste operation. For this go to

Setting and write Symbol, Security Id, Expiry Date, Order Type, Option Type, Strike Price, Broker,

Trigger Price(in case of stoplimit and stopmarket order type) and Historical Symbol in the first

ten columns respectively. After this give input in Starting Template (From where you want to see

Page 8: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 8 of 28

your market data in main sheet (Market Watch), Starting Column, No. of Scripts textboxes and

Subscribe Col.(this will be the column name in which security id is written in case of RTD server

subscription and historical symbol is written in case of DDE Server subscription). Then click on

‘Subscribe RTD’ or ‘Subscribe DDE’ as per your requirement. Then market data will be started

showing in the main sheet (Market Watch). Fill the fields of ‘Setting’ sheet i.e. Host IP Address,

ESB Port, ER Port, User Name and Password for login. There will also be shown previous order

type in cell Y2-Y15 (In case of DDE Server with 15 Scripts).

5. Enable Circular Reference. For this go to Excel OptionsFormulasEnable Iterative

Calculation and select 1 in Maximum Iterations.

Page 9: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 9 of 28

6. Enable Macros and links. After that go to developer and then Visual Basic sheet.

Page 10: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 10 of 28

7. Set the reference of PrestoFuseXL COM (Component Object Model).

Page 11: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 11 of 28

8. PrestoFuseXL COM has various functions e.g. send_Order, replace_Order and cancel_Order

which are defined in C#.Net as COM. By using PrestoFuseXL COM in our Excel Sheet we can

directly call the send_Order, replace_Order and cancel_Order functions.

9. Now, we will demonstrate how to develop a sample strategy inside MS-Excel.

10. In the ‘trading’ excel sheet, we have calculated the difference between LTP and last order price

and compare it with the already defined buy and sell ticks. If the difference is less than or equal

to the buy tick then buy order function will be performed and if the difference is greater than or

equal to the sell tick then sell order function will be performed.

11. There is conditional formatting also applied to change the color of the cells as the price goes up

and down. You can use it by clicking on ‘Apply Color Formatting’ button.

12. To track the changes in price we have used Worksheet_calculate event. This method uses

intersection and union function to monitor the value of cells. Then, on each cell change tick

price (difference between best buy price and best sell price) is calculated and order is sent

accordingly using send_Order function.

Page 12: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 12 of 28

13. The parameters of send_Order function are Order Price, Quantity, Symbol, Broker, Option Type,

Strike Price, Expiry Date, Security Id, Order Type, and Order Side as a string.

14. If you want to replace or cancel any order then go to ExcReport (Execution Report Sheet) and

click on the cell of which order you want to replace or cancel. After clicking on any cell Price,

Quantity, Order Side, Stop Price and Order ID of that Script will be showing in the textboxes. If

you want to replace then modify the price, quantity, order side and click on ‘Replace Order’

button or if you want to cancel the order then just click on ‘Cancel Order’ button.

15. To squareOff the placed orders ‘OrderTracker’ sheet is used. In ‘OrderTrecker’ sheet only those

orders will be showing which order status is either ‘PartiallyFilled’ or ‘Filled’ along with their

respective security ids. Now select the row (order id column) to which you want to square off,

fill ‘price for square off’ textbox and click on ‘Square Off’ button. If you are not providing price in

square off textbox then square off will be done on LTP (from MarketWatch Sheet).

Page 13: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 13 of 28

16. Now for execution report getfrmQueue function is called which is already defined in

PrestoFuseXL COM.

Page 14: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 14 of 28

5. DEVELOPER SECTION

Page 15: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 15 of 28

5.1 Import PrestoFuseXL COM

Copy PrestoFuseXL.tlb and PrestoFuseXL.dll file provided to you and paste them in SYSTEM32 folder

if the dll is not registered using the BAT file. Right click on those files and check if windows security

has blocked them, if they are blocked click on unblock button. Now when we open FuseXL client-

Excel Sheet and go to

Developer Visual Basic Tools References

We get PrestoFuseXL directly from the available references. Now set the reference of PrestoFuseXL.

5.2 Initialization of Object

Initialize object of PrestoFuseXL to call functions defined in it. Here object is initialized in

ClientIMPL_Class.

Sample Code:

Public Client_Object As PrestoFuseXL.clientBridge Public Function doInitialize() maxCount = 0 'maxCntPos = 0 If Impl_Object Is Nothing Then IP = Sheet3.TextBoxIP.Text ESB = Sheet3.TextBoxESB.Text ER = Sheet3.TextBoxER.Text userName = Sheet3.TextBoxUserName.Text pwd = Sheet3.TextBoxPwd.Text Set Impl_Object = New ClientIMPL_Class Impl_Object.doLogin header = False rowOffset = 1 End If

End Function

Page 16: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 16 of 28

5.3 Client Implementation Class

Sample Code:

Option Explicit Public Client_Object As PrestoFuseXL.clientBridge Public connect As String Public ExReportString As String Dim ExReportArray() As String Dim loopcount As Integer Dim ordertrack As Range

'Login in ClientIMPL_Class

'----------- Sub doLogin() maxCntPos = 0 connect = False If Client_Object Is Nothing Then Set Client_Object = New clientBridge 'Parameters of create_client(IP Address of the ESB System,ESB Port,ER-Port) '---------------------------------------- ------------------------------------------------------- connect = Client_Object.create_client(IP, ESB, ER, userName, pwd) If connect = True Then MsgBox "logged in!!" Else MsgBox "Can not login to ORS!" End If End If End Sub

'Execution Report in ClientIMPL_Class '------------------------ Public Function getReport() ExReportString = Client_Object.getfrmQueue End Function

5.4 Trap Change in Cells

There is no any direct method to trap the changes in cells and when value change on account of

application of formula so perform intersection and union operations on the cell ranges (which are to

be trapped) in Worksheet_Calculate() event.

Page 17: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 17 of 28

Sample Code: Private Sub Worksheet_Calculate() Dim rcount As Integer If Impl_Object Is Nothing Then Exit Sub End If If Not Impl_Object Is Nothing Then rcount = Impl_Object.getReportCount 'check report count if greater than zero then go for If rcount > 0 Then Call report End If End If ThisWorkbook.changeNotify End Sub Note: Change notify can be implemented in any of the worksheets as follows: Public Function changeNotify() On Error Resume Next Dim traprange As Range Dim sheet1 As Object Set traprange = Range("MarketWatch!AZ1") Dim a As Integer Set sheet1 = ThisWorkbook.Sheets("MarketWatch") Call Workbook_SheetChange(sheet1, traprange) End Function

Page 18: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 18 of 28

5.5 Service Functions

5.5.1 Send_Order ()

To send order a function named send_Order() which is defined in Impl_Object is called with

the parameters Order Price, Order Quantity, Expiry Date(if exchange is NSEFO), Order Type

and Order Side . The parameters are stored in a String and concatenated by comma. Now

call send_Order with the initialized objects Impl_Object and Objx in Workbook_SheetChange

() event.

Sample Code: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) OrderCount = Sheet3.ScriptNos.Text + 1 On Error Resume Next If Impl_Object Is Nothing Then Exit Sub End If Set action_range = Range("MarketWatch!Y2:MarketWatch!Y" & OrderCount) Set previous_OrderType = Range("MarketWatch!W2") Set previous_OrderPrice = Range("MarketWatch!Z2") Dim c ' For loop of Action Cell Application.EnableEvents = False For Each c In action_range.Cells Dim previous_cell As Range Dim action_cell As Range Set previous_cell = c.Offset(0, -2) Set order_Signal = c.Offset(0, -1) Set previous_OrderPrice = c.Offset(0, 1) If c.Offset(0, -18).Value = "nsecm_sim" Then c.Offset(0, -23).Value = "" End If If Impl_Object.connect = True Then If c.Offset(0, 1).Value = "" Then Debug.Print "in first loop" 'Send Order Parameters:---(Price, Quantity, Symbol,Broker,OptionType,StrikePrice, Expiry Date, Security Id, Order Type, Order Side") '------------------------------------------------------------------------------------------------------ sendId = Impl_Object.send_Order_Function(c.Offset(0, -11).Value, c.Offset(0, -4).Value,

Page 19: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 19 of 28

c.Offset(0, -22).Value, c.Offset(0, -18).Value, c.Offset(0, -20).Value, c.Offset(0, -19).Value, c.Offset(0, -23).Value, c.Offset(0, -24).Value, c.Offset(0, -21).Value, "buy") If sendOrderId <> "" Then Debug.Print sendOrderId previous_OrderType.Offset(c.Row - 2, 0).Value = "buy" previous_OrderPrice.Value = c.Offset(0, -11).Value End If End If If c.Value <> "None" Then If c.Offset(0, 1).Value <> "" Then Debug.Print c.Offset(0, 1).Value 'Send Order Parameters:---(Price, Quantity, Symbol,Broker, Expiry Date, Security Id, Order Type, Order Side") '------------------------------------------------------------------------------------------------------ sendId = Impl_Object.send_Order_Function(c.Offset(0, -11).Value, c.Offset(0, -4).Value, c.Offset(0, -22).Value, c.Offset(0, -18).Value, c.Offset(0, -20).Value, c.Offset(0, -19).Value, c.Offset(0, -23).Value, c.Offset(0, -24).Value, c.Offset(0, -21).Value, c.Value) If sendOrderId <> "" Then previous_OrderType.Offset(c.Row - 2, 0).Value = c.Value previous_OrderPrice.Value = c.Offset(0, -11).Value End If End If End If 'If c.Value = "None" Then 'previous_OrderPrice.Value = c.Offset(0, -11).Value End If Next Application.EnableEvents = True End Sub

5.5.2 Replace_Order ()

To replace the order replace_Order () is called in Excel Sheet. The parameters of this

function are new price, new quantity, exchange, expiry date (if NSEFO), exchange id

provided by exchange after sending the order, order type and order side and stop price.

Sample Code: Sub ReplaceButton_Click() VarTargetRow = Module1.targetRow If (VarTargetRow = "") Then MsgBox "Please select any row to replace" Else If Impl_Object Is Nothing Then Call doInitialize End If If (Sheet2.Range("I" & VarTargetRow & "").Value = "New" Or Sheet2.Range("I" & VarTargetRow & "").Value = "Replaced" Or Sheet2.Range("I" & VarTargetRow & "").Value = "PartiallyFilled") Then

Page 20: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 20 of 28

'Replace Order Parameters:---(New Price,New Qty,Symbol,Expiry Date,Order Id,Order Type,New Order Side,Stop Price) '----------------------------------------------------------------------------------------------------------------- replacedId = Impl_Object.replace_Order_Function(Sheet2.PriceTxtbox.Value, Sheet2.QtyTxtbox.Value, Sheet2.Range("S" & VarTargetRow & "").Value, 20130530, Sheet2.Range("G" & VarTargetRow & "").Value, Sheet2.Range("J" & VarTargetRow & "").Value, Sheet2.Range("T" & VarTargetRow & "").Value, Sheet2.StopPriceTxtbox.Value) If replacedOrderId <> "" Then MsgBox "Order Replaced" Else MsgBox "Order cannot be replaced" End If End If End If

End Sub

5.5.3 Cancel_Order ()

To cancel any placed order cancel_Order () is called with only one parameter exchange id.

Sample Code: Sub CancelButton_Click() VarTargetRow = Module1.targetRow If (VarTargetRow = "") Then MsgBox "Please select any row to cancel" Else If Not Impl_Object Is Nothing Then If (VarTargetRow <> "Filled" Or VarTargetRow <> "PendingNew" Or VarTargetRow <> "PendingReplace" Or VarTargetRow <> "PendingCancel") Then 'Cancel Order Parameter:----(Order ID) '--------------------------------------- canceledId = Impl_Object.cancel_Order_Function(Sheet2.Range("G" & VarTargetRow & "").Value) If canceledOrderId <> "" Then MsgBox "Order Canceled" Else MsgBox "Order cannot be canceled" End If End If End If End If

End Sub

5.5.4 Get Execution Report Count

Page 21: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 21 of 28

To count the number of execution reports which are in queue we call

getRportCount () and we call this function before the getfrmQueue () function.

Sample Code:

Public Function getReportCount() getReportCount = Client_Object.getReportCount End Function

5.5.5 Square off ()

To squareOff the placed orders ‘Square Off’ button is provided on OrderTracker Sheet. Select

the rows (Order Id column) which you want to square off, fill the price textbox (optional) and

click on ‘Square Off’ button. If you are providing price in textbox then squareOff will be done on

that price otherwise squreOff will be on LTP.

Sample Code: Public Function squareOff() Dim cnt, pos Dim orderCol, OrderCount, stoploop As Integer Dim orderSide, Orderstatus, month, dateE, yearE As String Dim range1, action_range, previous_OrderType, previous_OrderPrice As Range Dim range2, order_Signal As Range Dim addrs As String Dim sendId As String Dim splitdvalue() As String Dim splitExpiry() As String Dim expiry, newExpiry Dim SelRange As Range Set SelRange = Selection addrs = Selection.Address pos = InStr(addrs, ",") If pos > 1 Then splitdvalue = Split(addrs, ",") Else splitdvalue = Split(addrs, ":") End If Set range1 = Range(splitdvalue(0)) cnt = Selection.Count

Page 22: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 22 of 28

If cnt > 1 Then Set range2 = Range(splitdvalue(1)) stoploop = range2.Row Else stoploop = range1.Row End If For orderCol = range1.Row To stoploop orderSide = Range("$V$" & orderCol & "").Value Orderstatus = Range("$K$" & orderCol & "").Value On Error Resume Next If Impl_Object Is Nothing Then Exit Function End If OrderCount = Sheet3.ScriptNos.Text + 1 Set action_range = Range("MarketWatch!AA2:MarketWatch!AA" & OrderCount) Dim c ' For loop of Action Cell For Each c In action_range.Cells expiry = Range("$Q$" & orderCol & "").Value If expiry <> "" Then 'Exit Function splitExpiry = Split(expiry, "/") month = splitExpiry(0) dateE = splitExpiry(1) yearE = splitExpiry(2) If Len(dateE) = 1 Then newExpiry = yearE & "0" & month & "0" & dateE End If If Len(dateE) = 2 Then newExpiry = yearE & "0" & month & dateE End If End If If Impl_Object.connect = True Then If Sheet10.squreOffText.Text = "" Then If Range("$V$" & orderCol & "").Value = "Buy" Then sendId = Impl_Object.send_Order_Function(c.Offset(0, -11).Value, Range("$D$" & orderCol & "").Value, Range("$U$" & orderCol & "").Value, Range("$E$" & orderCol & "").Value, Range("$R$" & orderCol & "").Value, Range("$T$" & orderCol & "").Value, newExpiry, Range("$B$" & orderCol & "").Value, Range("$L$" & orderCol & "").Value, Range("$W$" & orderCol & "").Value, "sell") End If If Range("$V$" & orderCol & "").Value = "Sell" Then sendId = Impl_Object.send_Order_Function(c.Offset(0, -11).Value, Range("$D$" & orderCol & "").Value, Range("$U$" & orderCol & "").Value, Range("$E$" & orderCol & "").Value, Range("$R$" & orderCol & "").Value, Range("$T$" & orderCol & "").Value, newExpiry, Range("$B$" & orderCol & "").Value, Range("$L$" & orderCol & "").Value, Range("$W$" & orderCol & "").Value, "buy") End If Else 'textbox else If Range("$V$" & orderCol & "").Value = "Buy" Then

Page 23: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 23 of 28

'Send Order Parameters:---(Price, Quantity, Symbol,Broker,OptionType,StrikePrice, Expiry Date, Security Id, Order Type, Order Side") '------------------------------------------------------------------------------------------------------ sendId = Impl_Object.send_Order_Function(Sheet10.squreOffText.Text, Range("$D$" & orderCol & "").Value, Range("$U$" & orderCol & "").Value, Range("$E$" & orderCol & "").Value, Range("$R$" & orderCol & "").Value, Range("$T$" & orderCol & "").Value, newExpiry, Range("$B$" & orderCol & "").Value, Range("$L$" & orderCol & "").Value, Range("$W$" & orderCol & "").Value, "sell") End If If Range("$V$" & orderCol & "").Value = "Sell" Then sendId = Impl_Object.send_Order_Function(Sheet10.squreOffText.Text, Range("$D$" & orderCol & "").Value, Range("$U$" & orderCol & "").Value, Range("$E$" & orderCol & "").Value, Range("$R$" & orderCol & "").Value, Range("$T$" & orderCol & "").Value, newExpiry, Range("$B$" & orderCol & "").Value, Range("$L$" & orderCol & "").Value, Range("$W$" & orderCol & "").Value, "buy") End If End If 'textbox check End If 'object check Exit For Next 'action range of sheet1 Next 'selection column of sheet10 If sendOrderId <> "" Then MsgBox "SquareOff has done…" Else MsgBox "SquareOff has not done..." End If

End Function

5.5.6 Get Execution Report in Cells

Execution Report is received in cells by calling function getfrmQueue () which is already

defined in ClientIMPL_Class. Example below includes coding of two modules i.e. Module1

and ClientIMPL_Class.

Sample Code: Module1 Sub report() Dim orderIds Dim securID As String Dim ordSplit() As String Dim ordertrack As Range Dim check As Boolean Dim check1 As Boolean Dim callFindRecord Dim callPrintSecID As Boolean Dim order Dim count_Report

Page 24: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 24 of 28

Dim repcnt As Integer Set ordertrack = Range("OrderTracker!C7") If Impl_Object Is Nothing Then Exit Sub Else Dim x As Variant count_Report = Impl_Object.getReportCount 'check report count if greater than zero then go for If count_Report > 0 Then For repcnt = 0 To count_Report + 1 x = Impl_Object.getReport() Application.EnableEvents = False If header = False Then '----------------------------- 'Headings of Execution Report '----------------------------- Set Acc = Range("ExcReport!A5") Acc.Value = "Account" Set CumTQty = Range("ExcReport!B5") CumTQty.Value = "CummTradeQty" Set Exchange = Range("ExcReport!C5") Exchange.Value = "Exchange" Set exchngExid = Range("ExcReport!D5") exchngExid.Value = "ExchangeExcutionID" Set exchngOrdid = Range("ExcReport!E5") exchngOrdid.Value = "ExchangeOrderID" Set LastTQty = Range("ExcReport!F5") LastTQty.Value = "LastTradeQty" Set Ord_id = Range("ExcReport!G5") Ord_id.Value = "Order ID" Set OrdQty = Range("ExcReport!H5") OrdQty.Value = "Order Qty" Set OrdStatus = Range("ExcReport!I5") OrdStatus.Value = "Order Status" Set OrdType = Range("ExcReport!J5") OrdType.Value = "Order Type" Set OrgId = Range("ExcReport!K5") OrgId.Value = "Original ID" Set price = Range("ExcReport!L5") price.Value = "Price"

Page 25: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 25 of 28

Set RemOrdQty = Range("ExcReport!M5") RemOrdQty.Value = "RemainOrderQty" Set SecInfo = Range("ExcReport!N5") SecInfo.Value = "Security Info" Set exDate = Range("ExcReport!O5") exDate.Value = "Expiry Date" Set optionType = Range("ExcReport!P5") optionType.Value = "Option Type" Set SecType = Range("ExcReport!Q5") SecType.Value = "Security Type" Set strikePrice = Range("ExcReport!R5") strikePrice.Value = "Strike Price" Set symbol = Range("ExcReport!S5") symbol.Value = "Symbol" Set Side = Range("ExcReport!T5") Side.Value = "Side" Set StopP = Range("ExcReport!U5") StopP.Value = "Stop Price" Set TimeInForce = Range("ExcReport!V5") TimeInForce.Value = "TimeInForce" Set TradePrice = Range("ExcReport!W5") TradePrice.Value = "Trade Price" Set TransTime = Range("ExcReport!X5") TransTime.Value = "Transaction Time" Set User = Range("ExcReport!Y5") User.Value = "User Name" Set PrestoBSeq = Range("ExcReport!Z5") PrestoBSeq.Value = "PrestoBridgeSeq No." Set PrestoORS_seq = Range("ExcReport!AA5") PrestoORS_seq.Value = "PrestoORSSeq No." header = True End If ' end of header check '------------------------------------------------------------- 'Comma(,) and Equal(=)Separation from Execution Report String '-------------------------------------------------------------

Page 26: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 26 of 28

If Impl_Object.ExReportString <> Empty Then If Impl_Object.ExReportString <> "No Report" Then CommaSplitedString = Split(Impl_Object.ExReportString, ",") callFindRecord = False callPrintSecID = False For intIndex = 0 To UBound(CommaSplitedString) ExReport = CommaSplitedString(intIndex) EqualSplitedString = Split(ExReport, "=") On Error Resume Next Acc.Offset(rowOffset, intIndex).Value = EqualSplitedString(1) If intIndex = 6 Then ordID = EqualSplitedString(1) End If If intIndex = 19 Then orderSide = EqualSplitedString(1) End If If intIndex = 5 Then lastQty = EqualSplitedString(1) End If If intIndex = 8 Then comstring = EqualSplitedString(1) If comstring = "Filled" Or comstring = "PartiallyFilled" Then callFindRecord = True callTrackPositions = True End If End If If intIndex = 10 Then orginialID = EqualSplitedString(1) End If securID = printSecurityID(ordID) Next ' Report string loop rowOffset = rowOffset + 1 End If ' Report String Check Else ' else of not empty End If 'end if of not empty If callFindRecord = True Then findRecord (ordID) callFindRecord = False End If If callTrackPositions = True Then positn = trackPositions(orderSide, lastQty, securID) callTrackPositions = False End If 'Next loop to fetch next report in queue Next repcnt End If 'of report count End If 'of object

Page 27: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 27 of 28

Application.EnableEvents = True End Sub Public Function findRecord(Orderid As String) Dim cellAddress As String Dim orderIdFound As Boolean Dim c, j Set ordidrng = Range("OpenOrders!A2:OpenOrders!A65300") Set ordidrng1 = Range("OrderTracker!A8") orderIdFound = False For Each c In ordidrng.Cells If c.Value = Orderid Then cellAddress = c.Address Application.EnableEvents = False For j = 0 To maxCount If ordidrng1.Cells.Offset(j, 0).Value = Orderid Then 'Or ordidrng1.Cells.Offset(j, 0).Value = "" Then orderIdFound = True ordidrng1.Cells.Offset(j, 0).Value = c.Offset(0, 0).Value ordidrng1.Cells.Offset(j, 1).Value = c.Offset(0, 1).Value For intIndex = 0 To UBound(CommaSplitedString) ExReport = CommaSplitedString(intIndex) EqualSplitedString = Split(ExReport, "=") On Error Resume Next ordidrng1.Cells.Offset(j, 2).Offset(0, intIndex).Value = EqualSplitedString(1) If EqualSplitedString(1) = "Filled" Then c.Offset(0, 1).Delete c.Offset(0, 0).Delete End If Next intIndex Exit For End If Next j If orderIdFound = False Then j = maxCount ordidrng1.Cells.Offset(j, 0).Value = c.Offset(0, 0).Value ordidrng1.Cells.Offset(j, 1).Value = c.Offset(0, 1).Value For intIndex = 0 To UBound(CommaSplitedString) ExReport = CommaSplitedString(intIndex) EqualSplitedString = Split(ExReport, "=") On Error Resume Next ordidrng1.Cells.Offset(j, 2).Offset(0, intIndex).Value = EqualSplitedString(1) If EqualSplitedString(1) = "Filled" Then c.Offset(0, 1).Delete c.Offset(0, 0).Delete End If Next intIndex maxCount = maxCount + 1 End If Application.EnableEvents = True 'Exit Function End If

Page 28: SYMPHONY FINTECH SOLUTIONS PVT LTD€¦ · Symphony PrestoTM FuseXL Reference Manual March 27, 2014 Proprietary and Confidential Page 6 of 28 1. Start RTD server or DDE Server for

Symphony PrestoTM FuseXL Reference Manual

March 27, 2014 Proprietary and Confidential Page 28 of 28

Next c findRecord = cellAddress End Function