Rod-Persky / investoscope-easy-update

Updates Investoscope 3 end of day quotes
GNU General Public License v3.0
6 stars 3 forks source link

Intraday Updates - Apple Script Help Needed #13

Open obyone opened 6 years ago

obyone commented 6 years ago

I'm looking to try and add intraday updates to share prices. I have looked into it and have created a simple Python script using a feed from Alpha Vantage which provides free real-time stock updates.

I have completed the first half of a proof of concept that fetches the required data from Alpha Vantage and I'm not looking into updating the database accordingly.

For two reasons I'm thinking that it would be better to do this with AppleScript using the 'tell application' method but I don't know what apple scripts are available within Investoscope or which I should use. The first reason is that I'm assuming if the backend database is updated then this won't automatically trigger an update to the GUI and secondly I cannot figure out the timestamp format for the 'ztime' field in the 'zquote' table.

I therefore have three questions:

Does anyone know what AppleScript commands are available to use in Investoscope and are there any details on how to use?

Does anyone know how to decode the timestamp field that is used in the SQLite database for Investoscope? For example I have a value of '557427600' which equates to the 31st August 2018 18:00 (UK timezone) but I don't know how to convert to this value as it doesn't seem to be the standard unix timestamp

Is there a better way of achieving what I want to do? Any pointers or guidance would be much appreciated.

I'm happy to share my code, if it can be incorporated into this project great, if not then I can distribute it separately, go easy on me as I'm not the most proficient programmer :)

charlietomo commented 6 years ago

Alpha Vantage looks interesting. Are you finding the free tier is enough? Looks like you might need to limit it in code to 5 requests / minute?

In certain high-frequency use cases that exceed our standard call-frequency limit (5 requests per minute), we offer a dedicated, premium API key which allows various tiers of API calls per minute.

I'm afraid I'm not in a position to answer your questions but hopefully @Rod-Persky will be able to :-)

obyone commented 6 years ago

@charlietomo I'm not sure how Alpha Vantage is going to work in a real world situation. My aim was to build a proof of concept with an easy to use and free api to see if I could get it to work. If it works then great but if there are problems with scalability then it would be very easy to look into other APIs or even provide a number of options (free and paid) to fit with varying needs.

I have seen mention of more details about the apple script support in Investoscope but cannot find it in their help files which have probably disappeared now. I'm hoping that someone has some more details or even the apple script dictionary for Investoscope and that should enable me to complete the proof of concept.

obyone commented 6 years ago

Some progress has been made this evening :)

First I found out that by using the apple script editor you can view the dictionary for any application. All I needed to do was open Apple Script Editor and then go File->Open Dictionary and select Investoscope.

That revealed enough information for me to figure out how to update some of the key information that I want, below is brief example:

tell first document of application "Investoscope 3" set oInstrument to first instrument whose ISIN is 448 set oQuote to quote of oInstrument set latest price of oQuote to 30 set time of oQuote to current date end tell

Onwards and upwards :)

charlietomo commented 6 years ago

That sounds like good progress @obyone .

One of the things I like about the work by @Rod-Persky is that it gets the last three years of history - which is important for me as I make use of some of the Investoscope reports etc.

obyone commented 6 years ago

Totally agree, the work that Rod has done here has saved a great product that I have not been able to replace. The reports and charts relating to my portfolio are of particular importance to me.

What I'm trying to achieve is in addition to the historical information that is now being updated due to Rod's work, I like to see the intraday prices, not from a trading perspective but more from a 'what is the impact on my portfolio due to today's gains and losses'.

obyone commented 6 years ago

The POC is now working, I have some slight concerns with Alpha Vantage as outlined by @charlietomo earlier in the thread. I also think the accuracy / level and granularity of the data provided by AV could be improved on.

I've just started to look into worldtradingdata and their APIs

Will update on progress

charlietomo commented 6 years ago

Sounds good, look forward to following progress. https://www.quandl.com is another data provider (although with a fee - but if you want intraday you may need to pay?).

Rod-Persky commented 6 years ago

@obyone day trading is probably better done on dedicated platforms such as IRESS or other L2 providers. To summarise some of my thoughts:

1) The highest charting resolution in Investoscope is daily, 2) There is no guarantee the data is valid, 3) L2 data costs money

The present focus is to extend the lifetime of Investoscope. Specifically, enhancing Investoscope and adding the ability to view intraday data is not going to be easily added as this would require modifications to the Investoscope source code.

Rod-Persky commented 6 years ago

That said, Investoscope does periodically update the prices through the day.

obyone commented 6 years ago

@Rod-Persky agree and understand.

My intention is not to extend the functionality but restore what was previously there.

The POC that I’m working on ( and now works) simply restores the ability to show the gains and losses on a portfolio throughout the day.