|
@@ -46,6 +46,12 @@
|
|
|
"bpi" "USD" "rate_float")
|
|
"bpi" "USD" "rate_float")
|
|
|
(error (e) (log:error "~A" e))))
|
|
(error (e) (log:error "~A" e))))
|
|
|
|
|
|
|
|
|
|
+(defparameter +cex-btc-usd-url+ "https://cex.io/api/last_price/BTC/USD" "cex.io api endpoint")
|
|
|
|
|
+(defun get-cex-io-btc-usd ()
|
|
|
|
|
+ (handler-case
|
|
|
|
|
+ (parse-float (agets (json-request +cex-btc-usd-url+) "lprice"))
|
|
|
|
|
+ (error (e) (log:error "~A" e))))
|
|
|
|
|
+
|
|
|
|
|
|
|
|
;; Formatting
|
|
;; Formatting
|
|
|
(defvar *symbol-aliases*
|
|
(defvar *symbol-aliases*
|
|
@@ -170,7 +176,7 @@
|
|
|
(symbols (db/get-chat-symbols))
|
|
(symbols (db/get-chat-symbols))
|
|
|
(rates (when symbols (get-rates symbols)))
|
|
(rates (when symbols (get-rates symbols)))
|
|
|
(brent (get-brent))
|
|
(brent (get-brent))
|
|
|
- (btc (get-coindesk-btc-usd)))
|
|
|
|
|
|
|
+ (btc (get-cex-io-btc-usd)))
|
|
|
(loop for (symbol . price) in rates
|
|
(loop for (symbol . price) in rates
|
|
|
do (db/add-finance ts symbol price))
|
|
do (db/add-finance ts symbol price))
|
|
|
(when brent
|
|
(when brent
|
|
@@ -250,7 +256,7 @@
|
|
|
(def-message-cmd-handler handle-hodl (:hodl :hodlers)
|
|
(def-message-cmd-handler handle-hodl (:hodl :hodlers)
|
|
|
(let ((orders (db/orders-get chat-id)))
|
|
(let ((orders (db/orders-get chat-id)))
|
|
|
(bot-send-message chat-id
|
|
(bot-send-message chat-id
|
|
|
- (if orders (format nil "{~A~^~%~}~%😇~"
|
|
|
|
|
|
|
+ (if orders (format nil "~{~A~%~} 😇"
|
|
|
(loop for order in orders for idx from 1
|
|
(loop for order in orders for idx from 1
|
|
|
collect (print-order-info idx (get-order-info order))))
|
|
collect (print-order-info idx (get-order-info order))))
|
|
|
"Нет ходлеров :(")
|
|
"Нет ходлеров :(")
|