Galts-Gulch / avarice

Multi-Indicator Python3 OKCoin CN & Intl Trading Bot/Infrastructure
Other
91 stars 29 forks source link

WebUI #20

Open RealJohnGalt opened 9 years ago

RealJohnGalt commented 9 years ago

WebUI for configuration, dashboard (simulator/trader/candles tables), and graphs. This is using flask, flask-bootstrap, flask-wtf, and celery for running the webui "in the background."

RealJohnGalt commented 9 years ago

Actually use configparser. Json is too difficult for making human editable. The current genconfig.py is also bad.

RealJohnGalt commented 9 years ago

Config and software is moved over, and initial (very WIP and incomplete) configuration only webpage aid is committed 2294e26

RealJohnGalt commented 9 years ago

Basic (but functional) configuration page only: screenshot from 2015-03-28 18-03-43

alanfuji commented 9 years ago

This will be a great addition, look forward to testing it out.

RealJohnGalt commented 9 years ago

Thank you. I fixed a few bugs in that code, improved the layout, and moved the finished sections to separate pages.

This will start out as a page only for configuration for testing while it's made into something more (able to start/stop avarice, and view status). For Trade Indicators, Verbose Indicators, and Grapher Indicators, I'm going to do checkbox forms with save/clear buttons for each available indicator.

Current status: screenshot from 2015-03-29 21-27-53

RealJohnGalt commented 9 years ago

Update: The staging branch is now fully functional, but improvements are in the work. What's committed: screenshot from 2015-03-30 05-44-33

And what's in the works for Trade Indicators selection: screenshot from 2015-03-30 19-00-47

The plan (with quite a bit more coding to be done), is to be able to select single or combined indicators from here, and save/clear any form (indicator set). On save, a new form is spawned (like the second form shown).

aehaynes commented 9 years ago

This is great!

ghost commented 9 years ago

How do you load the configuration webpage? I'm testing milestone 5.0

RealJohnGalt commented 9 years ago

@Hapexamendios I apologize for the late response, I've been very busy recently. You must check out the "staging" branch, run "pip3 -r requirements.txt" to install all dependencies, then run python3 webconfigure.py. The prompts will be cleaned up for starting/exiting webconfigure at some point.

ghost commented 9 years ago

Get the following error when attempting to execute webconfigure.py after installing the requirements.

C:\Python34>python.exe C:\AvariceSimulation\Test\webconfigure.py Traceback (most recent call last): File "C:\AvariceSimulation\Test\webconfigure.py", line 11, in class API(Form): File "C:\AvariceSimulation\Test\webconfigure.py", line 15, in API config['API']['Verbose'])) File "C:\Python34\lib\site-packages\configobj.py", line 554, in getitem val = dict.getitem(self, key) KeyError: 'API'

RealJohnGalt commented 9 years ago

@Hapexamendios It's issuing that error because it's unable to read defaults from the stock config.ini. I have a few things for you to check and try: 1) Ensure C:\AvariceSimulation\Test\ has a populated config.ini 2) Try running python from the C:\AvariceSimulation\Test\ directory. This should look like "C:\Python34\python.exe webconfigure.py" from that directory. The path doesn't matter on Linux which I'm testing on, but it might on Windows (unsure of this). If this the issue, I'll install python in vm windows and figure out a solution to this.

ghost commented 9 years ago

No worries about being busy, we all have lives outside of the digital one.

I got it to work by running python within the C:\AvariceSimulation\Test directory. Getting some other errors now, but not sure if it's a bug or just the code not being clean to run. Webconfig worked flawlessly by the way. Awesome job!

RealJohnGalt commented 9 years ago

Thank you! Please post any errors you receive. I think the staging branch is looking pretty good at this point, save for cleaning up some rough edges.

I'll add a warning for now when webconfigure runs to try that fix and troubleshoot it later (not a major priority).

ghost commented 9 years ago

