# Is it possible to fetch Bloomberg data using Q?

**URL:** <https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [November 9, 2011, 10:19am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399 "2011-11-09T10:19:00Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 9, 2011, 10:19am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/1 "2011-11-09T10:19:00Z")

</div>

Is it possible to fetch Bloomberg data using Q? If so, can you give asimple example such at to get the close price of Google?Thanks!

---

<div class="post-metadata">

**Author:** ![Attila](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Attila](https://forum.kx.com/u/Attila)\
**Post date:** [November 9, 2011, 3:00pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/2 "2011-11-09T15:00:00Z")

</div>

[http://kx.com/q/c/feed/bb.c](http://kx.com/q/c/feed/bb.c)

compiled for win32:  
[http://kx.com/q/w32/bb.dll](http://kx.com/q/w32/bb.dll)  
=A0 Attila

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 10, 2011, 5:37am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/3 "2011-11-10T05:37:00Z")

</div>

Hi Attila,Thanks for the reply.How to use that dll? Can you please give an example?On Nov 9, 11:00?pm, Attila Vrabecz \<attila.vrab…\> wrote:\> [http://kx.com/q/c/feed/bb.c&gt;&gt](http://kx.com/q/c/feed/bb.c&gt;&gt); compiled for win32:[http://kx.com/q/w32/bb.dll&gt](http://kx.com/q/w32/bb.dll&gt); ? Attila\>\>\>\>\>\>\>\> On Wed, Nov 9, 2011 at 5:19 AM, Wei Li \<lavi…\> wrote:\>\> \> ?Is it possible to fetch Bloomberg data using Q? If so, can you give a\> \> simple example such at to get the close price of Google?\> \> Thanks!\>\> \> –\> \>

Submitted via Google Groups\</lavi…\>\</attila.vrab…\>

---

<div class="post-metadata">

**Author:** ![P\_Bukowinski1](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@P\_Bukowinski1](https://forum.kx.com/u/P_Bukowinski1)\
**Post date:** [November 10, 2011, 7:12am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/4 "2011-11-10T07:12:00Z")

</div>

http://code.kx.com/wiki/Reference/TwoColon

Appreciate, no one yet mention you to first use search on kx wiki.  
;-)

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [November 10, 2011, 10:32am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/5 "2011-11-10T10:32:00Z")

</div>

http://kx.com/q/tick/bb.q  
http://kx.com/q/tick/bb.txt

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 10, 2011, 3:28pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/6 "2011-11-10T15:28:00Z")

</div>

Thanks guys for the reply.As a beginner of q, I do not know how to run the examples above. Itried\>q tick/bb.q localhost:1234but failed. I copied bbq to c:\q\tick\Can you please give more details such as do I need to download someother files from [http://kx.com/q/tick](http://kx.com/q/tick) or other sites? and put them inwhich directory? My q is in C:\qAnd can you please also provide the commands to run bb.q and theexample to query a stock close price from BBG? does it depend on otherfiles?I think other beginners may have the same question as me and a fullinstruction will be very helpful.Thanks a lotOn Nov 10, 6:32?pm, Charles Skelton \<char…\> wrote:\> [http://kx.com/q/tick/bb.qhttp://kx.com/q/tick/bb.txt&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt](http://kx.com/q/tick/bb.qhttp://kx.com/q/tick/bb.txt&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt); On Thu, Nov 10, 2011 at 6:37 AM, Wei Li \<lavi…\> wrote:\> \> Hi Attila,\> \> Thanks for the reply.\> \> How to use that dll? Can you please give an example?\>\> \> On Nov 9, 11:00 pm, Attila Vrabecz \<attila.vrab…\> wrote:\> \> \>[http://kx.com/q/c/feed/bb.c&gt;&gt](http://kx.com/q/c/feed/bb.c&gt;&gt); \> \> compiled for win32:[http://kx.com/q/w32/bb.dll&gt](http://kx.com/q/w32/bb.dll&gt); \> \> ? Attila\>\> \> \> On Wed, Nov 9, 2011 at 5:19 AM, Wei Li \<lavi…\> wrote:\>\> \> \> \> ?Is it possible to fetch Bloomberg data using Q? If so, can you give a\> \> \> \> simple example such at to get the close price of Google?\> \> \> \> Thanks!\>\> \> \> \> –\> \> \> \> You received this message because you are subscribed to the Google\> \> Groups “Kdb+ Personal Developers” group.\> \> \> \> To post to this group, send email to [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com)\> \> .\> \> \> \> To unsubscribe from this group, send email to\> \> [personal-kdbplus+unsubscribe@googlegroups.com](mailto:personal-kdbplus+unsubscribe@googlegroups.com).\> \> \> \> For more options, visit this group athttp://\> \> [groups.google.com/group/personal-kdbplus?hl=en](http://groups.google.com/group/personal-kdbplus?hl=en).\>\> \> –\> \>

Submitted via Google Groups\</lavi…\>\</attila.vrab…\>\</lavi…\>\</char…\>

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [November 12, 2011, 2:23am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/7 "2011-11-12T02:23:00Z")

</div>

To: personal-kdbplus@googlegroups.comX-Mailer: Apple Mail (2.1084)On Nov 9, 2011, at 5:19 AM, Wei Li wrote:\> Is it possible to fetch Bloomberg data using Q? If so, can you give a\> simple example such at to get the close price of Google?do you have a bb subscription?

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 12, 2011, 7:14am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/8 "2011-11-12T07:14:00Z")

</div>

Yes, I haveOn Nov 12, 10:23?am, Aaron Davies \<aaron.dav…\> wrote:\> On Nov 9, 2011, at 5:19 AM, Wei Li wrote:\>\> \> Is it possible to fetch Bloomberg data using Q? If so, can you give a\> \> simple example such at to get the close price of Google?\>\> do you have a bb subscription?\</aaron.dav…\>

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 14, 2011, 2:09pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/9 "2011-11-14T14:09:00Z")

</div>

Any more advise on this?On Nov 12, 3:14?pm, Wei Li \<lavi…\> wrote:\> Yes, I have\>\> On Nov 12, 10:23?am, Aaron Davies \<aaron.dav…\> wrote:\>\>\>\>\>\>\>\> \> On Nov 9, 2011, at 5:19 AM, Wei Li wrote:\>\> \> \> Is it possible to fetch Bloomberg data using Q? If so, can you give a\> \> \> simple example such at to get the close price of Google?\>\> \> do you have a bb subscription?\</aaron.dav…\>\</lavi…\>

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [November 15, 2011, 3:55am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/10 "2011-11-15T03:55:00Z")

</div>

To: [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com)  
X-Mailer: Apple Mail (2.1084)

\>\>\> Is it possible to fetch Bloomberg data using Q? If so, can you give =  
a simple example such at to get the close price of Google?  
\>\>  
\>\> do you have a bb subscription?  
\>  
\> Any more advise on this?

what’s your actual problem?

(btw i’ve never used bb w/q myself, only reuters, and that was quite a =  
while ago)=

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 15, 2011, 1:09pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/11 "2011-11-15T13:09:00Z")

</div>

My actual problem as listed above is how to fetch BBG data in q?On Nov 15, 11:55?am, Aaron Davies \<aaron.dav…\> wrote:\> \>\>\> Is it possible to fetch Bloomberg data using Q? If so, can you give a simple example such at to get the close price of Google?\>\> \>\> do you have a bb subscription?\>\> \> Any more advise on this?\>\> what’s your actual problem?\>\> (btw i’ve never used bb w/q myself, only reuters, and that was quite a while ago)\</aaron.dav…\>

---

<div class="post-metadata">

**Author:** ![felix1](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@felix1](https://forum.kx.com/u/felix1)\
**Post date:** [November 15, 2011, 3:54pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/12 "2011-11-15T15:54:00Z")

</div>

you need access to a bloomberg terminal of a data server first.  
once you have that, you can start playing with the data.

so, do you have any of the above?

2011/11/15 Wei Li :  
\> My actual problem as listed above is how to fetch BBG data in q?  
\>  
\> On Nov 15, 11:55=A0am, Aaron Davies \<aaron.dav…\> wrote:  
\>\> \>\>\> Is it possible to fetch Bloomberg data using Q? If so, can you give =  
a simple example such at to get the close price of Google?  
\>\>  
\>\> \>\> do you have a bb subscription?  
\>\>  
\>\> \> Any more advise on this?  
\>\>  
\>\> what’s your actual problem?  
\>\>  
\>\> (btw i’ve never used bb w/q myself, only reuters, and that was quite a w=  
hile ago)  
\>  
\> –  
\>

Submitted via Google Groups\</aaron.dav…\>

---

<div class="post-metadata">

**Author:** ![Wei\_Li](https://avatars.discourse-cdn.com/v4/letter/w/c5a1d2/32.png) [@Wei\_Li](https://forum.kx.com/u/Wei_Li)\
**Post date:** [November 16, 2011, 5:38am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/13 "2011-11-16T05:38:00Z")

</div>

Aaron Daviesdo you have a bb subscription?Wei LiYes, I have--------------------------------------------------------------------------------As Aaron asked and I replied, YES I HAVE!

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [November 17, 2011, 3:19am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/14 "2011-11-17T03:19:00Z")

</div>

hi wei,

can you run this?

sub:`bb 2:(`sub;`sym)

with bb.dll ?

ta, jack.

---

<div class="post-metadata">

**Author:** ![garryholmer1](https://avatars.discourse-cdn.com/v4/letter/g/b77776/32.png) [@garryholmer1](https://forum.kx.com/u/garryholmer1)\
**Post date:** [December 7, 2011, 1:05pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/15 "2011-12-07T13:05:00Z")

</div>

Hi Guys,  
I have access to Bloomberg, but i still cannot retrieve Data using Q.

Could you please describe the steps for an absolute beginner? (Step 1,  
Step 2, Step 3…etc)

I have saved the bb.dll file in C:\WINDOWS\system32 and tried to run  
it by regsvr32 bb.dll.  
I get the following error message - LoadLibrary(“bb.dll”) failed -  
The specific module could not be found.

Thanks in advance!

GarryHolmer

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [December 8, 2011, 12:43am UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/16 "2011-12-08T00:43:00Z")

</div>

1 ? ensure you have bbapi.dll in your path (should be included in your bb client)

2 ? put bb.dll in %QHOME%/w32 (eg: c:\q\w32) or c:\windows\system32

3 ? start q

4 ??q)sub:`bb 2:(`sub;1)

5 ? q)sub x

i don’t have bb access, so i can’t ?test this. ?the x on the last line is a symbol. ?i assume it is something like `C:US . ?

also, i think sub registers a callback so it handles data coming down the line in the event loop. ?i haven’t looked close enough to tell you where bb.dll puts the incoming data. ?and i haven’t used callbacks before, so i’m doubly blind :j

i suspect you may need to define q functions mon, stt and upd to handle the data as q receives it. ?

could be a good article to put on the wiki once we work out how to do it!

---

<div class="post-metadata">

**Author:** ![garryholmer1](https://avatars.discourse-cdn.com/v4/letter/g/b77776/32.png) [@garryholmer1](https://forum.kx.com/u/garryholmer1)\
**Post date:** [December 14, 2011, 2:09pm UTC](https://forum.kx.com/t/is-it-possible-to-fetch-bloomberg-data-using-q/7399/17 "2011-12-14T14:09:00Z")

</div>

Hi Jack,

Thank you very much for your detailed answer! it helped me to get  
started.  
an article on wiki sounds like a great idea. I am sure that there are  
many people around who would benefit from such article.

what is, for example, missing is how to get close prices or other  
information from Bloomberg.

Does anybody know how to build such functions in order to get closing  
prices from Bloomberg? It is still, unfortunately, a black box for  
me.

Harry Holmer
