#Watchlist Example
An example of a financial watch list API for storing a watch list on the cloud and fetching quote data when you retreive the watch list. The watch list is basically a list of stock symbols (e.g. AAPL, TXN, INTC, ...) stored in an ArrowDB. When the watch list is retreived, Arrow will use a block to fetch stock quote data from MarkitOndemand REST API using my stockquote Arrow connector (addstockquote.js). Alternatively, this can be done with the connector by accessing the markitondemand REST API directly (addstockquote_.js).
Why do a watch list in the cloud instead of on device? So that the watch list will be synced across multiple devices for the same user.
Concept is based on a similar concept implemented in ACS/Node.ACS:
Note that the MarkitOndemand have rate limiting so repeated calls in a short period may trigger the rate limiting
To support mulitple users, the watch list will have a username entry, therefore to retrieve your watch list items, you will need to do a query and pass in your username. In a real world application, you can manage this by some other means or by using Arrow ACL.
When you post a new entry into the watch list you will beed to provide your username in the post.
Users should not be able to getAll or deleteAll, etc... since they would be effecting other user's watch lists.
Here are sample curl commands:
Get all curl -u l51s0f0FKIAc4m7on5lv9vSk5Vy8vHTt: "http://127.0.0.1:8080/api/watchlist"
curl -u hC3hDQn5tpx2Ga4cBM+ARmBfhrCJM0G+: "https://e63fbd1cace3b2c1c59a9b88fb62f3b839744d8a.cloudapp-enterprise.appcelerator.com/api/watchlist" (this will be blocked in the API)
curl -u hC3hDQn5tpx2Ga4cBM+ARmBfhrCJM0G+: "https://e63fbd1cace3b2c1c59a9b88fb62f3b839744d8a.cloudapp-enterprise.appcelerator.com/api/watchlist/5595f051e01404461d0ceb78"
curl -u l51s0f0FKIAc4m7on5lv9vSk5Vy8vHTt: "http://127.0.0.1:8080/api/watchlist/55958bd97ed7bbfaa70af7ce"
curl -u l51s0f0FKIAc4m7on5lv9vSk5Vy8vHTt: "http://127.0.0.1:8080/api/watchlist/query?where=%7B%22username%22:%22lbrenman%22%7D"
curl -u hC3hDQn5tpx2Ga4cBM+ARmBfhrCJM0G+: "https://e63fbd1cace3b2c1c59a9b88fb62f3b839744d8a.cloudapp-enterprise.appcelerator.com/api/watchlist/query?where=%7B%22username%22:%22lbrenman%22%7D"
curl -X DELETE -u hC3hDQn5tpx2Ga4cBM+ARmBfhrCJM0G+: "https://e63fbd1cace3b2c1c59a9b88fb62f3b839744d8a.cloudapp-enterprise.appcelerator.com/api/watchlist/5595efe8e01404461d0ce8f9"
curl -X DELETE -u l51s0f0FKIAc4m7on5lv9vSk5Vy8vHTt: "http://127.0.0.1:8080/api/watchlist/559459371b4007f00207f6e2"
curl -X POST -u hC3hDQn5tpx2Ga4cBM+ARmBfhrCJM0G+: "https://e63fbd1cace3b2c1c59a9b88fb62f3b839744d8a.cloudapp-enterprise.appcelerator.com/api/watchlist" -d '{"username":"lbrenman","symbol":"AAPL","LastPrice":""}' -H "Content-Type: application/json"
curl -X POST -u l51s0f0FKIAc4m7on5lv9vSk5Vy8vHTt: "http://127.0.0.1:8080/api/watchlist" -d '{"username":"lbrenman","symbol":"AAPL","LastPrice":""}' -H "Content-Type: application/json"