We are trying to let NetLogo take the real time data, but we didn’t found any threads helpful online that tells how.
We used historical stock price data to train our agents in the first stage. After the end of the training phase, we would like to use real time data to test the strategies generated by agents. In order to do this, we will need NetLogo to take the real time data online. Is there a way to let NetLogo to read stock prices online, eg. Yahoo Finance, and run automatically?
Could you please give us some hints on how to implement this in NetLogo? If NetLogo is incapable of doing this. Can anyone suggest other agent-based modeling tools that can do this?
Best How To :
You can use the NetLogo web extension to get real time information from any stock price API.
Looks like Yahoo has a pretty simple API.
To use their API to, for example, get Google's latest stock price, you'd do something like:
web:make-request "http://download.finance.yahoo.com/d/quotes.csv" "GET" [["s" "GOOG"] ["f" "l1"] ["e" ".csv"]]
Currently this gives me:
observer> show web:make-request "http://download.finance.yahoo.com/d/quotes.csv" "GET" [["s" "GOOG"] ["f" "l1"] ["e" ".csv"]]
observer: ["556.65" "HTTP/1.1 200 OK"]
That result is a list where the first element is the actual contents of the response (in this case, the price as a string) and the second is the whether or not the request was successful. 200 means it worked.