• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to call historical volatility from IB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_Jim
    replied
    Hello pstrusi,

    The code would reside in your NinjaScript's class. Neither in OnStartUp or OnBarUpdate but at the same level as those methods.

    When the data provider updates these values, OnFundamentalData will iterate for any updates here.

    ImpliedVolatility is not a supported Fundamental Data value, only the values listed for FundamentalDataEventArgs could be referenced with OnFundamentalData.

    Please let me know if I can be of further assistance.

    Leave a comment:


  • pstrusi
    replied
    Hi Jim, thanks for addressing the questions, allow me to rephrase them in order to get a better understanding of properties:

    1. Where would this method go in the code, before OnBarUpte, after OnStartUp....?

    2. If I understand well, this info will be thrown by IB as soon is updated and it will feed into my code?

    3. How to call ImpliedVolatility from IB ? IB's TWS gives this info but in the NT7 guide I just see these fields:
    FundamentalDataType Possible values:



    AverageDailyVolume

    Beta

    CalendarYearHigh

    CalendarYearHighDate

    CalendarYearLow

    CalendarYearLowDate

    CurrentYearsEarningsPerShare

    FiveYearsGrowthPercentage

    High52Weeks

    High52WeeksDate

    HistoricalVolatility

    Low52Weeks

    Low52WeeksDate

    NextYearsEarningsPerShare

    PercentHeldByInstitutions

    PriceEarningsRatio

    SharesOutstanding

    Thanks
    Last edited by pstrusi; 07-15-2019, 11:26 AM.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello pstrusi,

    Thanks for your post.

    Getting Fundamental data information is similar to realtime market data feeds like OnMarketData, there is not an ability to get this information historically and they update as they are sent from the data provider. When the script starts, OnFundamentalData will show the values which already exists. I suggest saving these values to a variable to use them elsewhere in your script and then you can reference those values at your desired point in time.

    One item to note, is that you will want to print e.DoubleValue for the value of HistoricalVolatility.

    Code:
            protected override void OnFundamentalData(FundamentalDataEventArgs e)
            {
                if (e.FundamentalDataType == FundamentalDataType.HistoricalVolatility)
                     Print("HistoricalVolatility = " + e.DoubleValue);
            }
    Please let me know if I can be of further assistance.

    Leave a comment:


  • pstrusi
    started a topic How to call historical volatility from IB

    How to call historical volatility from IB

    Hi NT,

    I was reading NT7 guide searching how to call the instrument's historical volatility from IB. I'm don't know if IB's connectivity allows this procedure. So, let's suppose that IB gives this info, that would be through this method:

    Code:
    protected override void OnFundamentalData(FundamentalDataEventArgs e)
    {
        if (e.FundamentalDataType == FundamentalDataType.HistoricalVolatility)
             Print("HistoricalVolatility = " + e.HistoricalVolatility);
    }
    Questions:

    - How to call this method once a day? Where to put in the code?
    - I've read in IB's TWS documentation that historical volatility that is given is 30 days, so what if I need 1 year?

    Thanks

Latest Posts

Collapse

Topics Statistics Last Post
Started by Nmbrise, Today, 04:49 AM
0 responses
1 view
0 likes
Last Post Nmbrise
by Nmbrise
 
Started by soulfx, Today, 03:57 AM
0 responses
3 views
0 likes
Last Post soulfx
by soulfx
 
Started by digibob, Today, 03:45 AM
0 responses
5 views
0 likes
Last Post digibob
by digibob
 
Started by Matts7, Today, 12:56 AM
1 response
15 views
0 likes
Last Post NinjaTrader_Marco  
Started by barrybrice, Yesterday, 08:51 PM
1 response
8 views
0 likes
Last Post NinjaTrader_Marco  
Working...
X