Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Transactions /
  • REDI API /
avatar image
Question by Akechi Sato · May 24, 2018 at 11:13 AM · vbaredistartegystrategy

How do I set the ratio for one leg in VBA?

Hi,

I would like to set the ratio for one leg in VBA. The Quantity is for the whole structure.
How to do that? Do I need to add it as a third leg?
Could you please help me?

Here is my source code:

Dim hOrder As New COMPLEXORDER
  
  ' Complex options order header ---------------------------
  hOrder.Strategy = "Vertical"

  hOrder.SetSymbol 0, Symbol
  hOrder.SetExchange 0, Exch
  hOrder.SetPriceType 0, "Limit"
  hOrder.SetTIF 0, "Day"
  hOrder.SetQuantity 0, Qty
  hOrder.SetAccount 0, Acct

  ' Leg 1
  hOrder.SetSide 1, Side
  hOrder.SetPosition 1, "Open"
  hOrder.SetOptType 1, PC
  hOrder.SetMonth 1, Mat
  hOrder.SetStrike 1, Strike
    
   
  ' Leg 2
  If (Side = "Buy") Then
      hOrder.SetSide 2, "Sell"
  ElseIf (Side = "Sell") Then
      hOrder.SetSide 2, "Buy"    
  End If

  hOrder.SetPosition 2, "Open"
  hOrder.SetOptType 2, PC
  hOrder.SetMonth 2, Mat
  hOrder.SetStrike 2, Strike2
  
  hOrder.SetPrice 0, Px
  If (Live) Then
  rtnVal = hOrder.Submit(myerr)
  
  If Not rtnVal Then
    If myerr <> "" Then
      MsgBox myerr
                 MsgBox (Now() & "--" & str & "-- Error -- " & myerr)
    Else
      MsgBox "Failed - Please Contact REDI Support."
    End If
  Else
                  Debug.Print (Now() & "--" & str & "-- Order Submitted")
  End If
  Else
    MsgBox (str & " Not live order")
    End If
End Sub

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Dan.Socaciu · May 31, 2018 at 02:40 PM

You need to specify hOrder.Strategy = “Ratio Orders” and specify the header and leg quantities as per the below code snippet.

I just tried this on my machine and it worked (2:7 ratio).

hOrder.Strategy = "Ratio Orders"
hOrder.SetSymbol 0, "AAPL"
hOrder.SetExchange 0, "DEM2 DMA"
hOrder.SetPriceType 0, "Market"
hOrder.SetTIF 0, "Day"
hOrder.SetAccount 0, "DEMO2"
  ' Leg 1 of calendar spread hOrder.SetSide 1, "Buy"
hOrder.SetPosition 1, "Open"
hOrder.SetOptType 1, "Call"
hOrder.SetMonth 1, "Jun '18" hOrder.SetStrike 1, "175.00"
hOrder.SetQuantity 1, 2
  ' Leg 2 of calendar spread hOrder.SetSide 2, "Sell"
hOrder.SetPosition 2, "Open" hOrder.SetOptType 2, "Call"
hOrder.SetMonth 2, "Jun '18"
hOrder.SetStrike 2, "180.00"
hOrder.SetQuantity 2, 7hOrder.SetQuantity 0, 1

By the way, the Ratio Order strategy and other strategies like Butterfly, Delta Neutral, Ratio… are demonstrated in the "Order Entry - Complex Option (US Options).xlsm" example available on GitHub here: https://github.com/TR-API-Samples/Example.REDI.VB.ExcelExamples

Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Akechi Sato · Jun 01, 2018 at 02:50 AM 0
Share

Hi Dan,

I just tried it and it works perfectly well.

Thank you very much for you kind help and for the link to the examples on GitHub.

Akechi

avatar image
REFINITIV
Answer by Dan.Socaciu · May 31, 2018 at 10:06 AM

Hi Akechi,

What do you mean ratio for one leg?

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by Akechi Sato · May 31, 2018 at 12:31 PM

I want to change the quantity on the second leg, so 1 of one option and say 2x another

Something similar to what I do on this screenshot: screenshot.png


screenshot.png (299.4 KiB)
Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Akechi Sato · Jun 01, 2018 at 02:35 AM 0
Share

I’ve done more testing:

When I set hOrder.Strategy = “Custom”, I get “Side is required”.

When I set hOrder.Strategy = “Calendar”, the order goes through in the custom ratio, but the side in Message Monitor says “Calendar”.

What do I have to specify in the API for Ratio orders to be submitted?
I tried hOrder.Strategy = “Custom”, but that didn’t work either.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
7 People are following this question.

Related Questions

Redi Trade Automation

I am sending and canceling orders via excel VBA and Redi on 150 stocks. Redi crashes after a certain period of time, I will often get this response "Microsoft Excel is waiting for another application to complete an OLE action."

Accessing Algo Field Options

account set from API not showing up in Redi Plus UI?

REDI desktop stuck when I trying to stream position out

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges