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

Re: [amibroker] Re: Programatically Add Symbol to Chart and QT's HTTP API



PureBytes Links

Trading Reference Links

Hello,

The order of calls is wrong. If you are adding new symbol
you should get the collection (documents) AFTER that, not before.

Instead of:
my $documents = $ami->Documents;
my $stock = $ami->Stocks->Add($symbol);

Use

my $stock = $ami->Stocks->Add($symbol);
$ami->RefreshAll();
my $documents = $ami->Documents;


Also, after adding symbol you need to call RefreshAll

Otherwise symbol tree won't be refreshed.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "davemabe2000" <davemabe@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, May 13, 2008 10:57 PM
Subject: [amibroker] Re: Programatically Add Symbol to Chart and QT's HTTP API


> Oh - didn't see the request for code.  Here's my subroutine. 
> Basically I start the day with SPY in every chart so my software knows
> which chart is available.  That is, if it encounters a chart with
> something other than SPY it is skipped.
> 
> my $ami = Win32::OLE->new("Broker.Application");
> 
> add_stock_to_amibroker("GOOG");
> ...
> 
> sub add_stock_to_amibroker {
> my ($symbol) = @_;
> 
> my $documents = $ami->Documents;
> 
> my $stock = $ami->Stocks->Add($symbol);
> foreach my $document (in $documents) {
> my $current_symbol = $$document{name};
> print "Current symbol is $current_symbol\n";
> if ($current_symbol eq 'SPY') {
> print "Changed to $symbol\n";
> $$document{name} = $symbol;
> if (Win32::OLE->LastError) {
> print Win32::OLE->LastError . "\n";
> }
> return;
> }
> }
> }
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>>
>> Hello,
>> 
>> I am not sure which version were you using at the time when you were
> reporting that,
>> but this bug was supposed to be fixed in 5.00.1.
>> On the other hand there were some changes in 5.05 regarding the way
> internal arrays
>> are handled that could cause re-surfacing of this problem in some
> area still using old
>> methodology. That's why I asked original poster for actual code that
> he is using.
>> 
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message ----- 
>> From: "Dennis Brown" <see3d@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, May 13, 2008 9:57 PM
>> Subject: Re: [amibroker] Re: Programatically Add Symbol to Chart and
> QT's HTTP API
>> 
>> 
>> > Sorry Tomasz,
>> > 
>> > I did not know it was fixed.  The entry was still marked open, and I  
>> > stopped using Favorites in the way that made it fail a long time
> ago.   
>> > I am not a glutton for punishment, so if something does not work for  
>> > me, I just find some other way to operate.
>> > 
>> > Best regards,
>> > Dennis
>> > 
>> > On May 13, 2008, at 3:25 PM, Tomasz Janeczko wrote:
>> > 
>> >> That "old bug" was eliminated long time ago.
>> >>
>> >> Best regards,
>> >> Tomasz Janeczko
>> >> amibroker.com
>> >> ----- Original Message -----
>> >> From: "Dennis Brown" <see3d@xxx>
>> >> To: <amibroker@xxxxxxxxxxxxxxx>
>> >> Sent: Tuesday, May 13, 2008 8:02 PM
>> >> Subject: Re: [amibroker] Re: Programatically Add Symbol to Chart
> and  
>> >> QT's HTTP API
>> >>
>> >>
>> >>> This sounds like it is related to a bug I documented some time ago
>> >>> #1001.  My problem had to do with adding and removing symbols to the
>> >>> favorites list which caused some internal pointer to get off by
> one  
>> >>> on
>> >>> the symbol list.  The new feature might trigger the old bug
> under the
>> >>> right circumstances.  This should probably be handled off line  
>> >>> through
>> >>> the beta bug channel now.  Perhaps there will be enough
> information  
>> >>> to
>> >>> finally squash it.
>> >>>
>> >>> Best regards,
>> >>> Dennis
>> >>>
>> >>> On May 13, 2008, at 1:09 PM, davemabe2000 wrote:
>> >>>
>> >>>> Yes, I am using 5.09.0 build date: April 30, 2008
>> >>>>
>> >>>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>
>> >>>> wrote:
>> >>>>>
>> >>>>> Hello,
>> >>>>>
>> >>>>> Are you using 5.09 ? If not, upgrade.
>> >>>>>
>> >>>>> Best regards,
>> >>>>> Tomasz Janeczko
>> >>>>> amibroker.com
>> >>>>> ----- Original Message -----
>> >>>>> From: "davemabe2000" <davemabe@>
>> >>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>> >>>>> Sent: Tuesday, May 13, 2008 6:17 PM
>> >>>>> Subject: [amibroker] Re: Programatically Add Symbol to Chart and
>> >>>> QT's HTTP API
>> >>>>>
>> >>>>>
>> >>>>>> I'm having trouble getting this to work consistently.  It will
>> >>>>>> occasionally work, but at least half of the time when my code
> sets
>> >>>>>> the
>> >>>>>> name of the window the symbol gets changed to the symbol
>> >>>>>> alphabetically right before the one I want.
>> >>>>>>
>> >>>>>> For example, I'll set it to RIMM and it shows up as RIGL
> (which is
>> >>>>>> right before RIMM in my DB), SPY becomes SPWR, etc.
>> >>>>>>
>> >>>>>> Any ideas?
>> >>>>>>
>> >>>>>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>  
>> >>>>>> wrote:
>> >>>>>>>
>> >>>>>>> Hello,
>> >>>>>>>
>> >>>>>>> All properties/methods exposed are documented.
>> >>>>>>>
>> >>>>>>> Template can be loaded/saved using Window.LoadTemplate
>> >>>>>>> Window.SaveTemplate
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> Best regards,
>> >>>>>>> Tomasz Janeczko
>> >>>>>>> amibroker.com
>> >>>>>>> ----- Original Message -----
>> >>>>>>> From: "davemabe2000" <davemabe@>
>> >>>>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>> >>>>>>> Sent: Friday, May 09, 2008 9:56 PM
>> >>>>>>> Subject: [amibroker] Re: Programatically Add Symbol to Chart and
>> >>>>>> QT's HTTP API
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>> Ahh.  This is very nice.  Are there any other properties
> exposed
>> >>>>>>>> besides what's in the current set of docs?
>> >>>>>>>>
>> >>>>>>>> http://www.amibroker.com/guide/objects.html
>> >>>>>>>>
>> >>>>>>>> For example, I'd like to control the template of the document.
>> >>>> Also
>> >>>>>>>> maybe the location coordinates.
>> >>>>>>>>
>> >>>>>>>> This is really great - it's gonna save me a lot of time!
>> >>>>>>>>
>> >>>>>>>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>
>> >>>> wrote:
>> >>>>>>>>>
>> >>>>>>>>> QuoteTracker HTTP API is slow. Painfully slow. And it can
> not  
>> >>>>>>>>> be
>> >>>>>>>> used accross network
>> >>>>>>>>> because it uses port 127.0.0.1 (local host) due to exchange
>> >>>>>>>> compliancy requirements
>> >>>>>>>>> that strictly prohibit distribution of quotes over network
>> >>>>>>>>> without
>> >>>>>>>> special agreement.
>> >>>>>>>>>
>> >>>>>>>>> AmiBroker has superior, native Win32 API that is 3-5 orders of
>> >>>>>>>> magnitude faster
>> >>>>>>>>> (see ADK download in http://www.amibroker.com/download.html )
>> >>>>>>>>> It can be used from any language that supports building DLLs.
>> >>>>>>>>>
>> >>>>>>>>> If your language can't do that, there is also OLE interface
>> >>>>>>>>> http://www.amibroker.com/guide/objects.html
>> >>>>>>>>>
>> >>>>>>>>> And it surely allows what you are after (use
>> >>>> Documents.Open("symbol")
>> >>>>>>>>> or in newest version (5.09) you can set the ticker of already
>> >>>>>>>>> open
>> >>>>>>>> document
>> >>>>>>>>> usign Name property of Document object)
>> >>>>>>>>>
>> >>>>>>>>> Best regards,
>> >>>>>>>>> Tomasz Janeczko
>> >>>>>>>>> amibroker.com
>> >>>>>>>>> ----- Original Message -----
>> >>>>>>>>> From: "davemabe2000" <davemabe@>
>> >>>>>>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>> >>>>>>>>> Sent: Friday, May 09, 2008 2:56 PM
>> >>>>>>>>> Subject: [amibroker] Programatically Add Symbol to Chart and  
>> >>>>>>>>> QT's
>> >>>>>>>> HTTP API
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>> I've got several charts spread across my monitors.  I'd like
>> >>>> to be
>> >>>>>>>>>> able to programatically populate them with symbols,
> preferably
>> >>>>>> using
>> >>>>>>>>>> OLE.  Is there a way to do this?
>> >>>>>>>>>>
>> >>>>>>>>>> One thing I love about QuoteTracker is it's HTTP API, which
>> >>>> almost
>> >>>>>>>>>> does what I need:
>> >>>>>>>>>>
>> >>>>>>>>>> http://www.quotetracker.com/help/qtserver.shtml
>> >>>>>>>>>>
>> >>>>>>>>>> It would be nice to have something like that to interact with
>> >>>>>>>>>> Amibroker since it's cross platform, can be used across a
>> >>>>>> network, and
>> >>>>>>>>>> could be easily accessed from any programming language.
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> ------------------------------------
>> >>>>>>>>>>
>> >>>>>>>>>> Please note that this group is for discussion between users
>> >>>> only.
>> >>>>>>>>>>
>> >>>>>>>>>> To get support from AmiBroker please send an e-mail
> directly  
>> >>>>>>>>>> to
>> >>>>>>>>>> SUPPORT {at} amibroker.com
>> >>>>>>>>>>
>> >>>>>>>>>> For NEW RELEASE ANNOUNCEMENTS and other news always check
>> >>>> DEVLOG:
>> >>>>>>>>>> http://www.amibroker.com/devlog/
>> >>>>>>>>>>
>> >>>>>>>>>> For other support material please check also:
>> >>>>>>>>>> http://www.amibroker.com/support.html
>> >>>>>>>>>> Yahoo! Groups Links
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> ------------------------------------
>> >>>>>>>>
>> >>>>>>>> Please note that this group is for discussion between users  
>> >>>>>>>> only.
>> >>>>>>>>
>> >>>>>>>> To get support from AmiBroker please send an e-mail directly to
>> >>>>>>>> SUPPORT {at} amibroker.com
>> >>>>>>>>
>> >>>>>>>> For NEW RELEASE ANNOUNCEMENTS and other news always check  
>> >>>>>>>> DEVLOG:
>> >>>>>>>> http://www.amibroker.com/devlog/
>> >>>>>>>>
>> >>>>>>>> For other support material please check also:
>> >>>>>>>> http://www.amibroker.com/support.html
>> >>>>>>>> Yahoo! Groups Links
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> ------------------------------------
>> >>>>>>
>> >>>>>> Please note that this group is for discussion between users only.
>> >>>>>>
>> >>>>>> To get support from AmiBroker please send an e-mail directly to
>> >>>>>> SUPPORT {at} amibroker.com
>> >>>>>>
>> >>>>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >>>>>> http://www.amibroker.com/devlog/
>> >>>>>>
>> >>>>>> For other support material please check also:
>> >>>>>> http://www.amibroker.com/support.html
>> >>>>>> Yahoo! Groups Links
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> ------------------------------------
>> >>>>
>> >>>> Please note that this group is for discussion between users only.
>> >>>>
>> >>>> To get support from AmiBroker please send an e-mail directly to
>> >>>> SUPPORT {at} amibroker.com
>> >>>>
>> >>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >>>> http://www.amibroker.com/devlog/
>> >>>>
>> >>>> For other support material please check also:
>> >>>> http://www.amibroker.com/support.html
>> >>>> Yahoo! Groups Links
>> >>>>
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>> ------------------------------------
>> >>>
>> >>> Please note that this group is for discussion between users only.
>> >>>
>> >>> To get support from AmiBroker please send an e-mail directly to
>> >>> SUPPORT {at} amibroker.com
>> >>>
>> >>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >>> http://www.amibroker.com/devlog/
>> >>>
>> >>> For other support material please check also:
>> >>> http://www.amibroker.com/support.html
>> >>> Yahoo! Groups Links
>> >>>
>> >>>
>> >>>
>> >>
>> >> ------------------------------------
>> >>
>> >> Please note that this group is for discussion between users only.
>> >>
>> >> To get support from AmiBroker please send an e-mail directly to
>> >> SUPPORT {at} amibroker.com
>> >>
>> >> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> >> http://www.amibroker.com/devlog/
>> >>
>> >> For other support material please check also:
>> >> http://www.amibroker.com/support.html
>> >> Yahoo! Groups Links
>> >>
>> >>
>> >>
>> > 
>> > 
>> > ------------------------------------
>> > 
>> > Please note that this group is for discussion between users only.
>> > 
>> > To get support from AmiBroker please send an e-mail directly to 
>> > SUPPORT {at} amibroker.com
>> > 
>> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> > http://www.amibroker.com/devlog/
>> > 
>> > For other support material please check also:
>> > http://www.amibroker.com/support.html
>> > Yahoo! Groups Links
>> > 
>> > 
>> >
>>
> 
> 
> 
> ------------------------------------
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 

------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/