How do I convert a DSGRID/DataStream query into one for the Python API?


I am trying to pull in Options pricing data. I already have the relevant input codes - here is the query I used to use in DataStream with DSGRID

=@DSGRID($D$2:$H$2,"O3",$C$1,"","D","SDateCellRef=true;ColHeader=true;DispSeriesDescription=false;YearlyTSFormat=false;QuarterlyTSFormat=false;AutoRefresh=false","")

where $D$2:$H$2 is

MSQ$DELTA25C MSQ$DELTA25P MSQ$DELTA10C MSQ$DELTA10P MSQ$DELTAATM

and $C$1 is a date, say, 1/1/2015.


I am now trying to pull this using the Python API // in codebook. Can somebody help?

Thanks

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @Nikunj.Jain

    The code looks like the following.

    ds.get_data(tickers='MSQ$DELTA25C,MSQ$DELTA25P,MSQ$DELTA10C,MSQ$DELTA10P,MSQ$DELTAATM', 
                fields=['O3'], 
                start='2015-01-01', 
                freq='D')

    The output is:

    1636692270112.png

Answers

  • Hi @Nikunj.Jain ,

    There are example Notebooks showing how one may use Datastream in Codebook:

    1636655403436.png

    Then under 01. Data Retrieval & Discovery

    and then 01.03.Datastream Library


    Please do let me know if those examples are enough