Okay, here are some of the errors I am getting. But it's not with the WebUI. Appears to be for DMI.

C:\AvariceSimulation>python avarice.py Database is recent enough; resuming Connecting to OKCoin WebSocket(s)... Waiting 14.15 minutes to resume on schedule Task exception was never retrieved future: <Task finished coro=<run() done, defined at C:\Python34\lib\site-package s\websockets\protocol.py:229> exception=ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)> Traceback (most recent call last): File "C:\Python34\lib\asyncio\tasks.py", line 234, in _step result = coro.throw(exc) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 235, in run msg = yield from self.read_message() File "C:\Python34\lib\site-packages\websockets\protocol.py", line 257, in read _message frame = yield from self.read_data_frame(max_size=self.max_size) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 312, in read _data_frame frame = yield from self.read_frame(max_size) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 342, in read _frame frame = yield from read_frame(self.reader.readexactly, is_masked, max_size=m ax_size) File "C:\Python34\lib\site-packages\websockets\framing.py", line 67, in read_f rame data = yield from reader(2) File "C:\Python34\lib\asyncio\streams.py", line 479, in readexactly block = yield from self.read(n) File "C:\Python34\lib\asyncio\streams.py", line 452, in read yield from self._wait_for_data('read') File "C:\Python34\lib\asyncio\streams.py", line 393, in _wait_for_data yield from self._waiter File "C:\Python34\lib\asyncio\futures.py", line 386, in iter yield self # This tells Task to wait for completion. File "C:\Python34\lib\asyncio\tasks.py", line 287, in _wakeup value = future.result() File "C:\Python34\lib\asyncio\futures.py", line 275, in result raise self._exception File "C:\Python34\lib\asyncio\selector_events.py", line 897, in _read_ready data = self._sock.recv(self.max_size) File "C:\Python34\lib\ssl.py", line 736, in recv return self.read(buflen) File "C:\Python34\lib\ssl.py", line 625, in read v = self._sslobj.read(len or 1024) ConnectionResetError: [WinError 10054] An existing connection was forcibly close d by the remote host Task exception was never retrieved future: <Task finished coro=<run() done, defined at C:\Python34\lib\site-package s\websockets\protocol.py:229> exception=ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)> Traceback (most recent call last): File "C:\Python34\lib\asyncio\tasks.py", line 234, in _step result = coro.throw(exc) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 235, in run msg = yield from self.read_message() File "C:\Python34\lib\site-packages\websockets\protocol.py", line 257, in read _message frame = yield from self.read_data_frame(max_size=self.max_size) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 312, in read _data_frame frame = yield from self.read_frame(max_size) File "C:\Python34\lib\site-packages\websockets\protocol.py", line 342, in read _frame frame = yield from read_frame(self.reader.readexactly, is_masked, max_size=m ax_size) File "C:\Python34\lib\site-packages\websockets\framing.py", line 67, in read_f rame data = yield from reader(2) File "C:\Python34\lib\asyncio\streams.py", line 479, in readexactly block = yield from self.read(n) File "C:\Python34\lib\asyncio\streams.py", line 452, in read yield from self._wait_for_data('read') File "C:\Python34\lib\asyncio\streams.py", line 393, in _wait_for_data yield from self._waiter File "C:\Python34\lib\asyncio\futures.py", line 386, in iter yield self # This tells Task to wait for completion. File "C:\Python34\lib\asyncio\tasks.py", line 287, in _wakeup value = future.result() File "C:\Python34\lib\asyncio\futures.py", line 275, in result raise self._exception File "C:\Python34\lib\asyncio\selector_events.py", line 897, in _read_ready data = self._sock.recv(self.max_size) File "C:\Python34\lib\ssl.py", line 736, in recv return self.read(buflen) File "C:\Python34\lib\ssl.py", line 625, in read v = self._sslobj.read(len or 1024) ConnectionResetError: [WinError 10054] An existing connection was forcibly close d by the remote host