تحميل مفتوحة المصدر بوت ليبر الجماعة الطبعة وتثبيت بوت ليبر على الخادم الخاص بك
Self, AIML, and scripting

Can bots pull stock quotes/data from Quandl datasets w/ a script?

قبل dvolatility نشر Jun 1 2016, 14:35

Hi,

I was wondering if there was way for my bot to pull stock quotes and financial/economic data from data feeds on Quandl via a script?  For example, there are free "Wiki EOD Stock Prices" available in the public domain https://www.quandl.com/data/WIKI?keyword=. The datasets can be called from XML, CSV or JSON files. Thank you,

Matt


by admin posted Jun 1 2016, 20:04
Yes, it is quite easy to write a script in Self to do this.

See,
https://www.botlibre.com/script?id=12865685


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * This scripts uses an XML web service on Quandl to access stock quotes.
 * Please change the api-key to your own key.
 */
state StockQuote {
    pattern "(what) (was) (the) [price quote] (of for) * today" template todayStockPrice();
    pattern "(what) (was) (the) [price quote] (of for) * on * - * - *" template stockPrice();
    
    function stockPrice() {
        date = star[1] + "-" + star[2] + "-" + star[3];
        price = Http.requestXML("https://www.quandl.com/api/v3/datasets/WIKI/" + star[0] + "/data.xml?api_key=kioDegFc4ZaczoSxmUzU&start_date=" + date + "&end_date=" + date + "&column_index=4", "dataset-data/data/datum/datum[2]");
        if (price == null) {
            return "Invalid stock ticker symbol or date.";
        }
        return star[0] + " - " + date + " - " + price;
    }
    
    function todayStockPrice() {
        price = Http.requestXML("https://www.quandl.com/api/v3/datasets/WIKI/" + star + "/data.xml?api_key=kioDegFc4ZaczoSxmUzU&start_date=" + Date.date() + "&column_index=4", "dataset-data/data/datum/datum[2]");
        if (price == null) {
            return "Invalid stock ticker symbol or date.";
        }
        return star + " - today - " + price;
    }
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2426, today: 0, week: 4, month: 15

by dvolatility posted Jun 1 2016, 20:36

Thanks!


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2497, today: 0, week: 5, month: 23

معرف: 12864665
Tags: self, xml, web service, stocks, quotes, quandl
نشر: Jun 1 2016, 14:35
تحديث: Jun 1 2016, 20:05
الردود: 2
الآراء: 3071, اليوم: 3, الأسبوع: 8, الشهر: 25
1 0 5.0/5