Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Accessing both market and index data in strategy()

    Support
    2
    4
    247
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      buyers_are_back last edited by

      Hi, I'd like to access to access both market and index data in strategy(). Would the following code work? It worked locally but when submitted the "checking" progress does not move at all.

      # load data
      data = qndata.stocks.load_ndx_data(min_date="2005-01-01")
      
      def strategy(data):
          # get index data
          index_name = 'NDX'
          index_data = qndata.index.load_data(assets=[index_name], min_date='2005-01-01', forward_order=True)
          index_data = xr.align(index_data.sel(asset=index_name), data.isel(field=0), join='right')[0]
          ndx_values = index_data.values
      

      I also tried a load_data function where I load both datasets and use load_data=load_data in qnbt.backtest() , but it quickly leads to a memory leak.

      V 2 Replies Last reply Reply Quote 0
      • V
        Vyacheslav_B @buyers_are_back last edited by

        @buyers_are_back Hello.

        Here is an example: example link.

        You can view the list of available indexes here.

        If you want to use the load_data function, take a look at this example. You can implement the index download by analogy:

        example link.

        B 1 Reply Last reply Reply Quote 0
        • B
          buyers_are_back @Vyacheslav_B last edited by

          @vyacheslav_b Thank you! I'll have a look

          1 Reply Last reply Reply Quote 0
          • V
            Vyacheslav_B @buyers_are_back last edited by

            @buyers_are_back Hello.
            Here is a new example of stock prediction using index data.
            I recommend using the single-pass version.
            https://quantiacs.com/documentation/en/data/indexes.html

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors
            • Documentation
            • About
            • Career
            • My account
            • Privacy policy
            • Terms and Conditions
            • Cookies policy
            Home
            Copyright © 2014 - 2021 Quantiacs LLC.
            Powered by NodeBB | Contributors