Is there a way to update the API so that it is possible to only return a range of trade history instead of it returning all the trade history? The same with dividend history.
It would be simple to do, but probably not wise. The API has to come out of cache to work at scale, and custom queries aren't going to be very cache-able.
What kind of ranges do you have in mind?
Cheers.
I am suggesting something similar to the API of
bitcoincharts.com and especially what
cryptostocks has.
For example, if someone writes a script that checks to see if there has been a trade for a listing on BTC-TC, then they might have it check every 15 minutes. The information they get will be every single trade and so every 15 minutes they are getting mostly the same data each time yet they might only be checking for a few new trades. Instead they could already have most of the past data history stored on their own database (or not need that information at all) and only need the last trades for the last 15 minutes.
GLBSE had the same kind of thing for their dividend returns. It returned every dividend returned for that security listing. I had a script that went through my trade data to see if it was a actively traded stock, then for those that are it would go through each listing and collect the dividend data. Since I only needed the most recent data, it was pretty inefficient as my script took a while to run and hit the GLBSE server pretty often. I had it programmed to wait every 10 seconds before another query was sent, but I had to go through all the listings even if there was only just one dividend by one security listing that day.
A good start would be if the API could return:
assets_listed - Any asset currently traded on BTC-CO
future_ipo - Assets getting ready to IPO and the date of their IPO
dividend_last_x_time - The securities that paid dividends for a certain time period (last 24 hours, ect), dividend paid, and time of dividend paid.
Thank you for the great suggestions.
I'll have to meet you part way. I agree that it sucks for the remote side to have to track which trades are new with each query, etc, but I have two options:
(a) I craft a custom response for each api request, costing local processing time but saving processing time for the remote side.
(b) I craft the same response for each api request, saving local processing time, but costing remote processing time.
If I think the api is going to ever get any serious traffic, I pretty much have to go with (b).
For the IPO's... I have no idea when anything will go live, that's up to the mods and the asset issuers.
I have added the following api endpoints:
https://btct.co/api/ticker (list of all assets)
https://btct.co/api/tradeHistory (all trades, last 48 hrs)
https://btct.co/api/dividendHistory (all dividends, last 48 hrs)
The complete summary is near the bottom, here:
https://btct.co/faqHope that helps!