Bloomberg C# API - 如何使用不同选项/字段调用 BDP

发布于 2024-11-30 08:17:41 字数 898 浏览 2 评论 0原文

我正在尝试从 Excel 加载项迁移到 Bloomberg C# Desktop API。对于像 BDP("AB IB Equity","best_analyst_ rating") 这样的简单调用,我可以使用这样的方法而不会出现问题:

    private void sendRefDataRequest(Session session)
    {            
        Service refDataService = session.GetService("//blp/refdata");
        Request request = refDataService.CreateRequest("ReferenceDataRequest");

        // Add securities to request
        Element securities = request.GetElement("securities");
        securities.AppendValue("AB IB Equity");
        Element fields = request.GetElement("fields");
        fields.AppendValue("best_analyst_rating");
        System.Console.WriteLine("Sending Request: " + request);
        session.SendRequest(request, null);
    }

但是对于涉及 BDP 附加选项的更复杂的调用,例如 BDP("AB IB Equity","bs_tot_asset","EQY_Consolidated","Y","EQY_FUND_Relative_Period","-0FY") 我不知道如何将其转换为 C# 调用。感谢对此的任何帮助。

I am trying to migrate from Excel add-in to Bloomberg C# Desktop API. For simple calls like BDP("AB IB Equity","best_analyst_rating") I am able to do without issues using something like this:

    private void sendRefDataRequest(Session session)
    {            
        Service refDataService = session.GetService("//blp/refdata");
        Request request = refDataService.CreateRequest("ReferenceDataRequest");

        // Add securities to request
        Element securities = request.GetElement("securities");
        securities.AppendValue("AB IB Equity");
        Element fields = request.GetElement("fields");
        fields.AppendValue("best_analyst_rating");
        System.Console.WriteLine("Sending Request: " + request);
        session.SendRequest(request, null);
    }

But for more complex calls involving additional options to BDP like
BDP("AB IB Equity","bs_tot_asset","EQY_Consolidated","Y","EQY_FUND_Relative_Period","-0FY") I have no clue how to translate it to C# calls. Appreciate any help on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

私野 2024-12-07 08:17:41

您需要设置覆盖。对于任何给定字段,您都可以使用 Bloomberg 终端中的 FLDS 找到这些字段。

Element overrides = request.GetElement("overrides");

然后循环执行必要的覆盖,将 fieldId 设置为 FLDS 中的助记符,并将值设置为您的特定请求:

Element override = overrides.AppendElement();
override.SetElement("fieldId","EQY_CONSOLIDATED");
override.SetElement("value","Y");

You need to set the overrides. For any given field you can find these using FLDS in the Bloomberg terminal.

Element overrides = request.GetElement("overrides");

Then loop through the necessary overrides, setting the fieldId to the Mnemonic from FLDS and the value to your specific request:

Element override = overrides.AppendElement();
override.SetElement("fieldId","EQY_CONSOLIDATED");
override.SetElement("value","Y");
〆凄凉。 2024-12-07 08:17:41

我为此创建了一个扩展方法:

public static void AddOverride(this Bloomberglp.Blpapi.Request request, string fieldId, string fieldValue)
{
    var override = request["overrides"].AppendElement();
    override.SetElement("fieldId",fieldId);
    override.SetElement("value", fieldValue);
}

I created an extension method for this:

public static void AddOverride(this Bloomberglp.Blpapi.Request request, string fieldId, string fieldValue)
{
    var override = request["overrides"].AppendElement();
    override.SetElement("fieldId",fieldId);
    override.SetElement("value", fieldValue);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文