-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
71 lines (67 loc) · 3.99 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import time
import datetime, sys, os
sys.path.append('/usr/local/lib/python3.6/site-packages')
from zaifdata.indicators import EMA, SMA, BBANDS, RSI, MACD, ADX
start_time = time.time()
macd = MACD(currency_pair='btc_jpy', period='1h', short=12, long=26, signal=9)
rets = macd.request_data(count=1)
for result in rets:
print(datetime.datetime.fromtimestamp(result['time']))
print(result)
print(f"time:{time.time()-start_time}")
'''
print(f"{datetime.datetime.today()}")
ema = EMA(currency_pair='btc_jpy', period='1h')
rets = ema.request_data(count=3, style='df')
print(rets)
'''
'''
time ema
0 1532325600 833057.000000
1 1532329200 835129.538462
2 1532332800 836889.189349
[{'time': 1532333460, 'macd': 71.68837062676903, 'macdsignal': 470.50029767217995, 'macdhist': -398.8119270454109},
{'time': 1532333520, 'macd': 25.473581491736695, 'macdsignal': 381.4949544360913, 'macdhist': -356.0213729443546},
{'time': 1532333580, 'macd': -10.626023460179567, 'macdsignal': 303.07075885683713, 'macdhist': -313.6967823170167}]
'''
'''
ubuntu@u310:~/zaifdata$ sudo python3.6 test.py
average close high low open time volume
0 771213.319067 771870.0 773875.0 769000.0 769630.0 1533607200 261.2605
1 772242.950299 770240.0 773620.0 770240.0 771705.0 1533610800 288.0181
2 772394.904331 773295.0 773995.0 770230.0 770230.0 1533614400 214.9654
3 772417.253488 771500.0 774315.0 770510.0 773300.0 1533618000 285.0383
4 772065.608606 772650.0 773300.0 770740.0 771480.0 1533621600 269.0338
5 781400.930496 781660.0 787000.0 772630.0 772650.0 1533625200 592.3692
6 782202.042998 781840.0 783480.0 780230.0 781655.0 1533628800 381.1764
7 783738.444068 783615.0 786150.0 781845.0 781865.0 1533632400 434.8219
8 782790.660942 783420.0 784000.0 781200.0 783615.0 1533636000 218.6290
9 787191.484960 786995.0 791000.0 783090.0 783405.0 1533639600 452.0053
10 786441.501891 789735.0 791835.0 783005.0 787330.0 1533643200 445.9486
11 789615.465687 784040.0 794500.0 784000.0 789735.0 1533646800 579.7652
12 785697.114774 787335.0 788000.0 782160.0 784335.0 1533650400 433.9315
13 789489.350030 791705.0 792370.0 786000.0 787110.0 1533654000 382.8283
14 791892.438959 790615.0 795000.0 789340.0 791700.0 1533657600 375.7503
15 789768.792361 790365.0 792000.0 787625.0 790535.0 1533661200 290.6216
16 788743.239672 790160.0 791445.0 786000.0 790260.0 1533664800 232.2979
17 785245.533590 778475.0 790470.0 778025.0 790020.0 1533668400 298.6105
18 768735.597534 766910.0 780000.0 762730.0 778475.0 1533672000 718.5689
19 751569.108641 754005.0 766555.0 745500.0 766550.0 1533675600 943.0920
20 753493.957248 753370.0 759995.0 749960.0 754075.0 1533679200 615.4340
21 749764.221832 748665.0 753900.0 745200.0 753600.0 1533682800 583.8738
22 736342.115768 735725.0 748830.0 729430.0 748635.0 1533686400 837.5478
23 735985.878232 731655.0 739900.0 730010.0 735920.0 1533690000 528.4928
24 734692.650926 736840.0 737760.0 731345.0 732245.0 1533693600 445.3427
25 734520.976265 734500.0 736995.0 732035.0 736995.0 1533697200 324.4985
26 724589.932749 723575.0 734785.0 720000.0 734770.0 1533700800 684.2259
27 721753.119145 728665.0 736510.0 711000.0 723670.0 1533704400 809.6827
28 727467.587941 727500.0 730890.0 725700.0 728665.0 1533708000 554.9158
29 723308.120041 716975.0 728120.0 716565.0 727595.0 1533711600 451.3037
30 718905.454724 723335.0 725000.0 715000.0 716000.0 1533715200 541.7793
31 720813.331211 720500.0 724955.0 717780.0 723685.0 1533718800 401.3383
32 718877.339831 719405.0 722100.0 714000.0 720415.0 1533722400 367.3444
33 721343.855701 722370.0 724200.0 718000.0 719405.0 1533726000 238.7007
2018-08-08 20:00:00
{'time': 1533726000, 'macd': -16693.17231328436, 'macdsignal': -15420.830541549225, 'macdhist': -1272.3417717351367}
time:0.38155078887939453
'''