qstrader
qstrader copied to clipboard
How to combine django and qstrader?
I write a simple django.
djangotest131.zip
I put buy_and_hold_backtest.py's main function in hello_world's function.
But it will cause the error:
Error: Got unexpected extra argument (runserver)
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in call
return self.application(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 177, in call
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/leo/djangotest/trip/views.py", line 25, in hello_world
main()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 708, in main
sys.exit(e.exit_code)
SystemExit: 2
I can run correctly without using django. Anyone know how to fix this problem? Or how to put the buy_and_hold_backtest.py's main function in the right place? Should I use Celery ? Thank you very much.
I have fixed this issue.
It can't use click function.
I remove the click function(red part) and add the parameter into main function(blue part).
Finally it works. Thanks