下午好,
我想看看你们中是否有人能帮助我在几分钟内制作蜡烛图。我已设法在几天内绘制图形,但我不知道如何在几分钟内完成它们。
附加代码。
2018-01-03 16:54:28.758526+0000 App[5750:1165819] [DYMTLInitPlatform] platform initialization successful
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0103 16:54:29.372881 1847881728 JSCHelpers.cpp:137] Got JS Exception: Can't find variable: setTimeout (/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364)
E0103 16:54:29.373000 1847881728 JSCHelpers.cpp:143] Got JS Stack: /var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364:6244
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364:156
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364:197
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:362:1781
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:361:103
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:360:136
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:298:317
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:12:38
t@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:620
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:2:154
global code@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:722:9
E0103 16:54:29.376503 1847881728 JSCHelpers.cpp:137] Got JS Exception: Exception calling object as function: Module AppRegistry is not a registered callable module (calling runApplication) (<unknown file>:14)
E0103 16:54:29.376549 1847881728 JSCHelpers.cpp:143] Got JS Stack: exports@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:14:306
value@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:18:2937
/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:18:812
value@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:18:2507
value@/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:18:784
value@[native code]
2018-01-03 16:54:29.377 [fatal][tid:main] Unhandled JS Exception: Can't find variable: setTimeout (/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364)
2018-01-03 16:54:29.378191+0000 App[5750:1165546] Unhandled JS Exception: Can't find variable: setTimeout (/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364)
2018-01-03 16:54:29.378319+0000 App[5750:1165546] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Can't find variable: setTimeout (/var/containers/Bundle/Application/19F39B2A-43F0-4FB1-BD1D-34254608E4BB/App.app/main.jsbundle:364)', reason: 'Unhandled JS Exception: Can't find variable: setTimeout (/var/containers/Bu...'
*** First throw call stack:
(0x18295e364 0x181ba4528 0x18295e2ac 0x1029f4344 0x1029dfe44 0x104a452cc 0x104a4528c 0x104a49ea0 0x182906544 0x182904120 0x182823e58 0x1846cef84 0x18bea2844 0x102993684 0x18234056c)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:4)
如此接近,但只有反复试验会让你更进一步。不是很糟糕的文档吗?
简单地将width
除以一天中的分钟数。您的副本的完整代码&amp;请在下方粘贴,但我所做的只是将width = 0.5
更改为width = 0.5/(24*60)
。
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import dates, ticker
import matplotlib as mpl
from mpl_finance import candlestick_ohlc
mpl.style.use('default')
data = [('2017-01-02 02:00:00', '1.05155', '1.05197', '1.05155', '1.0519'),
('2017-01-02 02:01:00', '1.05209', '1.05209', '1.05177', '1.05179'),
('2017-01-02 02:02:00', '1.05177', '1.05198', '1.05177', '1.05178'),
('2017-01-02 02:03:00', '1.05188', '1.052', '1.05188', '1.052'),
('2017-01-02 02:04:00', '1.05196', '1.05204', '1.05196', '1.05203'),
('2017-01-02 02:06:00', '1.05196', '1.05204', '1.05196', '1.05204'),
('2017-01-02 02:07:00', '1.05205', '1.0521', '1.05205', '1.05209'),
('2017-01-02 02:08:00', '1.0521', '1.0521', '1.05209', '1.05209'),
('2017-01-02 02:09:00', '1.05208', '1.05209', '1.05208', '1.05209'),
('2017-01-02 02:10:00', '1.05208', '1.05211', '1.05207', '1.05209')]
ohlc_data = []
for line in data:
ohlc_data.append((dates.datestr2num(line[0]), np.float64(line[1]), np.float64(line[2]), np.float64(line[3]), np.float64(line[4])))
fig, ax1 = plt.subplots()
candlestick_ohlc(ax1, ohlc_data, width = 0.5/(24*60), colorup = 'g', colordown = 'r', alpha = 0.8)
ax1.xaxis.set_major_formatter(dates.DateFormatter('%d/%m/%Y %H:%M'))
ax1.xaxis.set_major_locator(ticker.MaxNLocator(10))
plt.xticks(rotation = 30)
plt.grid()
plt.xlabel('Date')
plt.ylabel('Price')
plt.title('Historical Data EURUSD')
plt.tight_layout()
plt.show()