-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnptest.py
42 lines (39 loc) · 793 Bytes
/
nptest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import numpy as np
import datetime
bars_dtype = [
# use datetime64 may improve performance/memory usage, but it's hard to talk with other modules, like TimeFrame
("frame", "O"),
("open", "f4"),
("high", "f4"),
("low", "f4"),
("close", "f4"),
("volume", "f8"),
("amount", "f8"),
("factor", "f4"),
]
bars = np.array(
[
(
datetime.date(2019, 1, 5),
5.1,
5.2,
5.0,
5.15,
1000000,
100000000,
1.23,
),
(
datetime.date(2019, 1, 6),
5.1,
5.2,
5.0,
5.15,
1000000,
100000000,
1.23,
),
],
dtype=bars_dtype,
)
print(bars['frame'])