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

[amibroker] Long and Short /Long positions ?



PureBytes Links

Trading Reference Links

From: "b" <b519b@xxxxxxxxx>
>
> That sounds like some nice programming. Your daily update
> speed is short enough so that it is a minor issue.

Yes, I'm doing 3 API calls to get all possible cases:
1) Raw (unadjusted original) quotes
2) Split adjusted
3) Dividend adjusted
4) 2+3

Ie. all combinations are possible. I'm using a secondary DB which
stores the raw data + split dates&ratios + dividend dates&amounts.
>From that I can quickly generate desired data for AB. I personally 
use raw (unadjusted) data in AB for my backtests. In ABs OI I store a flag:
0=none, 1=Dividend, 2=Split, 3=Both

That is: one knows quickly if that bar is affected by any Splits or Dividends.
In case one is interessted in the Split ratio (or Dividend value), or in the
adjusted data series, than one can quickly get them via usual AB arrays
from the secondary DB using a "foreign" like AFL function call. This secondary 
DB is accessible via the ABtool plugin, and offers a very flexible and 
easily extendable fast stocks database. One can practically store any 
data one likes, even variable length data. It is also possible to store intraday
data either in the same or in a new database. Multiple databases can be 
used and queried at the same time.

For about a month now I'm collecting intraday quotes for all US tickers 
from free internet sources using this DB. I can even plot these intraday 
quotes in AB eventhough an AB EOD DB is in use  :-)

BTW, the Sectors and Industries a stock belongs to get automatically 
assigned in AB since CSI has this data available.

> Does your daily update process have a way to detect if a
> stock has split? I assume your program puts the CSI data
> into the following AB fields:
> 
> O = Open backadjusted for splits etc
> H = High backadjusted for splits etc
> L = Low backadjusted for splits etc
> C = Close backajusted for splits etc
> V = Volume
> OI = Close NOT adjusted (ie, the "raw" close)
> 
> If your program just appends the CSI data for the new day,
> the OHLC fields will be out of ratio with previous days if
> there was a split today. 

As said, I use raw data and than this does not apply.
But it is possible to refresh the whole data of a ticker after
a split. This can be detected and performed automatically.
 
> Let me explain the problem as I see it.
> 
> Let's say stock ABC is already in the AB database with
> perfectly adjusted data current as of yesterday. 
> 
> But a split takes effect before the open today. CSI will
> process that split on their computers and calculate all the
> prior prices for ABC's entire history. Your download from
> CSI will communicate those changes to the CSI database on
> your hard drive. But how will those new adjusted prices for
> the entire history of that stock get into your AB database?

As I have learnt, CSI internally stores only the raw data + 
split dates&ratios + dividend dates+amounts. You can query
the DB for the type of data you want: ie. the 4 possible cases
mentioned above.
 
> When your program gets today's prices to add to the AB
> database, it will get today's OHLC prices which reflect the
> split. But the AB data base for ABC stock will not have
> been updated for yesterday and all the preceeding history.
> Thus the OHLC arrays will show a huge gab from yesterday to
> today because all but today's data has not be adjusted for
> the most recent split.

Since I prefer raw data it was not necessary to do so yet. 
But true, if one wants adjusted data to be stored in AB than it 
indeed would be necessary to perform like you describe. 
But since the number of tickers having a split on a day is 
limited it would not take much time to completely retransfer
all quotes for such split affected tickers.
 
> Does your program have a way to detect which stocks had
> splits since the last update? 

Yes, of course. Even (or especially) with raw data I need to know 
whether there was a split. During daily update this of course is
detected.

>And a way to readjust the prior history of stocks with a split today?

As said above: it is possible and easily doable, but in my case
it was not necessary because raw data doesn't change with splits.

BTW, my tool is still in development, and I'm not sure if I ever should 
release it to public. If there is interest by people who would like to 
realize some advanced things, fe. data mining, or creating individually 
structured databases than contact me privately. 

UM
 
> --- uenal.mutlu@xxxxxxxxxxx wrote:
> > Hi b,
> > the fundamentals I posted in my prev posting today
> > can be retrieved via their API; but as you might know
> > the API is not one of the fastest. It took me more
> > than 6 hours on a 2600MHz AMD machine to initially
> > fill the AB quotes database from the CSI DB.
> > Daily updates of the AB DB take up about 15 minutes;
> > this of course has to be added to the CSI DB daily update
> > time which usually takes about 5 min. BTW, I'm talking
> > of timings of my own plugin I wrote; maybe there is a
> > much faster way with other plugins or methods.
> > UM
> > 
> > ----- Original Message -----
> > From: "b" <b519b@xxxxxxxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Monday, January 19, 2004 6:24 PM
> > Subject: [amibroker] Fundamental Data in QP and CSI (was
> > Institutional
> > Sponsorship)
> > 
> >
> 
> __________________________________
> Do you Yahoo!?



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 

Yahoo! Groups Links

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

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/