Note that there are some explanatory texts on larger screens.

plurals
  1. PORebol: problem with not enough memory
    text
    copied!<p>I have run this program below with a symbol_list of a few hundreds symbol and at some moment it says not enough memory whereas I do reuse the same variable why ? </p> <pre><code>base-url: http://www.google.com/finance/historical download-directory: "askpoweruser/stock-download/google/files/" column-header: "Time;Open;High;Low;Close;Volume" #debug: true symbol_list: parse/all {GOOG AAPL MSFT INDEXDJX:.DJI} " " ans: ask {symbols by default "GOOG AAPL MSFT INDEXDJX:.DJI": } if (ans &lt;&gt; "") [symbol_list: parse/all ans " "] ;do code-block/2 foreach symbol symbol_list [ url0: rejoin [base-url "?q=" symbol] dir: make-dir/deep to-rebol-file download-directory either none? filename: find symbol ":" [ filename: symbol url: rejoin [url0 "&amp;output=csv"] either not error? try [content: read url][ out-string: copy rejoin [column-header newline] quotes: parse/all content ",^/" reversed-quotes: reverse quotes foreach [v c l h o d] reversed-quotes [ either not (error? try [d: to-date d]) [ d: rejoin [d/year "-" d/month "-" d/day] append out-string rejoin [d ";" o ";" h ";" l ";" c ";" v newline] ][ ;print [d "is not a date"] ;input ] ] filename: rejoin [filename "_" "1440"] write to-rebol-file rejoin [dir filename ".csv"] out-string print filename ][ print ["Error for symbol" symbol] ] ][ filename: replace/all replace/all filename ":" "" "." "" out: copy [] for i 0 1 1 [ p: i url: rejoin [url0 "&amp;start=" (p * 200) "&amp;num=" ((p + 1) * 200)] content: read url rule: [to "&lt;table" thru "&lt;table" to "&gt;" thru "&gt;" to "&lt;table" thru "&lt;table" to "&gt;" thru "&gt;" to "&lt;table" thru "&lt;table" to "&gt;" thru "&gt;" copy quotes to &lt;/table&gt; to end ] parse content rule parse quotes [ some [to "&lt;td" thru "&lt;td" to "&gt;" thru "&gt;" [copy x to "&lt;" | copy x to end] (append out replace/all x "^/" "")] to end ] if #debug [ write/lines to-rebol-file rejoin [dir filename "_" p ".html"] quotes ] ] if #debug [ write to-rebol-file rejoin [dir filename "_temp" ".txt"] mold out ] out-string: copy rejoin [column-header newline] out: reverse out foreach [v c l h o d] out [ d: parse/all d " ," d: to-date rejoin [d/4 "-" d/1 "-" d/2] d: rejoin [d/year "-" d/month "-" d/day] append out-string replace/all rejoin [d ";" o ";" h ";" l ";" c ";" v newline] "," "" ] filename: rejoin [filename "_" "1440"] write to-rebol-file rejoin [dir filename ".csv"] out-string print filename ] ] </code></pre> <p>To get the list of symbols you can use this (rebol crashed above before letter H):</p> <pre><code>alphabet: [A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] symbol-list: copy [] rule: [ to &lt;table class="quotes"&gt; some [ to {&lt;A href="/stockquote} to "&gt;" thru "&gt;" copy symbol to "&lt;" (append symbol-list symbol)] to &lt;/table&gt; ] foreach letter alphabet [ content: read to-url rejoin ["http://www.eoddata.com/stocklist/NYSE/" letter ".htm"] parse content rule probe symbol-list write/append %askpoweruser/stock-download/symbol-list-nyse.txt mold symbol-list ] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload