Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Few Questions and Suggestions on Dividends and new Instruments

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

    Few Questions and Suggestions on Dividends and new Instruments

    First of all, attached is a TotalReturn indicator for dividend bearing securities. It requires you to update the dividends for it to work. IQfeed doesn't provide the dividend info but the Yahoo provider does and with both of them connected it seems to still get the data from yahoo.

    Dividends
    a) How do I programically call the "Update Dividends" method for a given instrument instead of having to open the instrument details form? Ideally, it would be great if dividends would get updated automatically just like any other market data. Just limit the update to once per day.

    b) Once I can automate the update of dividends, I will only want to call the Update Dividends method once per day. Is there a timestamp of when the last update was made that I can access to ensure that it only get called once per day?

    c) I use IQFeed which doesn't seem to provide any dividend / split info. I needed to connect to Yahoo to get this information. I noticed in the Market Data options there is no place to set where to get dividend and split information. Perhaps there should be a default data source in the market data options that can be specified.

    Adding new Instruments
    a) Can I programically add new instruments?

    b) I know when you switch to a security not in the database when in a chart it will add it to the database, but it doesn't populate any information for that security (i.e. description, exchange, etc). Ideally it would be nice if this information is populated from our data source when it is added. In lieu of that, perhaps you could add an override method that gets called when it tries to add a security that we can override to allow us to write our own webservice to populate this information.
    Attached Files
    Last edited by GrumpyTrader; 10-25-2015, 01:09 PM.

    #2
    Hello,

    dividend A) Take a look at the the @DividendAmount, @DividendPayDate, and @DividendYield Market Analyzer Columns for an example of how to do this. The key is to use the OnFundamentalData() event callback method.

    dividend B) Assuming you wish to catch the first update as it comes in, I would recommend saving the time locally in your script, as we are only catching the three pieces of information listed in point A as it comes in.

    instrument A) I will have to look deeper into this one and report back with my findings.

    instrument B) I've added your feedback and vote to SFT-563 for this suggestion. Thank you.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Hi Dave,
      I'm not sure that your answer to Dividends A) works. There is no data item for historic dividends which is what the total return indicator uses (see code below). What I'm actually trying to do is within the instrument details screen, there is a button at the bottom of the instrument screen that updates dividends and splits historically. I want to either a) run this on a set of symbols through the historic data downloader or b) run this programically before I calculate the total return of a stock.

      Code:
                  double div = Instrument.MasterInstrument.Dividends
                      .Where(d => d.Date <= Time[0].Date)
                      .Where(d => d.Date >= Time[ix].Date).Sum(d => d.Amount);

      Comment


        #4
        I see what you mean. There is not a direct way to kick off the download of historical Splits/Dividends in code, but there is a solution, assuming you have access to this information outside of NinjaTrader.

        There are collections named Dividends and Splits (Instrument.MasterInstrument.Dividends[] and Instrument.MasterInstrument.Splits[]) which have setters available for use. If you have access to the necessary data, then you should be able to add to these collections for the instrument configured on your script.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Hi Dave,
          The Yahoo provider seems to be able to retrieve the information. Is there anyway I can access the provider through Ninjascript to retrieve the information instead of writing my own webservice to do it?

          Comment


            #6
            Hey Dave, did you happen to see my last message?

            Comment


              #7
              I did, but there will not be a way to initiate the download of that data in code. I'll be happy to log this as a feature request so that we can begin to track demand for it, if you would like.
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Probably not worth it. Can't imagine many people care. Thanks though.

                Comment


                  #9
                  Hey Dave,
                  Just to let you know you can update splits and dividends in batch through the symbol lists screen. You right click on the symbol list and it gives you an update splits and dividends prompt. It probably should resign in the historic data download section but at least the functionality exists.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by AttiM, 02-14-2024, 05:20 PM
                  10 responses
                  179 views
                  0 likes
                  Last Post jeronymite  
                  Started by ghoul, Today, 06:02 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post ghoul
                  by ghoul
                   
                  Started by Barry Milan, Yesterday, 10:35 PM
                  6 responses
                  19 views
                  0 likes
                  Last Post Barry Milan  
                  Started by DanielSanMartin, Yesterday, 02:37 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post DanielSanMartin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  4 responses
                  13 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Working...
                  X