|
@@ -240,15 +240,15 @@
|
|
|
|
|
|
|
|
(defun print-order-info (idx info)
|
|
(defun print-order-info (idx info)
|
|
|
(format nil "~A) @~A: *~A* ~A _~A_ @ *~$* ~A _~A_ @ *~$*, заработал *~$*, ROI *~$*%"
|
|
(format nil "~A) @~A: *~A* ~A _~A_ @ *~$* ~A _~A_ @ *~$*, заработал *~$*, ROI *~$*%"
|
|
|
- idx
|
|
|
|
|
|
|
+ idx
|
|
|
(agets info :user-name)
|
|
(agets info :user-name)
|
|
|
(agets info :amount)
|
|
(agets info :amount)
|
|
|
(get-symbol-label (agets info :symbol))
|
|
(get-symbol-label (agets info :symbol))
|
|
|
(format-ts (local-time:unix-to-timestamp (agets info :open-at)))
|
|
(format-ts (local-time:unix-to-timestamp (agets info :open-at)))
|
|
|
(agets info :open)
|
|
(agets info :open)
|
|
|
- (if (> (or (agets info :income) 0) 0) "📈" "📉")
|
|
|
|
|
|
|
+ (if (> (or (agets info :income) 0) 0) "📈" "📉")
|
|
|
(if (agets info :open-p) "now"
|
|
(if (agets info :open-p) "now"
|
|
|
- (format-ts (local-time:unix-to-timestamp (agets info :close-at))))
|
|
|
|
|
|
|
+ (format-ts (local-time:unix-to-timestamp (agets info :close-at))))
|
|
|
(or (agets info :close) 0)
|
|
(or (agets info :close) 0)
|
|
|
(or (agets info :income) 0)
|
|
(or (agets info :income) 0)
|
|
|
(* 100 (or (agets info :roi) 0))))
|
|
(* 100 (or (agets info :roi) 0))))
|
|
@@ -256,22 +256,22 @@
|
|
|
(defun handle-hodl-show (chat-id)
|
|
(defun handle-hodl-show (chat-id)
|
|
|
(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~%~} 😇"
|
|
|
|
|
- (loop for order in orders for idx from 1
|
|
|
|
|
- collect (print-order-info idx (get-order-info order))))
|
|
|
|
|
- "Нет ходлеров :(")
|
|
|
|
|
- :parse-mode "markdown")))
|
|
|
|
|
|
|
+ (if orders (format nil "~{~A~%~} 😇"
|
|
|
|
|
+ (loop for order in orders for idx from 1
|
|
|
|
|
+ collect (print-order-info idx (get-order-info order))))
|
|
|
|
|
+ "Нет ходлеров :(")
|
|
|
|
|
+ :parse-mode "markdown")))
|
|
|
|
|
|
|
|
(defun handle-hodl-buy (chat-id from args)
|
|
(defun handle-hodl-buy (chat-id from args)
|
|
|
(handler-case
|
|
(handler-case
|
|
|
(let ((symbol (get-label-symbol (nth 1 args)))
|
|
(let ((symbol (get-label-symbol (nth 1 args)))
|
|
|
- (amount (parse-float (nth 2 args)))
|
|
|
|
|
- (open (parse-float (nth 3 args)))
|
|
|
|
|
- (open-at (if (nth 4 args) (local-time:parse-timestring (nth 4 args)) (local-time:now))))
|
|
|
|
|
- (db/order-buy chat-id (agets from "id") (agets from "username")
|
|
|
|
|
- symbol (princ-to-string amount) (princ-to-string open)
|
|
|
|
|
- (local-time:timestamp-to-unix open-at))
|
|
|
|
|
- (handle-hodl-show chat-id))
|
|
|
|
|
|
|
+ (amount (parse-float (nth 2 args)))
|
|
|
|
|
+ (open (parse-float (nth 3 args)))
|
|
|
|
|
+ (open-at (if (nth 4 args) (local-time:parse-timestring (nth 4 args)) (local-time:now))))
|
|
|
|
|
+ (db/order-buy chat-id (agets from "id") (agets from "username")
|
|
|
|
|
+ symbol (princ-to-string amount) (princ-to-string open)
|
|
|
|
|
+ (local-time:timestamp-to-unix open-at))
|
|
|
|
|
+ (handle-hodl-show chat-id))
|
|
|
(error (e)
|
|
(error (e)
|
|
|
(log:error "~A" e)
|
|
(log:error "~A" e)
|
|
|
(bot-send-message chat-id "/hodl buy <SYM> <AMT> <PRICE> [YYYY-MM-DD]"))))
|
|
(bot-send-message chat-id "/hodl buy <SYM> <AMT> <PRICE> [YYYY-MM-DD]"))))
|
|
@@ -281,14 +281,6 @@
|
|
|
((equal (car args) "buy") (handle-hodl-buy chat-id (agets message "from") args))
|
|
((equal (car args) "buy") (handle-hodl-buy chat-id (agets message "from") args))
|
|
|
(:otherwise (handle-hodl-show chat-id))))
|
|
(:otherwise (handle-hodl-show chat-id))))
|
|
|
|
|
|
|
|
-(def-message-cmd-handler handle-hodl (:hodl :hodlers)
|
|
|
|
|
- (let ((orders (db/orders-get chat-id)))
|
|
|
|
|
- (bot-send-message chat-id
|
|
|
|
|
- (if orders (format nil "~{~A~%~} 😇"
|
|
|
|
|
- (loop for order in orders for idx from 1
|
|
|
|
|
- collect (print-order-info idx (get-order-info order))))
|
|
|
|
|
- "Нет ходлеров :(")
|
|
|
|
|
- :parse-mode "markdown")))
|
|
|
|
|
|
|
|
|
|
(def-message-cmd-handler handler-charts (:charts)
|
|
(def-message-cmd-handler handler-charts (:charts)
|
|
|
(telegram-send-chat-action chat-id "upload_photo")
|
|
(telegram-send-chat-action chat-id "upload_photo")
|