openfund-core 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. openfund/core/__init__.py +0 -0
  2. openfund/core/binance_tools/__init__.py +16 -0
  3. openfund/core/binance_tools/binance_tools.py +39 -0
  4. openfund/core/binance_tools/continuous_klines.py +147 -0
  5. openfund/core/factory.py +37 -0
  6. openfund/core/libs/__init__.py +6 -0
  7. openfund/core/libs/email_tools.py +56 -0
  8. openfund/core/libs/enums.py +507 -0
  9. openfund/core/libs/file_tools.py +13 -0
  10. openfund/core/libs/log_tools.py +45 -0
  11. openfund/core/libs/prepare_env.py +28 -0
  12. openfund/core/libs/time.py +14 -0
  13. openfund/core/libs/time_tools.py +22 -0
  14. openfund/core/openfund_old/__init__.py +0 -0
  15. openfund/core/openfund_old/continuous_klines.py +153 -0
  16. openfund/core/openfund_old/depth.py +92 -0
  17. openfund/core/openfund_old/historical_trades.py +123 -0
  18. openfund/core/openfund_old/index_info.py +67 -0
  19. openfund/core/openfund_old/index_price_kline.py +118 -0
  20. openfund/core/openfund_old/klines.py +95 -0
  21. openfund/core/openfund_old/klines_qrr.py +103 -0
  22. openfund/core/openfund_old/mark_price.py +121 -0
  23. openfund/core/openfund_old/mark_price_klines.py +122 -0
  24. openfund/core/openfund_old/ticker_24hr_price_change.py +99 -0
  25. openfund/core/pyopenfund.py +32 -0
  26. openfund/core/sample/__init__.py +1 -0
  27. openfund/core/sample/sample.py +20 -0
  28. openfund/core/sycu_exam/__init__.py +1 -0
  29. openfund/core/sycu_exam/exam.py +19 -0
  30. openfund/core/sycu_exam/random_grade_cplus.py +440 -0
  31. openfund/core/sycu_exam/random_grade_web.py +404 -0
  32. openfund_core-0.0.2.dist-info/LICENSE +201 -0
  33. openfund_core-0.0.2.dist-info/METADATA +66 -0
  34. openfund_core-0.0.2.dist-info/RECORD +35 -0
  35. openfund_core-0.0.2.dist-info/WHEEL +4 -0
