Showing 1 changed files with 13 additions and 11 deletions
+13 -11
save.py
... ...
@@ -38,7 +38,7 @@ def order_record(order_type, coin_price):
38 38
         csv_writer.writerow({'date': current_date_str, 'pair': base.TRADING_PAIR, 'type': order_type, 'price': coin_price, 'coins': base.LOT})
39 39
 
40 40
 
41
-# Generate and mail a daily report
41
+# Generate and save a daily report
42 42
 # --- in
43 43
 # * int(num_closed_spreads)
44 44
 # --- out
... ...
@@ -52,7 +52,7 @@ def daily_report(num_closed_spreads):
52 52
     
53 53
     report_name = day_before_date_str + '_daily.csv'
54 54
     report_path = 'reports/daily/' + report_name
55
-    
55
+
56 56
     asset_profit = float(round(num_closed_spreads * (base.SPREAD * base.STEP * base.LOT), base.DECIMAL_PLACES))
57 57
     
58 58
     with open(report_path, 'w') as database:
... ...
@@ -64,19 +64,20 @@ def daily_report(num_closed_spreads):
64 64
             
65 65
         csv_writer.writerow({'date':day_before_date_str, 'closed':str(num_closed_spreads), 'profit':str(asset_profit)})
66 66
         print('\n| Daily Report was Generated\n')
67
-    
67
+
68 68
     try:  # Try to send the generated report via email
69 69
         mail.regular_report('Daily', str(report_path), str(report_name), str(day_before_date_str))
70 70
         print('\n| Daily Report was Sent\n')
71
-        
71
+
72 72
     except FileNotFoundError:
73 73
         print('[!!!] Cannot send the email: Report does not exists')
74
-    
74
+
75 75
     except:
76 76
         print('[!!!] Cannot send the email: Unexpected Error')
77 77
 
78 78
 
79 79
 # Generate and save a weekly report
80
+# (also send it via email, if selected)
80 81
 # --- in
81 82
 # * int(num_closed_spreads)
82 83
 # --- out
... ...
@@ -103,14 +104,14 @@ def weekly_report(num_closed_spreads):
103 104
             
104 105
         csv_writer.writerow({'date':current_date_str, 'closed':str(num_closed_spreads), 'profit':str(asset_profit)})
105 106
         print('\n| Weekly Report was Generated\n')
106
-        
107
+
107 108
     try:  # Try to send the generated report via email
108 109
         mail.regular_report('Weekly', str(report_path), str(report_name), str(week_before_date_str + '-' + current_date_str))
109 110
         print('\n| Weekly Report was just Sent\n')
110
-        
111
+
111 112
     except FileNotFoundError:
112 113
         print('[!!!] Cannot send the email: Report does not exists')
113
-    
114
+
114 115
     except:
115 116
         print('[!!!] Cannot send the email: Unexpected Error')
116 117
 
... ...
@@ -132,6 +133,7 @@ def _get_past_month_num():
132 133
 
133 134
 
134 135
 # Generate and save a monthly report
136
+# (also send it via email, if selected)
135 137
 # --- in
136 138
 # * int(num_closed_spreads)
137 139
 # --- out
... ...
@@ -158,13 +160,13 @@ def monthly_report(num_closed_spreads):
158 160
             
159 161
         csv_writer.writerow({'date': current_date_str, 'closed':str(num_closed_spreads), 'profit':str(asset_profit)})
160 162
         print('\n| Monthly Report was Generated\n')
161
-        
163
+
162 164
     try:  # Try to send the generated report via email
163 165
         mail.regular_report('Monthly', str(report_path), str(report_name), month_before_date_str)
164 166
         print('\n| Monthly Report was just Sent\n')
165
-        
167
+
166 168
     except FileNotFoundError:
167 169
         print('[!!!] Cannot send the email: Report does not exists')
168
-    
170
+
169 171
     except:
170 172
         print('[!!!] Cannot send the email: Unexpected Error')