NCUMA Brian
NCUMA Brian

Reputation: 11

API linking program debug (Yuanta Futures)(Already Fixed~)

This is the API linking code (Yuanta Futures)

Our team have tried many weeks, and now it seems to be the last step to complete it. You can consult he entire codes, packages, files are on my Github. There is a readme.md at the frontpage of this repository which contains step-by-step process. (https://github.com/brian09088/Yuanta-API)

When I start to run it on anaconda Spyder, It will pop out GUI window to login but after few seconds, the it will shows no response, and need to shut down. Like the picture below: enter image description here

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)

and this py file already done without any error and turn out a GUI login window, but as long as I type my account and pw and now it shows attributeerror: SetMktLogon

I wonder that any function or package is missing or needs to inherit some objects in it?

already done and fix the issues, create a 32-bits environment and wxpython for 32-bits also. successfully login

Upvotes: 0

Views: 135

Answers (0)

Related Questions