@@ -0,0 +1,440 @@
1
+ #!/usr/bin/env python
2
+ import csv
3
+ import time
4
+ import os
5
+ import sys
6
+ import random
7
+
8
+ curPath = os.path.abspath(os.path.dirname(__file__))
9
+ rootPath = os.path.split(curPath)[0]
10
+ sys.path.append(rootPath)
11
+
12
+ from datetime import datetime
13
+ from libs.time_tools import format_timestamp, format_date, format_date_to
14
+ from libs.file_tools import create_path
15
+ from libs.prepare_env import get_path
16
+ from libs.log_tools import Logger
17
+
18
+ data_path, log_path = get_path()
19
+
20
+ app = "random_grade"
21
+ logger = Logger(app).get_log()
22
+ c_name = "stu_23sk-1-java"
23
+
24
+ sx_times = 1
25
+ xz_times = 1
26
+
27
+
28
+ def jieke_fun(row):
29
+ jieke = 0
30
+ cent1_1 = 5
31
+ cent1_2 = 5
32
+ if row[2] in ["A"]:
33
+ cent2_1 = 10
34
+ cent2_2 = cent(8, 9)
35
+ cent2_3 = cent(8, 9)
36
+ cent2_4 = cent(8, 9)
37
+
38
+ cent3_1 = 5
39
+ cent3_2 = 5
40
+ cent3_3 = 5
41
+ # cent3_4 = cent(3, 4)
42
+
43
+ cent4_1 = 14
44
+ cent5_1 = cent(8, 9)
45
+ cent6_1 = 5
46
+ cent6_2 = 5
47
+ elif row[2] in ["B+"]:
48
+ cent2_1 = cent(7, 8)
49
+ cent2_2 = cent(7, 8)
50
+ cent2_3 = cent(7, 8)
51
+ cent2_4 = cent(7, 8)
52
+
53
+ cent3_1 = 5
54
+ cent3_2 = 5
55
+ cent3_3 = 5
56
+ # cent3_4 = cent(3, 4)
57
+
58
+ cent4_1 = 12
59
+ cent5_1 = cent(8, 9)
60
+ cent6_1 = 5
61
+ cent6_2 = 5
62
+ elif row[2] in ["B"]:
63
+ cent2_1 = cent(6, 7)
64
+ cent2_2 = cent(6, 7)
65
+ cent2_3 = cent(7, 8)
66
+ cent2_4 = cent(7, 8)
67
+
68
+ cent3_1 = 5
69
+ cent3_2 = 4
70
+ cent3_3 = 5
71
+ # cent3_4 = cent(3, 4)
72
+
73
+ cent4_1 = 11
74
+ cent5_1 = cent(8, 9)
75
+ cent6_1 = 5
76
+ cent6_2 = 5
77
+ elif row[2] in ["C+"]:
78
+ cent2_1 = cent(7, 8)
79
+ cent2_2 = cent(6, 7)
80
+ cent2_3 = cent(6, 7)
81
+ cent2_4 = cent(3, 4)
82
+
83
+ cent3_1 = 5
84
+ cent3_2 = 4
85
+ cent3_3 = 4
86
+ # cent3_4 = cent(2, 3)
87
+
88
+ cent4_1 = 9
89
+ cent5_1 = cent(6, 7)
90
+ cent6_1 = 4
91
+ cent6_2 = 4
92
+ elif row[2] in ["C"]:
93
+ cent2_1 = cent(7, 8)
94
+ cent2_2 = cent(6, 7)
95
+ cent2_3 = cent(6, 7)
96
+ cent2_4 = cent(4, 5)
97
+
98
+ cent3_1 = 3
99
+ cent3_2 = 3
100
+ cent3_3 = 3
101
+ # cent3_4 = cent(2, 3)
102
+
103
+ cent4_1 = 7
104
+ cent5_1 = cent(6, 7)
105
+ cent6_1 = 3
106
+ cent6_2 = 3
107
+ else:
108
+ cent2_1 = cent(6, 7)
109
+ cent2_2 = cent(6, 7)
110
+ cent2_3 = cent(6, 7)
111
+ cent2_4 = 0
112
+
113
+ cent3_1 = 3
114
+ cent3_2 = 3
115
+ cent3_3 = 3
116
+ # cent3_4 = cent(2, 3)
117
+
118
+ cent4_1 = 5
119
+ cent5_1 = cent(5, 6)
120
+ cent6_1 = 3
121
+ cent6_2 = 3
122
+
123
+ jieke = (
124
+ cent1_1
125
+ + cent1_2
126
+ + cent2_1
127
+ + cent2_2
128
+ + cent2_3
129
+ + cent2_4
130
+ + cent3_1
131
+ + cent3_2
132
+ + cent3_3
133
+ # + cent3_4
134
+ + cent4_1
135
+ + cent5_1
136
+ + cent6_1
137
+ + cent6_2
138
+ )
139
+
140
+ cents = []
141
+ cents.append(row[0])
142
+ cents.append(row[1])
143
+ cents.append(row[2])
144
+ cents.append(row[3])
145
+ cents.append(jieke)
146
+ cents.append(cent1_1)
147
+ cents.append(cent1_2)
148
+ cents.append(cent2_1)
149
+ cents.append(cent2_2)
150
+ cents.append(cent2_3)
151
+ cents.append(cent2_4)
152
+ cents.append(cent3_1)
153
+ cents.append(cent3_2)
154
+ cents.append(cent3_3)
155
+ # cents.append(cent3_4)
156
+ cents.append(cent4_1)
157
+ cents.append(cent5_1)
158
+ cents.append(cent6_1)
159
+ cents.append(cent6_2)
160
+
161
+ return cents
162
+
163
+
164
+ def xiaozu_fun(row):
165
+ # 程序代码编写及附加信息(55分)
166
+ xiaozu = 0
167
+ cent1_1 = 10
168
+ cent2_1 = 10
169
+ # 小组给分
170
+ if row[3] in ["A"]:
171
+ cent3_1 = 10
172
+ cent4_1 = 10
173
+ cent5_1 = 26
174
+ elif row[3] in ["B"]:
175
+ cent3_1 = 8
176
+ cent4_1 = 8
177
+ cent5_1 = 23
178
+ else:
179
+ cent3_1 = 7
180
+ cent4_1 = 7
181
+ cent5_1 = 20
182
+
183
+ if row[2] in ["A"]:
184
+ cent6_1 = cent(9, 10)
185
+ cent7_1 = cent(9, 10)
186
+ cent8_1 = cent(8, 9)
187
+
188
+ elif row[2] in ["B+"]:
189
+ cent6_1 = cent(8, 9)
190
+ cent7_1 = cent(8, 9)
191
+ cent8_1 = cent(8, 9)
192
+ elif row[2] in ["B"]:
193
+ cent6_1 = cent(6, 8)
194
+ cent7_1 = cent(6, 8)
195
+ cent8_1 = cent(6, 8)
196
+ elif row[2] in ["C+"]:
197
+ cent6_1 = cent(5, 7)
198
+ cent7_1 = cent(5, 7)
199
+ cent8_1 = cent(5, 7)
200
+ elif row[2] in ["C"]:
201
+ cent6_1 = cent(4, 5)
202
+ cent7_1 = cent(4, 5)
203
+ cent8_1 = cent(4, 5)
204
+ else:
205
+ cent6_1 = cent(3, 4)
206
+ cent7_1 = cent(3, 4)
207
+ cent8_1 = cent(3, 4)
208
+
209
+ xiaozu = (
210
+ cent1_1 + cent2_1 + cent3_1 + cent4_1 + cent5_1 + cent6_1 + cent7_1 + cent8_1
211
+ )
212
+ cents = []
213
+ cents.append(row[0])
214
+ cents.append(row[1])
215
+ cents.append(row[2])
216
+ cents.append(row[3])
217
+ cents.append(xiaozu)
218
+ cents.append(cent1_1)
219
+ cents.append(cent2_1)
220
+ cents.append(cent3_1)
221
+ cents.append(cent4_1)
222
+ cents.append(cent5_1)
223
+ cents.append(cent6_1)
224
+ cents.append(cent7_1)
225
+ cents.append(cent8_1)
226
+ return cents
227
+
228
+
229
+ def shixu_fun(row):
230
+ shixun = 0
231
+ cent1_1 = 10
232
+ # cent1_2 = 5
233
+ if row[2] in ["A"]:
234
+ cent2_1 = 12
235
+ cent2_2 = 15
236
+ cent2_3 = 5
237
+ cent2_4 = 15
238
+ # cent2_5 = 10
239
+ # cent2_6 = cent(10, 12)
240
+ cent3_1 = 10
241
+ cent4_1 = cent(13, 15)
242
+ cent5_1 = 9
243
+ elif row[2] in ["B+"]:
244
+ cent2_1 = 12
245
+ cent2_2 = 15
246
+ cent2_3 = 5
247
+ cent2_4 = cent(12, 14)
248
+ # cent2_5 = 10
249
+ # cent2_6 = cent(8, 10)
250
+ cent3_1 = 10
251
+ cent4_1 = cent(13, 15)
252
+ cent5_1 = cent(7, 8)
253
+ elif row[2] in ["B"]:
254
+ cent2_1 = 12
255
+ cent2_2 = 10
256
+ cent2_3 = 5
257
+ cent2_4 = cent(12, 14)
258
+ # cent2_5 = 10
259
+ # cent2_6 = cent(8, 10)
260
+ cent3_1 = 10
261
+ cent4_1 = cent(13, 15)
262
+ cent5_1 = cent(7, 8)
263
+ elif row[2] in ["C+"]:
264
+ cent2_1 = 9
265
+ cent2_2 = 10
266
+ cent2_3 = 0
267
+ cent2_4 = cent(12, 14)
268
+ # cent2_5 = 10
269
+ # cent2_6 = cent(8, 10)
270
+ cent3_1 = 10
271
+ cent4_1 = cent(12, 13)
272
+ cent5_1 = cent(7, 8)
273
+ elif row[2] in ["C"]:
274
+ cent2_1 = 9
275
+ cent2_2 = 5
276
+ cent2_3 = 0
277
+ cent2_4 = cent(12, 14)
278
+ # cent2_5 = 10
279
+ # cent2_6 = cent(8, 10)
280
+ cent3_1 = 10
281
+ cent4_1 = cent(10, 13)
282
+ cent5_1 = cent(7, 8)
283
+ else:
284
+ cent2_1 = 6
285
+ cent2_2 = 5
286
+ cent2_3 = 0
287
+ cent2_4 = cent(10, 12)
288
+ # cent2_5 = 10
289
+ # cent2_6 = cent(8, 10)
290
+ cent3_1 = 10
291
+ cent4_1 = cent(8, 10)
292
+ cent5_1 = cent(7, 8)
293
+
294
+ shixun = (
295
+ cent1_1
296
+ # + cent1_2
297
+ + cent2_1
298
+ + cent2_2
299
+ + cent2_3
300
+ + cent2_4
301
+ # + cent2_5
302
+ # + cent2_6
303
+ + cent3_1
304
+ + cent4_1
305
+ + cent5_1
306
+ )
307
+ cents = []
308
+ cents.append(row[0])
309
+ cents.append(row[1])
310
+ cents.append(row[2])
311
+ cents.append(row[3])
312
+ cents.append(shixun)
313
+ cents.append(cent1_1)
314
+ # cents.append(cent1_2)
315
+ cents.append(cent2_1)
316
+ cents.append(cent2_2)
317
+ cents.append(cent2_3)
318
+ cents.append(cent2_4)
319
+ # cents.append(cent2_5)
320
+ # cents.append(cent2_6)
321
+ cents.append(cent3_1)
322
+ cents.append(cent4_1)
323
+ cents.append(cent5_1)
324
+ # print(
325
+ # row[1],
326
+ # row[2],
327
+ # shixun,
328
+ # cent1_1,
329
+ # cent1_2,
330
+ # cent2_1,
331
+ # cent2_2,
332
+ # cent2_3,
333
+ # cent2_4,
334
+ # cent2_5,
335
+ # cent2_6,
336
+ # cent3_1,
337
+ # cent4_1,
338
+ # cent5_1,
339
+ # sep=",",
340
+ # )
341
+
342
+ return cents
343
+
344
+
345
+ def homework_fun(row):
346
+ work = 0
347
+
348
+ if row[2] in ["A"]:
349
+ cent1_1 = 100
350
+ cent1_2 = 90
351
+ cent1_3 = 95
352
+
353
+ elif row[2] in ["B+"]:
354
+ cent1_1 = 90
355
+ cent1_2 = 80
356
+ cent1_3 = 85
357
+ elif row[2] in ["B"]:
358
+ cent1_1 = 85
359
+ cent1_2 = 75
360
+ cent1_3 = 80
361
+ elif row[2] in ["C+"]:
362
+ cent1_1 = 80
363
+ cent1_2 = 70
364
+ cent1_3 = 75
365
+ elif row[2] in ["C"]:
366
+ cent1_1 = 75
367
+ cent1_2 = 65
368
+ cent1_3 = 70
369
+ else:
370
+ cent1_1 = 70
371
+ cent1_2 = 60
372
+ cent1_3 = 65
373
+
374
+ work = cent1_3
375
+ cents = []
376
+ cents.append(row[0])
377
+ cents.append(row[1])
378
+ cents.append(row[2])
379
+ cents.append(row[3])
380
+ cents.append(work)
381
+ cents.append(cent1_1)
382
+ cents.append(cent1_2)
383
+ cents.append(cent1_3)
384
+ return cents
385
+
386
+
387
+ def cent(low, high):
388
+ cent = random.randint(low, high)
389
+ return cent
390
+
391
+
392
+ def do():
393
+ rows = []
394
+ with open(
395
+ "{0}/../grade/{1}.csv".format(data_path, c_name),
396
+ "r",
397
+ encoding="utf-8-sig",
398
+ newline="",
399
+ ) as file:
400
+ reader = csv.reader(file)
401
+ rows = [row for row in reader]
402
+
403
+ cents = []
404
+ for i in range(len(rows)):
405
+ line = []
406
+ for j1 in range(sx_times):
407
+ shixun_cents = shixu_fun(rows[i])
408
+ line.extend(shixun_cents)
409
+
410
+ for j2 in range(xz_times):
411
+ xiaozu_cents = xiaozu_fun(rows[i])
412
+ line.extend(xiaozu_cents)
413
+
414
+ jieke_cents = jieke_fun(rows[i])
415
+ line.extend(jieke_cents)
416
+
417
+ homework_cents = homework_fun(rows[i])
418
+ line.extend(homework_cents)
419
+
420
+ cents.append(line)
421
+
422
+ with open(
423
+ "{0}/../grade/{3}_{1}_{2}.csv".format(
424
+ data_path,
425
+ "gd",
426
+ c_name,
427
+ format_timestamp(datetime.now().timestamp() * 1000),
428
+ ),
429
+ "a",
430
+ encoding="utf-8-sig",
431
+ newline="",
432
+ ) as file:
433
+ writer = csv.writer(file)
434
+ for row in cents:
435
+ writer.writerow(row)
436
+
437
+
438
+ if __name__ == "__main__":
439
+ logger.info("random_grade Starting ...... ")
440
+ do()