Navigation

    Quantiacs Community

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

    Fundamental Data: Periodic indicators & Instant indicators

    Strategy help
    3
    4
    310
    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.
    • J
      johback last edited by

      Hallo,

      i wonder how to get Fundamental Data for a Stock.
      at:
      https://quantiacs.com/documentation/en/user_guide/data_stocks.html?highlight=instant indicators#fundamental-data
      there are two tables with keys to retrieve Fundamental-Data but i dont understand how to use them. I can not find examples.

      Best Regards.

      support V 2 Replies Last reply Reply Quote 1
      • support
        support @johback last edited by

        @johback Hi, these features are experimental. You can adapt the following test code:

        https://github.com/quantiacs/toolbox/blob/dev/qnt/tests/test_fundamental_data.py

        or use:

        import qnt.ta as qnta
        import qnt.data as qndata
        import qnt.output as qnout
        import qnt.stats as qns
        
        assets = qndata.stocks.load_ndx_list(tail=dt.timedelta(days=5*365))
        
        data = qndata.stocks.load_ndx_data(tail=dt.timedelta(days=5*365),
                                dims=("time", "field", "asset"),
                                assets=assets_names,
                                forward_order=True)
        
        J 1 Reply Last reply Reply Quote 0
        • J
          johback @support last edited by

          @support Thank you!

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

            @johback

            Hello

            More examples are here https://github.com/quantiacs/toolbox/blob/main/qnt/tests/test_fundamental_data.py

            This is a simple example.

            import qnt.data as qndata
            import datetime as dt
            import qnt.data.secgov_indicators
            import qnt.data as qndata
            import qnt.stats as qns
            
            assets = qndata.stocks.load_ndx_list(tail=dt.timedelta(days=5 * 365))
            assets_names = [i["id"] for i in assets]
            data = qndata.stocks.load_ndx_data(tail=dt.timedelta(days=5 * 365),
                                               dims=("time", "field", "asset"),
                                               assets=assets_names,
                                               forward_order=True)
            
            facts_names = ['operating_expense']  # 'assets', 'liabilities', 'ivestment_short_term' and other
            
            fundamental_data = qnt.data.secgov_load_indicators(assets,
                                                               time_coord=data.time,
                                                               standard_indicators=facts_names)
            
            # Operating expenses include marketing, noncapitalized R&D,
            # travel and entertainment, office supply, rent, salary, cogs...
            weights = fundamental_data.sel(field='operating_expense')
            is_liquid = data.sel(field="is_liquid")
            weights = weights * is_liquid
            
            # calc stats
            stats = qns.calc_stat(data, weights.sel(time=slice("2006-01-01", None)))
            display(stats.to_pandas().tail())
            
            # graph
            performance = stats.to_pandas()["equity"]
            import qnt.graph as qngraph
            
            qngraph.make_plot_filled(performance.index, performance, name="PnL (Equity)", type="log")
            
            
            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