[ts-gen] select bars or tick
Bill Pippin
pippin at owlriver.net
Tue Aug 18 13:50:05 EDT 2009
Ric,
About subscribing to STK:SMART:BHP:USD ...
> I have a problem pulling either bar[s] or tick [data] on BHP ...
The short answer is to set the Locality to AU in your .shimrc file,
if you don't want to use the IB contract id form.
One way to diagnose this would have been to look at the symbols
data. An example of the best select statement form to use is
the script sql/bin/get_id.sql :
select Product.uid as pid, Static.ibc, SecType.type as type,
Symbol.name, Symbol.curr, Symbol.region
from Product, SecType, Symbol, Static
where Product.tid = SecType.uid
and Product.sfo = Static.uid and Static.tid = SecType.uid
and Static.ncr = Symbol.uid and Symbol.tid = SecType.uid
union
select Product.uid as pid, Future.ibc, SecType.type as type,
Symbol.name, Symbol.curr, Symbol.region
from Product, SecType, Symbol, Future, Expire
where SecType.type = 'FUT' and SecType.uid = Product.tid
and Product.sfo = Future.uid and SecType.uid = Future.tid
and Future.eid = Expire.uid and SecType.uid = Expire.tid
and Expire.ncr = Symbol.uid and SecType.uid = Symbol.tid
order by pid, ibc;
Its results have been captured to the file sql/syms.txt . Using grep:
sql$ grep BHP syms.txt | grep STK
gives the following:
35 4986 STK BHP USD AU
17460 4036812 STK BHP AUD AU
19263 37854363 STK BHP CAD CA
22707 14935647 STK BHP CHF AU
27291 38709139 STK BHP MXN AU
Note that the region (locality) is not the US, so the default value
in your .shimrc file of US is not appropriate here. Or, if you
wanted to debug the problems from the view point of the shim,
uncomment the calls to print_line() in leaf.c, recompile, and using
the following test script:
#!./shim -f
select tick STK:SMART:BHP:USD 1; wait 2;
#ancel tick STK:SMART:BHP:USD; wait 1;
exit;
you'll get a (voluminous, depending on the number of previous
portfolio value messages) listing that displays, immediately
prior to the cmd error procesing:
< 2 25811 51620 STK STK, USD JPY, US JP, BHP != 6155...
< 2 25811 25810 STK STK, USD JPY, US JP, BHP != 6155...
< 2 12906 25810 STK STK, USD USD, US US, BHP != UVCL...
< 2 12906 12905 STK STK, USD USD, US US, BHP != UVCL...
< 2 6453 12905 STK STK, USD USD, US US, BHP != GCV PRB...
< 2 6453 6452 STK STK, USD USD, US US, BHP != GCV PRB...
> 2 3227 6452 STK STK, USD USD, US US, BHP != AUBN...
> 3228 3227 6452 STK STK, USD USD, US US, BHP != AUBN...
< 3228 4840 6452 STK STK, USD USD, US US, BHP != CWIR...
< 3228 4840 4839 STK STK, USD USD, US US, BHP != CWIR...
< 3228 4033 4839 STK STK, USD USD, US US, BHP != CCE...
< 3228 4033 4032 STK STK, USD USD, US US, BHP != CCE...
< 3228 3630 4032 STK STK, USD USD, US US, BHP != BMBN...
< 3228 3630 3629 STK STK, USD USD, US US, BHP != BMBN...
> 3228 3428 3629 STK STK, USD USD, US US, BHP != BDM...
> 3429 3428 3629 STK STK, USD USD, US US, BHP != BDM...
> 3429 3529 3629 STK STK, USD USD, US US, BHP != BHLB...
> 3530 3529 3629 STK STK, USD USD, US US, BHP != BHLB...
< 3530 3579 3629 STK STK, USD USD, US US, BHP != BKMM...
< 3530 3579 3578 STK STK, USD USD, US US, BHP != BKMM...
< 3530 3554 3578 STK STK, USD USD, US US, BHP != BIPH...
< 3530 3554 3553 STK STK, USD USD, US US, BHP != BIPH...
< 3530 3541 3553 STK STK, USD USD, US US, BHP != BIDZ...
< 3530 3541 3540 STK STK, USD USD, US US, BHP != BIDZ...
< 3530 3535 3540 STK STK, USD USD, US US, BHP != BHWB...
< 3530 3535 3534 STK STK, USD USD, US US, BHP != BHWB...
< 3530 3532 3534 STK STK, USD USD, US US, BHP != BHS...
< 3530 3532 3531 STK STK, USD USD, US US, BHP != BHS...
> 3530 3530 3531 STK STK, USD USD, US US, BHP != BHMMQ...
> 3531 3530 3531 STK STK, USD USD, US US, BHP != BHMMQ...
< 3531 3531 3531 STK STK, USD USD, US US, BHP != BHRB...
< 3531 3531 3530 STK STK, USD USD, US US, BHP != BHRB...
The search is matching successfully for STK, USD, and then there's
the stubborn insistence to ignore AU companies ... natural, since the
locality in the .shimrc for the example above is US. When I fix
that and retry, the search is better focused, and succeeds:
< 2 25811 51620 STK STK, USD JPY, AU JP, BHP != 6155...
< 2 25811 25810 STK STK, USD JPY, AU JP, BHP != 6155...
< 2 12906 25810 STK STK, USD USD, AU US, BHP != UVCL...
< 2 12906 12905 STK STK, USD USD, AU US, BHP != UVCL...
< 2 6453 12905 STK STK, USD USD, AU US, BHP != GCV PRB...
< 2 6453 6452 STK STK, USD USD, AU US, BHP != GCV PRB...
< 2 3227 6452 STK STK, USD USD, AU US, BHP != AUBN...
< 2 3227 3226 STK STK, USD USD, AU US, BHP != AUBN...
< 2 1614 3226 STK STK, USD USD, AU FR, BHP != ARKAY...
< 2 1614 1613 STK STK, USD USD, AU FR, BHP != ARKAY...
< 2 807 1613 STK STK, USD USD, AU CA, BHP != LBOG...
< 2 807 806 STK STK, USD USD, AU CA, BHP != LBOG...
< 2 404 806 STK STK, USD USD, AU CA, BHP != CGDF...
< 2 404 403 STK STK, USD USD, AU CA, BHP != CGDF...
< 2 202 403 STK STK, USD USD, AU BR, BHP != UBB...
< 2 202 201 STK STK, USD USD, AU BR, BHP != UBB...
< 2 101 201 STK STK, USD USD, AU BM, BHP != ATB...
< 2 101 100 STK STK, USD USD, AU BM, BHP != ATB...
< 2 51 100 STK STK, USD USD, AU AU, BHP != MTSX...
< 2 51 50 STK STK, USD USD, AU AU, BHP != MTSX...
> 2 26 50 STK STK, USD USD, AU AU, BHP != ANZBY...
>27 26 50 STK STK, USD USD, AU AU, BHP != ANZBY...
<27 38 50 STK STK, USD USD, AU AU, BHP != CTVWF...
<27 38 37 STK STK, USD USD, AU AU, BHP != CTVWF...
>27 32 37 STK STK, USD USD, AU AU, BHP != AWC...
>33 32 37 STK STK, USD USD, AU AU, BHP != AWC...
>33 35 37 STK STK, USD USD, AU AU, BHP != BBWPF...
>36 35 37 STK STK, USD USD, AU AU, BHP != BBWPF...
=36 36 37 STK STK, USD USD, AU AU, BHP == BHP: 4986
=36 36 37 STK STK, USD USD, AU AU, BHP == BHP: 4986
So, the short answer is, symbol based lookup depends on the regional
context in order to disambiguate symbols, and that is set on a
per-session basis in your .shimrc file.
Thanks,
Bill
More information about the ts-general
mailing list