Open Sim-fo opened 9 years ago
You have two improvements listed.
For now you could run two separate instances of the software in two separate directories with your StdDev/EMA and StdDev/FullStochRSID configurations.
I'll be leaving this issue open until these improvements are implemented. Thank you for bringing them up.
For now you could run two separate instances of the software in two separate directories with your StdDev/EMA and StdDev/FullStochRSID configurations.
Thanks for advise, I thought about it. With a pair of EMA/StdDev all is clear - [['StdDev', 'EMA']]. It's works. What should I do if I want to FullStochRSID works only if treshold StdDev less than 0.4? How can I limit the treshold on the opposite side?
I didn't even catch that we don't currently support that for volatility indicators. Give me a bit and there will be a new configurable for volatility indicators to allow that.
Thank you!
Part of this was implemented in 7db27f6e. There was also an issue in master which was breaking some combined indicators which is now fixed.
Currently you will need to run two separate instances of the software in separate directories to accomplish what you want. I have changes planned later on for this, but it's quite a bit of rewriting as of now.
For FullStochRSID and StdDev, you would run [['FullStochRSID', 'StdDev']]. Then set StdDev's VolatilityThresholdOver to False.
Thank you, it's working. But the third version of the program sometimes can't connect through websocket protocol, I get such errors:
Connecting to Private OKCoin WebSocket...
Connecting to Public OKCoin WebSocket...
Future/Task exception was never retrieved
future: Task(<initialize>)<exception=UnboundLocalError("local variable 'ws' referenced before assignment",)>
Traceback (most recent call last):
File "/home/ubuntu/workspace/okcoin/WebSocketAPI.py", line 30, in initialize
ws = yield from websockets.connect(url)
File "/home/ubuntu/.local/lib/python3.4/site-packages/websockets/client.py", line 120, in connect
factory, wsuri.host, wsuri.port, **kwds)
File "/usr/lib/python3.4/asyncio/base_events.py", line 437, in create_connection
sock, protocol_factory, ssl, server_hostname)
File "/usr/lib/python3.4/asyncio/base_events.py", line 453, in _create_connection_transport
yield from waiter
File "/usr/lib/python3.4/asyncio/futures.py", line 348, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 351, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/lib/python3.4/asyncio/selector_events.py", line 598, in _on_handshake
self._sock.do_handshake()
File "/usr/lib/python3.4/ssl.py", line 805, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 298, in _step
result = coro.throw(exc)
File "/home/ubuntu/workspace/okcoin/WebSocketAPI.py", line 35, in initialize
OKCoinWSPublic.Ticker = yield from ws.recv()
UnboundLocalError: local variable 'ws' referenced before assignment>>
The second version at the same time connects without any problems. Is it a problem on okcoin.com with websocket protocol or bug of the third version the program? When I used the second version... I didn't have such problem
And sometimes I get these errors:
EMAwbic: -2.6382200447091063e-14 %
Exception in thread Thread-343:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 1186, in run
self.function(*self.args, **self.kwargs)
File "/home/ubuntu/workspace/genutils.py", line 16, in do_every
worker_func()
File "avarice.py", line 39, in RunCommon
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.IndicatorList}
File "avarice.py", line 39, in <dictcomp>
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.IndicatorList}
File "/home/ubuntu/workspace/indicators.py", line 236, in indicator
ldb.price_list, storage.getlist('FRAMA_Short_list'), gc.FRAMA.ShortPeriod))
File "/home/ubuntu/workspace/indicators.py", line 53, in FRAMA
* (Helpers.FractalDimension(list1, period1) - 1))
File "/home/ubuntu/workspace/indicators.py", line 48, in FractalDimension
D = (math.log(N1 + N2) - math.log(N3)) / math.log(2)
ValueError: math domain error
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 1186, in run
self.function(*self.args, **self.kwargs)
File "/home/ubuntu/workspace/genutils.py", line 16, in do_every
worker_func()
File "avarice.py", line 39, in RunCommon
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.IndicatorList}
File "avarice.py", line 39, in <dictcomp>
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.IndicatorList}
File "/home/ubuntu/workspace/indicators.py", line 416, in indicator
'KDJ_FastK_list', Helpers.FastStochK(ldb.price_list, gc.KDJ.FastKPeriod))
File "/home/ubuntu/workspace/indicators.py", line 71, in FastStochK
- LowestPeriod)) * 100
ZeroDivisionError: float division by zero
Exception in thread Thread-39:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 1186, in run
self.function(*self.args, **self.kwargs)
File "/home/ubuntu/workspace/genutils.py", line 16, in do_every
worker_func()
File "avarice.py", line 44, in RunCommon
trd.TradeFromStrategy()
File "/home/ubuntu/workspace/trader.py", line 77, in TradeFromStrategy
TradeAmount = GetTradeAmount('sell', st.Trade_dict['TradeVolume'])
File "/home/ubuntu/workspace/trader.py", line 19, in GetTradeAmount
ta = gu.RoundIfGreaterThan((volume / 100) * el.GetFree('asset'), 3)
File "/home/ubuntu/workspace/exchangelayer.py", line 39, in GetFree
okwspriv.userinfo())[-1]['data']['info']['funds']['free'][gc.API.Asset]
File "/home/ubuntu/workspace/okcoin/WebSocketAPI.py", line 70, in userinfo
'parameters':{ 'api_key':'" + self.api_key + "', 'sign':'" + sign + "'} }")
File "/home/ubuntu/.local/lib/python3.4/site-packages/websocket/_core.py", line 686, in send
return self.send_frame(frame)
File "/home/ubuntu/.local/lib/python3.4/site-packages/websocket/_core.py", line 712, in send_frame
l = self._send(data)
File "/home/ubuntu/.local/lib/python3.4/site-packages/websocket/_core.py", line 923, in _send
return self.sock.send(data)
File "/usr/lib/python3.4/ssl.py", line 679, in send
v = self._sslobj.write(data)
ssl.SSLError: [SSL: BAD_WRITE_RETRY] bad write retry (_ssl.c:1636)
Maybe that happens because for oscillators I set the interval less than one minute? Or there could be other reasons?
For your first issue: Make sure that each of your software instances are updated. OKCoin has also been having major connection issues which would stop most new connections (paired with bad downtime). This is outside of their update times also, and I've noticed similar behavior. Avarice doesn't try indefinitely to connect for the public connection, and these exceptions may occur if a connection can't be established in the two attempts. I'll be sure to catch those with a printed error.
For your second issues, I just submitted a few new commits to catch these exceptions. You're correct they'd be less likely to occur at larger candle sizes, but they shouldn't pop up for you any longer.
Since just after the last OKCoin update, I haven't seen any connection issues while testing. Hopefully this lasts.
Thank you very much! Now everything works perfectly.
Thank you for the Avarice bot, very useful program. Unfortunately, I fail to adjust the program for switching between strategies. Is it possible to use volatility indicator for switching between that? For example: if StdDev > 0.2 works only EMA if StdDev < 0.2 works only FullStochRSID
It would be great especially for oscillators, if the indicator value and buying/selling decision would be calculated every 2 secs depending on API but not after forming the candle.