Passing API Arguments to Bloomberg

As part of my project for loading volatility for many parameters, my previous code saves CHAIN_TICKERS for a given equity in a text file (BB.txt) in the following format:

MSFT US 01/20/17 C23
MSFT US 01/20/17 C25
MSFT US 01/20/17 C30
MSFT US 01/20/17 C33
MSFT US 01/20/17 C35
MSFT US 01/20/17 C38
MSFT US 01/20/17 C40
MSFT US 01/20/17 C43
MSFT US 01/20/17 C45
MSFT US 01/20/17 C47
MSFT US 01/20/17 C50
MSFT US 01/20/17 C52.5
MSFT US 01/20/17 C55
MSFT US 01/20/17 C57.5
MSFT US 01/20/17 C60
MSFT US 01/20/17 C65
MSFT US 01/20/17 C70

First, I defined a structure for storing the corresponding data for different parameters:

struct option{
string ticker;
char date;
double strike;
double vol;
} options [1000];

Now, for my further analysis, I want to download the volatility for these parameters. Currently, I just read the text file line by line, and then pass the ticker to the load function inside the loop.

std::fstream myfile("BB.txt");
int linenumber = 0;
string linetext;
string ticker;
while (std::getline(myfile, linetext))
{
    options[linenumber].ticker = linetext;
    linenumber++;
}


for (int i = 0; i < linenumber; i++)
{
    std::cout << options[i].ticker << endl;
    ticker = options[i].ticker;
    try
    {
        example.run2(ticker);
    }
    catch (Exception &e)
    {
        std::cerr << "Library Exception!!!" << e.description() << std::endl;
    }
}

The code for my run2 is as follows:

public void run2(string ticker)
{ ...
request.append("securities", ticker);
request.append("fields", "IVOL_MID");
CorrelationId cid(this);
session.sendRequest(request, cid);

(followed by the eventhandler processMessage taken from the SimpleRefDataOverrideExample.cpp of the Bloomberg API)

Now the problem is in the line:

request.append("securities", ticker);

C2664: 2 'std::string' 'bool', , , bool? , , , "MSFT US EQUITY", .

, run2, ?

( , CHAIN_TICKERS ?)

+4
1

blpapi::Request . blpapi::Request::append std::string . bool - , , .

const char * ticker.c_str():

request.append("securities", ticker.c_str());
+2

All Articles