[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Re: Accessing RT Quotes



PureBytes Links

Trading Reference Links




I 
dunno about the -1 in the call. Here's a line from the release 
doc:
<FONT face=Arial color=#0000ff 
size=2> 

new method in <FONT  
color=#ffffff>Quotations collection for faster <FONT 
 color=#ffffff>retrieval of 
quoteslong <FONT  
color=#ffffff>Retrieve( long Count, Variant *Date, Variant *Open, Variant 
*High, Variant *Low, Variant *Close, Variant *Volume, Variant *OpenInt ); 

 
I 
seems to be a count - maybe of the number of quotes you want where -1 is 
"All".  You might experiment with it - and maybe try to use a small number 
just if that will get you the most recent ones.
<FONT face=Arial color=#0000ff 
size=2> 
As to 
your real time questions - I don't have the real time version so I can't help. 
What I'd suggest is a lot of experimentation. AND if you do find anything please 
report back so that the rest of us pioneers can avoid a few 
arrows.
<FONT face=Arial color=#0000ff 
size=2> 
The 
CSTR thing was mentioned by TJ to me: 
<FONT face=Arial color=#0000ff 
size=2> 

As for this CStr():  the real reason for such strange 
behaviour is that Stocks.Item( ticker) accepts VARIANT
as a TICKER. This is so to allow the user to reference 
ticker by both number and symbol.
As you probably know Variant can hold any type. 
 
AmiBroker does the following:
struct StockInfo * AStocks::FindStockInfoByVariant(const 
VARIANT &Item){ struct StockInfo *si = NULL;
 
    if (Item.vt == 
VT_BSTR)    
{         si = FindStock( CString( 
Item.bstrVal ) ) ;    }    
else    {        // 
coerce to VT_I4        VARIANT va 
;        VariantInit( &va 
);        if 
(SUCCEEDED(VariantChangeType( &va, (VARIANT FAR*)&Item, 0, VT_I4 
)))        
{            si = 
StockInfoFromIndex( (int)va.lVal 
);        }    
}                 

 
 return si;}
- it checks if variant is of string type (VT_BSTR) and then 
treats it as a symbol,
otherwise it tries to coerce it to the 32bit integer index 
(this is because numbers passed in variant
may be floats R4, real R8, short, long integers, 
etc).
 
Strangely enough if you do not use explicit conversion VB puts 
some strange variant (I didn't checked it yet it is)
instead of simple string as anyone may think.
<FONT 
size=2><SPAN 
class=022083917-06082003><FONT face=Arial color=#0000ff 
size=2>d

  
  <FONT 
  face=Tahoma size=2>-----Original Message-----From: Gordon 
  [mailto:amibroker@xxxxxxxxxxxxxx] Sent: Wednesday, August 06, 2003 
  1:24 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Re: Accessing RT QuotesAwesome. Thanks. I read the 
  documentation and missed retrieve -- I didn't scroll down and see it among 
  the new features. Thanks.I take it -1 tells it to go the vendor as 
  opposed to fetch a cached quote? Also, if you happen to know, can one 
  safely assume that a RT quote (in this case from eSignal) is the bid/ask 
  for the underlying, since we don't have a bar necessarily? Or does 
  AmiBroker, assuming the base interval of your database is 1 min., give you 
  the current OHLC, etc., of the most current 1 min. bar? I think this is 
  important, especially since pre-market you have OTC stocks for which 
  there are no pre-market quotes, and others where the most recent 
  activity of any kind may have been several minutes ago. BTW, you 
  have a very subtle and important nuance in your code that I only 
  discovered last night about 1AM -- that's using CStr 
  in:AB.stocks(CStr(strTicker))...I was coding, 
  andAB.stocks("AAII") was working for me, but:Ticker = 
  "AAII"AB.stocks(Ticker)...was not. Finally I tried CStr, and it 
  worked. Definitely something to highlight in the code example for others 
  who might run into the same thing.Gordon  --- In 
  amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@xxxx> wrote:> 
  Gordon,>  > I use the following to get quotes - extremely 
  fast.  As to how to be> certain you've got the latest - maybe 
  check the time?>  > lngQteCount = 
  _>         
  AB.stocks(CStr(strTicker)).quotations.Retrieve(-1, varDate, 
  _>             
  varOpen, varHigh, varLow, varClose, varVolume, varOpenInt)>  
  > Lemme know if you find out anything.>  > d> 
  > -----Original Message-----> From: Gordon 
  [mailto:amibroker@xxxx] > Sent: Wednesday, August 06, 2003 12:11 
  PM> To: amibroker@xxxxxxxxxxxxxxx> Subject: [amibroker] 
  Accessing RT Quotes> > > I got AB configured for use with 
  eSignal, and yes, AB manages the > number of active symbols so that you 
  can stay within your limit. Very > cool. I've written a routine to 
  loop through a list of 1,000+ symbols > looking for pre-market 
  gaps. I load each stock using the stocks > collection, and then access 
  the last quote in the quotations > collection. Easy enough.> 
  > What I am not sure of -- does AB refresh the quotations collection 
  > when you load the stock? Just to be safe, I've been opening the 
  stock > in AB and waiting app. 2.5 seconds to allow AB to contact 
  eSignal and > refresh that stock. However, I've run into problems 
  -- after looping > successfully through a number of stocks, I 
  suddenly got an error > indicating the an object was not set. The AB 
  screen had also been > modified -- the moveable toolbars were 
  rearranged and the MACD window > had been closed. So, this does not 
  look like a good approach.> > The only method I see to 
  apparently update the quotes is refreshall> () -- is there a way to 
  load a single stock, and be sure you have the > latest RT quote for 
  that stock without opening it in AB > programatically? Any insights 
  appreciated! > > Thanks,> > Gordon> 
  > > > > > Yahoo! Groups 
  Sponsor      > > 
  ADVERTISEMENT>  > <<A 
  href="">http://rd.yahoo.com/M=244522.3656190.4921519.1261774/D=egroupweb/S=1705> 
  632198:HM/A=1595053/R=0/SIG=124mh1h7k/*<A 
  href="">http://ashnin.com/clk/muryutaitak> 
  enattogyo?YH=3656190&yhad=1595053> Click 
  Here!      >  > <<A 
  href="">http://us.adserver.yahoo.com/l?M=244522.3656190.4921519.1261774/D=egrou> 
  pmail/S=:HM/A=1595053/rand=816749787>       
  > > Send BUG REPORTS to bugs@xxxx> Send SUGGESTIONS to 
  suggest@xxxx> -----------------------------------------> Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx > (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)> 
  --------------------------------------------> Check group FAQ 
  at:> <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
  Service> <<A 
  href="">http://docs.yahoo.com/info/terms/> 
  .Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.