Hello:
I am attempting to access Bloomberg, an ActiveX control (a fincial data source) via Perl. I can not figure out how to pass a variant array of strings to the above ActiveX control. Here is my PERL code.
use Win32::OLE;
use Win32::OLE::Variant;
$blpData = Win32::OLE->new('Bloomberg.Data.1') or
die "can NOT load the blpData" ;
#print $blpData->Timeout . "\n";
$aSec = Variant(VT_BSTR, "IBM Equity");
@tmpArray = ("PX_Last");
$aFields = Variant(VT_ARRAY|VT_UI1, "PX_Last" );
$sDate = Variant(VT_DATE, "2007/07/01");
$eDate = Variant(VT_DATE, "2007/07/10");
@bbData = Variant(VT_EMPTY, undef);
@bbData = $blpData->BLPGetHistoricalData($aSec, $aFields, $sDate, $eDate);
print "Array Size: " , $#bbData . "\n";
foreach $bbData (@bbData) {
print $bbData
}
print "end" ;
Here the documentation on the BLPGetHistoricalData call
VARIANT BLPGetHistoricalData (VARIANT Security, VARIANT Fields,
VARIANT StartDate,
VARIANT EndDate,
VARIANT BarSize,
VARIANT BarFields);
Security:
in Specifies either a single security, or array of securities as the basis of the request. See Security Syntax
Fields:
in An array of Bloomberg field references, or mnemonics. All applicable fields can be found in the bbfields.tbl data dictionary. For a list of the three fields which can be used for an Intraday Time-Bars request, see the Time-Bar Fields page.
StartDate:
in Either an absolute date indicating the first date about which data will be returned, or a numerical value relating to the number of days back in history to report from. The latter type indicates an intraday activity request. For more details, click the StartDate link in the above method signature.
EndDate:
in, optional Indicates the final date about which data will be reported. Omitting this parameter causes all data to be reported up until the current time of request.
Please note that the Fields parameter expects a variant.
Question: How do I create a variant array of strings? I am getting an error on the Fields parameter. Need help to make some VBA macros go away.
Thanks in Advance
KD
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.