这是API链接码(元大期货)
我们的团队已经尝试了很多周,现在似乎是完成它的最后一步了。 你可以在我的 Github 上查阅他的全部代码、包和文件。 此存储库的首页有一个 readme.md,其中包含分步过程。 (https://github.com/brian09088/元大API)
当我开始在 anaconda Spyder 上运行它时,它会弹出 GUI 窗口进行登录 但是几秒钟后,它会显示没有任何反应,需要关机。 像下图这样:
class MyApp(wx.App):
def __init__(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True):
super().__init__(redirect, filename, useBestVisual, clearSigInt)
self.keepGoing = True
def MainLoop(self, run_func):
# Create an event loop and make it active. If you are
# only going to temporarily have a nested event loop then
# you should get a reference to the old one and set it as
# the active event loop when you are done with this one...
evtloop = wx.GUIEventLoop()
old = wx.EventLoop.GetActive()
wx.EventLoop.SetActive(evtloop)
# This outer loop determines when to exit the application,
# for this example we let the main frame reset this flag
# when it closes.
while self.keepGoing:
# At this point in the outer loop you could do
# whatever you implemented your own MainLoop for. It
# should be quick and non-blocking, otherwise your GUI
# will freeze.
# call_your_code_here()
run_func ()
while not q.empty():
next_job = q.get()
DoJob (Bot, next_job)
# This inner loop will process any GUI events
# until there are no more waiting.
while evtloop.Pending():
evtloop.Dispatch()
# Send idle events to idle handlers. You may want to
# throttle this back a bit somehow so there is not too
# much CPU time spent in the idle handlers. For this
# example, I'll just snooze a little...
time.sleep(0.10)
evtloop.ProcessIdle()
wx.EventLoop.SetActive(old)
def Oninit(self):
self.keepGoing = True
return True
def run_job():
while not q.empty():
next_job = q.get()
DoJob(Bot, next_job)
if __name__ == "__main__":
app=MyApp()
frame = AppFrame(None, title='YuantaQuoteAPI Sample',size = (670,370))
frame.Show(True)
Bot = StockBot(frame.Handle)
app.MainLoop(run_job)
这个 py 文件已经完成,没有任何错误,并打开一个 GUI 登录窗口,但只要我输入我的帐户和密码,现在它显示属性错误:SetMktLogon
不知是不是有什么函数或者包是少了或者需要继承里面的一些对象?
我终于发现我需要创建 python-32bits 环境和 wxPython for also 32-bits ,因为财务背景是基于过去的技术。 逐步查看我的 readme.md https://github.com/brian09088/元大API