Kaynağa Gözat

[finance] fixes

Innocenty Enikeew 8 yıl önce
ebeveyn
işleme
662051a5ce
1 değiştirilmiş dosya ile 15 ekleme ve 23 silme
  1. 15 23
      plugins/finance.lisp

+ 15 - 23
plugins/finance.lisp

@@ -240,15 +240,15 @@
 
 (defun print-order-info (idx info)
   (format nil "~A) @~A: *~A* ~A _~A_ @ *~$* ~A _~A_ @ *~$*, заработал *~$*, ROI *~$*%"
-	  idx
+          idx
           (agets info :user-name)
           (agets info :amount)
           (get-symbol-label (agets info :symbol))
           (format-ts (local-time:unix-to-timestamp (agets info :open-at)))
           (agets info :open)
-	  (if (> (or (agets info :income) 0) 0) "📈" "📉")
+          (if (> (or (agets info :income) 0) 0) "📈" "📉")
           (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 :income) 0)
           (* 100 (or (agets info :roi) 0))))
@@ -256,22 +256,22 @@
 (defun handle-hodl-show (chat-id)
   (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")))
+                      (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)
   (handler-case
       (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)
       (log:error "~A" e)
       (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))
     (: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)
   (telegram-send-chat-action chat-id "upload_photo")