readme entry
This commit is contained in:
parent
2700cdeea3
commit
2618f7b7ae
|
|
@ -1,5 +1,9 @@
|
||||||
|
|
||||||
|
### BUGS
|
||||||
|
- see malformed_program - wrong parsing of comments
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
|
- use file suffix .lsp instead of .lisp
|
||||||
- make-list
|
- make-list
|
||||||
- print-table
|
- print-table
|
||||||
- download 1 year of data from api.nasdaq.com into test dir
|
- download 1 year of data from api.nasdaq.com into test dir
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
; (print (make-csv (divi-dates "2021-02-01")))
|
|
||||||
(defun divi-dates (date-str)
|
|
||||||
(do
|
|
||||||
(define curl_cmd (+ "curl -H \"Accept: application/json, text/plain, */*\" -H \"Origin: https://www.nasdaq.com/\" -H \"User-Agent: Mozilla/5.0 (Windows NT 10.0)\" https://api.nasdaq.com/api/calendar/dividends/?date=" date-str " 2>/dev/null"))
|
|
||||||
(define curl_out (system-cmd curl_cmd))
|
|
||||||
|
|
||||||
(define json_list (parse-json (last curl_out)))
|
|
||||||
|
|
||||||
(define data (first json_list))
|
|
||||||
(define calendar (index data 1))
|
|
||||||
(define calendar_data (index (index calendar 0) 1))
|
|
||||||
(define header (index (index calendar_data 0) 1))
|
|
||||||
(define rows (index (index calendar_data 1) 1))
|
|
||||||
|
|
||||||
; (define csv_list '())
|
|
||||||
(define csv_list '(("symbol" "ex-date" "pay-date" "div-rate")))
|
|
||||||
(if (!= rows '@)
|
|
||||||
(for e rows
|
|
||||||
; (("announcement_Date" "01/07/2021") ("companyName" "Itau Unibanco Banco Holding SA") ("dividend_Ex_Date" "02/01/2021") ("dividend_Rate" 0.003) ("indicated_Annual_Dividend" 0.033) ("payment_Date" "03/11/2021") ("record_Date" "02/02/2021") ("symbol" "ITUB"))
|
|
||||||
(define symbol (second (first (filter (lambda (x) (= (first x) "symbol")) e))))
|
|
||||||
(define divrate (second (first (filter (lambda (x) (= (first x) "dividend_Rate")) e))))
|
|
||||||
(define adate (second (first (filter (lambda (x) (= (first x) "announcement_Date")) e))))
|
|
||||||
(define name (second (first (filter (lambda (x) (= (first x) "companyName")) e))))
|
|
||||||
(define exdate (second (first (filter (lambda (x) (= (first x) "dividend_Ex_Date")) e))))
|
|
||||||
(define paydate (second (first (filter (lambda (x) (= (first x) "payment_Date")) e))))
|
|
||||||
(define rdate (second (first (filter (lambda (x) (= (first x) "record_Date")) e))))
|
|
||||||
|
|
||||||
(define csv_list (push csv_list (list symbol exdate paydate divrate))))
|
|
||||||
'())
|
|
||||||
|
|
||||||
csv_list
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
(print "Debug starts")
|
||||||
|
|
||||||
|
(define csv_list '())
|
||||||
|
(for f (ls-dir "tests/divi")
|
||||||
|
(if (regex-search? f "^divi_2021-02-0[1].*\.csv$")
|
||||||
|
(do
|
||||||
|
(define filename (+ "tests/divi/" f))
|
||||||
|
; (print filename)
|
||||||
|
(define csv_str (read-file filename))
|
||||||
|
(define csv_file_list (parse-csv csv_str))
|
||||||
|
(define csv_list (+ csv_list csv_file_list))
|
||||||
|
; (for x csv_file_list
|
||||||
|
; (print x)
|
||||||
|
; (define csv_list (+ csv_list csv_file_list))
|
||||||
|
; )
|
||||||
|
)
|
||||||
|
))
|
||||||
|
|
||||||
|
(for x csv_list
|
||||||
|
(print x))
|
||||||
|
|
||||||
|
; (if (> 1 10)
|
||||||
|
; (print "aaa"))
|
||||||
|
|
||||||
|
(print "Debug ends")
|
||||||
Loading…
Reference in New Issue