Code Monkey home page Code Monkey logo

avarice's Introduction

No Longer Maintained -- A new piece of software (rapacity) is being developed from scratch.

See #43 for details

This is a free project I work on in free time. If you would like to donate, you may do so at the following bitcoin address: 1avah9CEkXThtYbdsHiUyxMJE45tydSmi

avarice's People

Contributors

realjohngalt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avarice's Issues

Willingness to contribute

hey,

I would like to contribute to the project and also have a better understanding of the whole system.

Question - No new issue. :)

How are you with machine learning? Would it be possible to set up a machine to learn when to make trades? The reason I ask is that I've got an Azure account and I see Machine learning is part of my subscription. So just thought I'd see what your thoughts were regarding that.

5.0.1a Bug

I seen to get this cropping up a lot on one of my bots:

Candle: 14560 | Price: 1460.0 cny | Time: 12:41:56 | Date: 2015/08/29
MACD : We are in an Uptrend | Diff: -1.577797553469054
MACD Hist: 0.8951077486893806
FullStochRSID: 19.740019345764736
Exception in thread Thread-156:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1186, in run
self.function(_self.args, *_self.kwargs)
File "C:\Avarice\genutils.py", line 16, in do_every
worker_func()
File "C:\Avarice\avarice.py", line 107, in RunCommon
getattr(strategies, config.gc['Trader']['Advanced Strategy'])()
File "C:\Avarice\strategies.py", line 76, in Default
if IndList[-1] < LocalBid:
TypeError: unorderable types: float() < str()

Since you are doing a major re-write not sure how important it is to fix this, but just thought I would post it.

Staging branch DMI issue.

Running the latest staging branch and keep getting the following error whether DMI is in Full mode or volatility.

C:\AvariceSimulation>avarice.py
Database is recent enough; resuming
Connecting to OKCoin WebSocket(s)...
Waiting 8.93 minutes to resume on schedule
Candle: 9067 | Price: 1623.89 cny | Time: 10:18:51 | Date: 2015/07/05
MACD : We are in an Uptrend | Diff: 4.206402418095422
MACD Hist: 0.7495248457172692
ADX: 0.1457345769950673
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1186, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 16, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 133, in RCWrapper
gu.do_every(ldb.CandleSizeSeconds, RunCommon)
File "C:\AvariceSimulation\genutils.py", line 16, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 107, in RunCommon
getattr(strategies, config.gc['Trader']['Advanced Strategy'])()
File "C:\AvariceSimulation\strategies.py", line 49, in Default
if ast.literal_eval(config.gc['Indicators'][l]['Volatility Threshold Over'])
:
File "C:\Python34\lib\site-packages\configobj.py", line 554, in getitem
val = dict.getitem(self, key)
KeyError: 'DMI'

Candle: 9068 | Price: 1623.46 cny | Time: 10:33:51 | Date: 2015/07/05
MACD : We are in a Downtrend | Diff: 3.299140421387392
MACD Hist: -0.1411332403601544
ADX: 0.1608811693435232
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1186, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 16, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 107, in RunCommon
getattr(strategies, config.gc['Trader']['Advanced Strategy'])()
File "C:\AvariceSimulation\strategies.py", line 49, in Default
if ast.literal_eval(config.gc['Indicators'][l]['Volatility Threshold Over'])
:
File "C:\Python34\lib\site-packages\configobj.py", line 554, in getitem
val = dict.getitem(self, key)
KeyError: 'DMI'

Simulator wanted to sell even though it was disabled

I have 2 of the bots running from different directories. This one is from my live trader:

Candle: 2160 | Price: 1642.61 cny | Time: 01:07:45 | Date: 2015/03/24
FullStochRSID: 82.88775847501012
MACD : We are in a Downtrend | Diff: 0.07920425764382344
MACD Hist: -0.1251305122290011
SIMULATOR: Wanted to SELL -3.1943198086636923e-16 btc at 1642.55 but needed more
btc

Simulator wanted to sell, even though it was disabled, and it wanted to sell more btc than what is even listed in the genconfig.py file.

robust websocket connectivity

I've had many issues maintaining consistent websocket connections to okcoin.cn. I'm aware that it's just not easy, with the great wall of China and whatnot. The problem I'm about to describe is one that I've also had with a completely different websocket application I was working on in C++.

Sometimes, no errors are thrown and there's no sign that the connection has dropped, except that there's no data coming in. It might start coming back after a few seconds, a few minutes, or maybe never. This can lead to many identical candles if the public websocket is down long enough, and it wrongly thought its trade succeeded when the private websocket went down (I think that's why anyway.)

I've been playing around with two different approaches to monitoring the two connections. The usual way is to send {'event':'ping'} on the websocket occasionally. For the public connection, you can also just keep track of the time since the last ticker data and reset the connection if it exceeds a threshold. It seems to be working so far. I'm testing it by disabling and enabling my wifi while it's running, and it reconnects when it can - it may be a good idea to pause trading and re-initialize the indicators if it went on for long enough, but it's not so hard to notice the problem and reconnect fast enough that it usually happens between candles. I'll try running it overnight with 1-minute candles.

By the way, is there a good reason to use two different websocket(s) libraries?

cheers
alan

[BUG] Exception on Database

Config:

#
# Everything below is fully documented in
# http://galts-gulch.github.io/avarice/configuring
#

[API]
  Verbose = True
  Exchange = okcoin
  Trade Pair = btc_usd
  API Key = ****
  Secret Key = ****
  Asset Trade Minimum = 0.01
  Reconnect Wait = 25

[Candles]
  Verbose = True
  Size = 15

[Trader]
  Enabled = True
  Verbose = True
  # All of the following is also used by Simulator
  Trade Indicators = [['MACD', 'FullStochRSID']]
  Advanced Strategy = Default
  Trade Volume = 99
  Single Trade = True
  Trade Persist = False
  Trade Delay = 3
  ReIssue Slippage = 0.12
  ReIssue Delay = 5

[Simulator]
  Verbose = True
  Asset = 0.1
  Currency = 0

[Notifier]
  [[Text File]]
    Rollover Time = 24
    Backup Count = 7
    Path = ./recorded
    Trader File Name = trader.log
    Simulator File Name = simulator.log
  [[Pushover]]
    Simulator = False
    Trader = False
    App Token = stub
    User Key = stub
  [[SMTP]]
    Simulator = True
    Trader = True
    Host = localhost
    From = '"Avarice" <avarice@******>'
    To = *****
  [[TLS SMTP]]
    # GMail
    Simulator = False
    Trader = False
    Host = smtp.gmail.com
    Port = 587
    Username = [email protected]
    Password = stub
    To = Your full e-mail address
  [[XMPP]]
    Simulator = False
    Trader = False
    Username = stub
    Password = stub
    Recipient = stub
    Host = stub
    Server = stub
    Port = stub
    Name = Avarice
  [[IRC]]
    Simulator = True
    Trader = True
    Server = irc.freenode.net
    Port = 6667
    NickServ = False
    Username = Energizer
    Password = stub
    Recipient = RDash

[Database]
  Archive = True
  Store All = True
  Debug = True
  Path = ./database

[Grapher]
  Enabled = True
  Path = ./charts
  Theme = DarkSolarized
  Show Time = False
  Max Lookback = 30

[Indicators]
  # All indicators below are fully documented in
  # http://galts-gulch.github.io/avarice/indicators

  [[Simple Movement Average]]
    Verbose = False
    # We support both CD and Diff Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Short Period = 15
    Long Period = 50
    Diff Down = -0.025
    Diff Up = 0.025
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Exponential Movement Average]]
    Verbose = False
    # We support both CD and Diff Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Short Period = 10
    Long Period = 21
    Diff Down = -0.025
    Diff Up = 0.025
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Double Exponential Movement Average]]
    Verbose = False
    # Uses both EMA's Long Period and ShortPeriod from above
    # We support both CD and Diff Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Diff Down = -0.025
    Diff Up = 0.025
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[EMAwbic]]
    Verbose = False
    Candle Size Multiplier = 1
    Period = 60
    # Buy when price is <Bid % of EMA
    Bid = -75
    # Sell when price is >Ask % of EMA
    Ask = 95
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Fractal Adaptive Movement Average]]
    Verbose = False
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Short Period = 10
    Long Period = 21
    Alpha Constant = -4.6
    Diff Down = -0.025
    Diff Up = 0.025
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[MACD]]
    Verbose = True
    # Mike Bruns' agressive 3/11/16 are also recommended
    # We support both CD and Diff Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Short Period = 3
    Long Period = 11
    Signal Period = 16
    Diff Down = -0.1
    Diff Up = 0.1
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = True
      Trade Delay = 3

  [[DMACD]]
    Verbose = False
    # Uses MACD's Long, Short, and Signal values
    # We support both CD and Diff Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Signal Period = 9
    Diff Down = -0.1
    Diff Up = 0.1
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3


  [[RSI]]
    Verbose = False
    # Period can never be less than 3, but 14
    # or higher is generally recommended.
    Candle Size Multiplier = 1
    Period = 14
    Ask = 70
    Bid = 30
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[Fast Stochastic RSI %K]]
    Verbose = False
    # %D uses %K periods, %D periods are SMA periods of %K
    Period = 3
    Ask = 80
    Bid = 20
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[Fast Stochastic RSI %D]]
    Verbose = False
    # %D uses %K periods, %D periods are SMA periods of %K
    Period = 3
    Ask = 80
    Bid = 20
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[Full Stochastic RSI %D]]
    Verbose = True
    # Full %D uses Fast %D periods, Full %D periods are SMA periods of Fast %D
    # We support both CD and Diff (standard) Indicator Strategies
    Indicator Strategy = Diff
    Period = 3
    Ask = 80
    Bid = 20
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = True
      Trade Delay = 3

  [[Fast Stochastic %K]]
    Verbose = False
    Candle Size Multiplier = 1
    Period = 14
    Ask = 95
    Bid = 5
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[Fast Stochastic %D]]
    Verbose = False
    # %D uses %K periods, %D periods are SMA periods of %K
    Period = 3
    Ask = 80
    Bid = 20
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[Full Stochastic %D]]
    Verbose = False
    # Full %D uses Fast %D periods, Full %D periods are SMA periods of Fast %D
    Period = 3
    Ask = 80
    Bid = 20
    [[[Trader]]]
      Trade Volume = 20
      Single Trade = False
      Trade Persist = False
      Trade Delay = 3

  [[KDJ]]
    Verbose = False
    # We support both CD and Diff (off J) Indicator Strategies
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Fast K Period = 9
    Full K Period = 3
    Full D Period = 3
    Ask = 100
    Bid = 0
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Aroon]]
    Verbose = False
    # We support both CD (when Aroon is > or < 0) and Diff (off bid/ask)
    # This is because zero line is where AroonUp and AroonDown converge/diverge
    Indicator Strategy = CD
    Candle Size Multiplier = 1
    Period = 25
    Bid = -90
    Ask = 90
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Ichimoku]]
    Verbose = False
    # Check galts-gulch.io/avarice/indicators for info on supported strategies.
    Indicator Strategy = Optimized
    Candle Size Multiplier = 1
    Tenkan-Sen Period = 9
    # Only used on Span B since SpanA just uses Tenkan-sen and Kijnun-sen.
    # Default is 2 * Kijun-Sen Period
    Senkou Span Period = 52
    Kijun-Sen Period = 26
    # Default is the same as Kijun-Sen Period
    Chikou Span Period = 26
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Standard Deviation]]
    Verbose = False
    Candle Size Multiplier = 1
    Volatility Threshold Over = True
    Period = 10
    Threshold = 0.4

  [[Bollinger Bands]]
    Verbose = False
    Candle Size Multiplier = 1
    Period = 20

  [[Bollinger Bandwidth]]
    Verbose = False
    # Uses Bollinger Bands Period. Threshold should be adjusted based on
    # Candle Size and intended use.
    Volatility Threshold Over = True
    Threshold = 1

  [[Average True Range]]
    Verbose = False
    Volatility Threshold Over = True
    Candle Size Multiplier = 1
    Period = 14
    Threshold = 10

  [[Chandelier Exit]]
    Verbose = False
    # We require running long enough for price to pass Short or Long exits before
    # determining which trend line to use.
    Candle Size Multiplier = 1
    Period = 22
    Multiplier = 3
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Directional Movement Index]]
    Verbose = False
    # Uses ATR period.
    # 'Full' uses ADX threshold, and +DI -DI crossovers to determine signal.
    # 'DI' uses +DI -DI crossovers to determine signal
    # 'Volatility' only uses threshold with ADX as a volatility indicator (must be combined).
    Indicator Strategy = Volatility
    Volatility Threshold Over = True
    # ADX Threshold for 'Volatility' or 'Full' Indicator Strategies
    Threshold = 20
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3

  [[Simple Rate of Change]]
    Verbose = False
    Candle Size Multiplier = 1
    Period = 12
    [[[Trader]]]
      Trade Volume = 99
      Single Trade = True
      Trade Persist = False
      Trade Delay = 3
Exception in thread Thread-1:
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/rdash/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 133, in RCWrapper
    gu.do_every(ldb.CandleSizeSeconds, RunCommon)
  File "/home/rdash/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 98, in RunCommon
    ldb.PopulateRow()
  File "/home/rdash/avarice/loggerdb.py", line 237, in PopulateRow
    (bid, ask, last, CurrTime, CurrDate, CurrDateTime))
sqlite3.OperationalError: no such table: MarketHistory

Multiple connections to Private Websocket

Each candle tick seems to display "connecting to Private OKCoin WebSocket". Not sure if this is intended or not but thought I would present it and see if this expected behavior or not.

Connecting to Private OKCoin WebSocket...
Database is recent enough; resuming
Connecting to Public OKCoin WebSocket...
Waiting 6.79 minutes to resume on schedule
Candle: 611 | Price: 1718.66 cny | Time: 20:52:03 | Date: 2015/03/07
FullStochRSID: 0.0
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
MACD : We are in a Downtrend | Diff: 1.3948082528163468
MACD Hist: -1.0601867046081859
Candle: 612 | Price: 1719.11 cny | Time: 21:07:03 | Date: 2015/03/07
FullStochRSID: 0.7040360270089825
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
Connecting to Private OKCoin WebSocket...
MACD : We are in a Downtrend | Diff: 0.9308467902690154
MACD Hist: -1.219318533724414

First candle takes CandleSize period to start

As of f77ea the first candle will wait CandleSize period before starting. Resumption has been fixed, however someone may need to wait quite awhile (depending on configuration) before they see progress.

XMPP module import error

I did perform the pip3 install xmpp_logging_handle and attempted to get Avarice to use my own xmpp server. Avarice version is 4.0.1, setting xmpp false for Simulator and Trader results in Avarice loading correctly. I fully admit I may not of configured it correctly.

Traceback (most recent call last):
File "C:\Avarice\avarice.py", line 4, in
import avarice
File "C:\Avarice\avarice.py", line 10, in
import notifier as no
File "C:\Avarice\notifier.py", line 10, in
from xmpp_logging_handler import XMPPHandler
File "C:\Python34\lib\site-packages\xmpp_logging_handler__init__.py", line 2,
in
from emitter import Send
ImportError: No module named 'emitter'

I looked for "emitter" but haven't found much about it. Seems to get referenced for YAML. But seems to be a completely different module.

error when clean the database?

Hello, Thanks for the great software!

I getting the following error with staging branch,
when database Store All set to False:

Exception in thread Thread-1:
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 "/root/avarice/staging/genutils.py", line 16, in do_every
worker_func()
File "avarice.py", line 133, in RCWrapper
gu.do_every(ldb.CandleSizeSeconds, RunCommon)
File "/root/avarice/staging/genutils.py", line 16, in do_every
worker_func()
File "avarice.py", line 98, in RunCommon
ldb.PopulateRow()
File "/root/avarice/staging/loggerdb.py", line 244, in PopulateRow
.format(tn=table_name, cn=i, lim=avarice.MaxCandleDepends))
sqlite3.IntegrityError: datatype mismatch

Fails to update the price

When running in simulation mode, after a couple of candles, avarice gets stuck on the same amount, seems like a caching issue?

Candle: 90 | Price: 1418.85 cny | Time: 13:28:54 | Date: 2015/04/25
Candle: 91 | Price: 1418.67 cny | Time: 13:43:54 | Date: 2015/04/25
Candle: 92 | Price: 1418.67 cny | Time: 13:58:54 | Date: 2015/04/25
Candle: 93 | Price: 1418.67 cny | Time: 14:13:54 | Date: 2015/04/25
Candle: 94 | Price: 1418.67 cny | Time: 14:28:54 | Date: 2015/04/25
Candle: 95 | Price: 1418.67 cny | Time: 14:43:54 | Date: 2015/04/25
Candle: 96 | Price: 1418.67 cny | Time: 14:58:54 | Date: 2015/04/25
Candle: 97 | Price: 1418.67 cny | Time: 15:13:54 | Date: 2015/04/25
Candle: 98 | Price: 1418.67 cny | Time: 15:28:54 | Date: 2015/04/25
Candle: 99 | Price: 1418.67 cny | Time: 15:43:54 | Date: 2015/04/25
Candle: 100 | Price: 1418.67 cny | Time: 15:58:54 | Date: 2015/04/25
Candle: 101 | Price: 1418.67 cny | Time: 16:13:54 | Date: 2015/04/25
Candle: 102 | Price: 1418.67 cny | Time: 16:28:54 | Date: 2015/04/25

When restarted, it correctly gets the current price.

Fails to live trade

Whenever the bot attempts to trade it generates the following error.

Candle: 2524 | Price: 1527.98 cny | Time: 20:07:46 | Date: 2015/03/27
FullStochRSID: 0.0
MACD : We are in an Uptrend | Diff: -1.1946908671234269e-06
MACD Hist: 0.0002869444164193001
Exception in thread Thread-575:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\Avarice\genutils.py", line 16, in do_every
worker_func()
File "C:\Avarice\avarice.py", line 44, in RunCommon
trd.TradeFromStrategy()
File "C:\Avarice\trader.py", line 65, in TradeFromStrategy
TradeAmount = GetTradeAmount('buy', st.Trade_dict['TradeVolume'])
File "C:\Avarice\trader.py", line 20, in GetTradeAmount
((volume / 100) * el.GetFree('currency') / el.GetMarketPrice('ask')), 3)
File "C:\Avarice\exchangelayer.py", line 36, in GetFree
okwspriv.userinfo())[-1]['data']['info']['funds']['free'][gc.API.Currency]
File "C:\Avarice\okcoin\WebSocketAPI.py", line 74, in userinfo
'parameters':{ 'api_key':'" + self.api_key + "', 'sign':'" + sign + "'} }")
File "C:\Python34\lib\site-packages\websocket_core.py", line 675, in send
return self.send_frame(frame)
File "C:\Python34\lib\site-packages\websocket_core.py", line 701, in send_fra
me
l = self._send(data)
File "C:\Python34\lib\site-packages\websocket_core.py", line 912, in _send
return self.sock.send(data)
File "C:\Python34\lib\ssl.py", line 679, in send
v = self._sslobj.write(data)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host

I.E E.G

In one of the comments for the trade pair, you wrote "i.e." when it should be "e.g."

Real trade error

Unfortunately, the third version of the program (v3.2.0) is stable in simulator mode only. During the real trade I get this error:

Future/Task exception was never retrieved
future: Task(<TradeWrapper>)<exception=KeyError('data',)>
Traceback (most recent call last):
  File "/home/ubuntu/workspace/okcoin/WebSocketAPI.py", line 112, in trade
    self.ws.recv())[-1]['data']['order_id']
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 302, in _step
    result = next(coro)
  File "/home/ubuntu/workspace/trader.py", line 46, in TradeWrapper
    el.Trade(trd.LastOrder['order'], CurrPrice, TradeAmount)
  File "/home/ubuntu/workspace/exchangelayer.py", line 60, in Trade
    okwspriv.trade(order, rate, amount)
  File "/home/ubuntu/workspace/okcoin/WebSocketAPI.py", line 121, in trade
    self.ws.recv())[-1]['data']['order_id']
KeyError: 'data'

The trading is stoping after that error, though the bot thinks that transaction are ok, the terminal displays messages about buying and selling, but transactions in the okcoin do not committed.

The error does not appear immediately, usually after two or three successful transactions.

I'm getting the same errors on three different computers with OS Windows 8.1, LinuxMint and with a virtual Ubuntu workspace in the cloud (https://c9.io)

Version 2.0 of the program is stable in all modes and places.

I noticed one more bug. In my settings DiffDown set to -0.02 / 0.02, but transactions are done before that value:

EMA: We are in an Uptrend | Diff: 0.0017436253469297104
StdDev: 0.6119622860161978
BUYING 1.98 btc at 1834.46 cny

Sorry for possible mistakes in English

[BUG] Exception with advanced strategy

This occours when using different strategies

  Trade Indicators = ['MACD', 'RSI']
Exception in thread Thread-1:
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/rdash/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 133, in RCWrapper
    gu.do_every(ldb.CandleSizeSeconds, RunCommon)
  File "/home/rdash/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 107, in RunCommon
    getattr(strategies, config.gc['Trader']['Advanced Strategy'])()
  File "/home/rdash/avarice/strategies.py", line 209, in Default
    if IndList[-1] < LocalBid:
TypeError: unorderable types: float() < str()

First run

Hi,

thanks for sharing Avarice! I hope this is the correct place for my question:

I tried to run it under Ubuntu 14.04 and get this shell output:

$ python avarice.py
Traceback (most recent call last):
File "avarice.py", line 5, in
import indicators
File "/home/mike/Arbeitsfläche/ava/indicators.py", line 5, in
import loggerdb as ldb
File "/home/mike/Arbeitsfläche/ava/loggerdb.py", line 7, in
import exchangelayer
File "/home/mike/Arbeitsfläche/ava/exchangelayer.py", line 8, in
import okcoin_api
File "/home/mike/Arbeitsfläche/ava/okcoin_api.py", line 11, in
import urllib.error
ImportError: No module named error

Do you know any advice?

Thanks

databases grow indefinitely

I've noticed that there is no limit to the amount of past data kept in both the SQLite and shelve databases. Eventually an error about page size, and other shelve read/write errors are thrown - at this point I saw that the *.shelve.db file was over 2 GB. This was an extreme case with short candles so it grew pretty fast, but it's an issue for long runs regardless.

As a quick fix you could splice off the end of the list in the writelist function, i.e. temp = temp[-storageMax:]. It would be nice if it was possible to set the storageMax based on what's needed by the config.

I don't have a one-liner fix for the SQLite table, and haven't encountered problems yet, but it is important to look at since the entire market history is being loaded every interval.

As a side note, it seems every indicator is being calculated and stored, even if I'm just using one.

I hope to find time to contribute to the code in the near future, finding my way around it now.

-alanfuji

No longer being developed or maintained. Hello Rapacity

A new piece of software (going by rapacity) is currently being developed from scratch in another language (golang).

As this project matured, project goals also shifted. A new project (with a saner code base) will ultimately benefit everyone.

Advantages:

  • Ability to upload binaries when releases are tagged, allowing users on windows, osx, or linux to run the packages without any additional software or compilation.
  • Native GUI on windows, osx, or linux -- without any additional code for support between platforms.
  • More sane code base for easier development/maintenance. Additionally hammering out bugs early through better design (solid websocket connections and handling, multiprocessing in shared memory space, better db design, etc).
  • Easier exchange support and futures support. Bitfinex support has already been added alongside OKCoin.
  • Having a maintained testing package, allowing for easy functionality testing.
  • Better optimizing indicators for concurrency as they're being added back, and fixing accuracy issues in indicators such as DEMA and FRAMA.

Disadvantages:

  • It will take a bit for the project to gain all features and functionality in Avarice. The first release will be a more barebones variant of what avarice has become. It will only be a GUI with a few indicators, and basic configuration.
  • ...Writing documentation :(

AttributeError: 'module' object has no attribute 'BollBands'

Doing some more testing and have never been able to get bollinger bands to work. Here is the error I receive when attempting to run a simulation.

Database is recent enough; resuming
Waiting 12.1 minutes to resume on schedule
Connecting to Public OKCoin WebSocket...
Candle: 32 | Price: 1333.15 cny | Time: 00:32:58 | Date: 2015/02/01
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 15, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 34, in RunCommon
strategies.Generic()
File "C:\AvariceSimulation\strategies.py", line 15, in Generic
hidind = getattr(hidconfig, i)
AttributeError: 'module' object has no attribute 'BollBands'

ZeroDivisionError: float division by zero

Latest build looks to have a minor bug. Once it appears it will appear with every candle after.

[SIMULATOR] Asset: 1 btc Currency: 0 cny Net Worth: 1736.7426899999998 cny
Candle: 606 | Price: 1724.67 cny | Time: 19:37:03 | Date: 2015/03/07
MACD : We are in a Downtrend | Diff: 0.3642543770251905
MACD Hist: -0.44509306713349683
Exception in thread Thread-287:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 16, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 39, in RunCommon
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.I
dicatorList}
File "C:\AvariceSimulation\avarice.py", line 39, in
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.I
dicatorList}
File "C:\AvariceSimulation\indicators.py", line 321, in indicator
ldb.price_list, gc.FastStochK.Period))
File "C:\AvariceSimulation\indicators.py", line 71, in FastStochK
- LowestPeriod)) * 100
ZeroDivisionError: float division by zero

Candle: 607 | Price: 1724.67 cny | Time: 19:52:03 | Date: 2015/03/07
MACD : We are in a Downtrend | Diff: 0.31267790729816625
MACD Hist: -0.39733562948841683
Exception in thread Thread-289:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 16, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 39, in RunCommon
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.I
dicatorList}
File "C:\AvariceSimulation\avarice.py", line 39, in
{executor.submit(getattr(indicators, ind).indicator()): ind for ind in gc.I
dicatorList}
File "C:\AvariceSimulation\indicators.py", line 321, in indicator
ldb.price_list, gc.FastStochK.Period))
File "C:\AvariceSimulation\indicators.py", line 71, in FastStochK
- LowestPeriod)) * 100
ZeroDivisionError: float division by zero

WebSocket exception

I'm running v5.0a2 tag, indicator is MACD and 15min candles.

Candle: 37 | Price: 2844.36 cny | Time: 22:33:48 | Date: 2016/01/02
MACD : We are in a Downtrend | Diff: 2.106378135454179
MACD Hist: -1.0823483829427265
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/alarm/avarice/okcoin/WebSocketAPI.py", line 94, in userinfo
    info = self.ws.recv()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 348, in recv
    opcode, data = self.recv_data()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 365, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 378, in recv_data_frame
    frame = self.recv_frame()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 410, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 312, in recv_frame
    self.recv_header()
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 261, in recv_header
    header = self.recv_strict(2)
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 346, in recv_strict
    bytes = self.recv(min(16384, shortage))
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 479, in _recv
    return recv(self.sock, bufsize)
  File "/usr/lib/python3.5/site-packages/websocket/_socket.py", line 89, in recv
    raise WebSocketConnectionClosedException("Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 1180, in run
    self.function(*self.args, **self.kwargs)
  File "/home/alarm/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 133, in RCWrapper
    gu.do_every(ldb.CandleSizeSeconds, RunCommon)
  File "/home/alarm/avarice/genutils.py", line 16, in do_every
    worker_func()
  File "avarice.py", line 110, in RunCommon
    trd.TradeFromStrategy()
  File "/home/alarm/avarice/trader.py", line 80, in TradeFromStrategy
    TradeAmount = GetTradeAmount('sell', st.Trade_dict['TradeVolume'])
  File "/home/alarm/avarice/trader.py", line 25, in GetTradeAmount
    ta = gu.RoundIfGreaterThan((volume / 100) * el.GetFree('asset'), 3)
  File "/home/alarm/avarice/exchangelayer.py", line 44, in GetFree
    okwspriv.userinfo())[-1]['data']['info']['funds']['free'][config.gc[
  File "/home/alarm/avarice/okcoin/WebSocketAPI.py", line 101, in userinfo
    info = self.ws.recv()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 348, in recv
    opcode, data = self.recv_data()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 365, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 378, in recv_data_frame
    frame = self.recv_frame()
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 410, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 312, in recv_frame
    self.recv_header()
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 261, in recv_header
    header = self.recv_strict(2)
  File "/usr/lib/python3.5/site-packages/websocket/_abnf.py", line 346, in recv_strict
    bytes = self.recv(min(16384, shortage))
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 479, in _recv
    return recv(self.sock, bufsize)
  File "/usr/lib/python3.5/site-packages/websocket/_socket.py", line 89, in recv
    raise WebSocketConnectionClosedException("Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

false order status or messed up messages

I'm running the staging branch and found many fake order successful info, e.g.:

simulator.log:
2015-12-03 07:17:19,953 - simulator - BUYING 12.834 btc at 2338.67 cny
trader.log:
2015-12-03 07:17:19,976 - trader - BUYING 1.52 btc at 2338.67 cny
2015-12-03 07:17:24,897 - trader - Order Successful

I can't find any 1.52 btc order at okcoin's records, the trader message and log is error.

AttributeError: type object 'DMI' has no attribute 'Trader'

Trying the new implementation of ADX in simulation but am getting the following error. I will fully admit that I may not of configured it correctly in genconfig.

Database is recent enough; resuming
Waiting 12.43 minutes to resume on schedule
Connecting to Public OKCoin WebSocket...
Candle: 360 | Price: 1394.84 cny | Time: 09:17:59 | Date: 201
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstra
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 15, in do_eve
worker_func()
File "C:\AvariceSimulation\avarice.py", line 34, in RunComm
getattr(strategies, gc.Trader.AdvancedStrategy)()
File "C:\AvariceSimulation\strategies.py", line 121, in Def
genind = getattr(genconfig, i).Trader
AttributeError: type object 'DMI' has no attribute 'Trader'

Possible Input bug

I keep getting the following error:

C:\Avarice>avarice.py
Database is recent enough; resuming
[API] Connecting to Public OKCoin WebSocket...
[API] Connecting to Public OKCoin WebSocket...
Waiting 5.89 minutes to resume on schedule
[API] Connecting to Public OKCoin WebSocket...
Candle: 1483 | Price: 2276.54 cny | Time: 13:58:53 | Date: 2015/11/02
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python34\lib\shelve.py", line 111, in getitem
value = self.cache[key]
KeyError: 'MACD_Short_list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1186, in run
self.function(_self.args, *_self.kwargs)
File "C:\Avarice\genutils.py", line 16, in do_every
worker_func()
File "C:\Avarice\avarice.py", line 133, in RCWrapper
gu.do_every(ldb.CandleSizeSeconds, RunCommon)
File "C:\Avarice\genutils.py", line 16, in do_every
worker_func()
File "C:\Avarice\avarice.py", line 104, in RunCommon
RunIndicator(i)
File "C:\Avarice\avarice.py", line 87, in RunIndicator
ind.indicator()
File "C:\Avarice\indicators.py", line 317, in indicator
ldb.price_list, storage.getlist('MACD_Short_list'), ShortPeriod))
File "C:\Avarice\storage.py", line 42, in writelist
temp = db[ln]
File "C:\Python34\lib\shelve.py", line 114, in getitem
value = Unpickler(f).load()
EOFError: Ran out of input

switching between strategies

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.

Support additional strategies

Currently only the "generic" strategy is supported which requires all TradeIndicator signals to align. This can be great for matching volatility/movement strength indicators, but can otherwise suffer if you want to trade on multiple signals (e.g. 80% on MACD and 5% on StochasticRSI 98/2 ask/bid)

The current workaround is to run multiple instances of avarice, but this should not be required.

To Do:

  • Name generic strategy something more fitting
  • Document and allow strategies to be selected in genconfig
  • Add a new strategy which trades off each signal
  • Make TradeVolume indicator dependent.
  • Finish volatility indicator support
  • Remove copious amount of (many now outdated) comments from genconfig, creating a new Configuration page in documentation to replace it.

OKcoin websocket uses python2 but avarice uses asyncio which is python3

The OKCOIN websocket example included in this package uses the websocket python2 only library. However, the avarice python scripts utilize asyncio which is a python3 only library.

If I try to run any of the avarice scripts using python 3, I get an error due the websocket library being non existant for python 3.

And if I try to run the avarice scripts using python 2, I get an error because asyncio is not on python2.

How do I use this?

ValueError: math domain error

Periodically I will get this error that shows up. Once it does show, it will continue to get post with each new candle.

Candle: 808 | Price: 1488.9 cny | Time: 08:05:10 | Date: 2015/02/24
EMA : We are in a Downtrend | Diff: -0.0049897973570223846
Exception in thread Thread-621:
Traceback (most recent call last):
File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
self.run()
File "C:\Python34\lib\threading.py", line 1187, in run
self.function(_self.args, *_self.kwargs)
File "C:\AvariceSimulation\genutils.py", line 15, in do_every
worker_func()
File "C:\AvariceSimulation\avarice.py", line 37, in RunCommon
getattr(indicators, indicator).indicator()
File "C:\AvariceSimulation\indicators.py", line 255, in indicator
gc.FRAMA.ShortPeriod))
File "C:\AvariceSimulation\indicators.py", line 52, in FRAMA
* (Helpers.FractalDimension(list1, period1) - 1))
File "C:\AvariceSimulation\indicators.py", line 47, in FractalDimension
D = (math.log(N1 + N2) - math.log(N3)) / math.log(2)
ValueError: math domain error

Future/leverage trading

Hi! Thanks for the Avarice soft!
Is there a way to trade with x10 leverage and open short trades as well?

OKCoin FIX support

TODO: implement FIX API support with config exchange option of "okcoin-websocket" or "okcoin-fix."
Slated for release 2.

For v5.0a2 testing release.

The bot doesn't notice the price change (v5.0a2)

Sometimes the bot doesn't notice the price change. But any errors in this case do not occur.
Here is the log:

Candle: 513 | Price: 2900.43 cny | Time: 07:03:25 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 514 | Price: 2901.55 cny | Time: 07:04:19 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 515 | Price: 2901.0 cny | Time: 07:05:13 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 516 | Price: 2901.24 cny | Time: 07:06:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 517 | Price: 2900.65 cny | Time: 07:07:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 518 | Price: 2899.48 cny | Time: 07:07:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 519 | Price: 2899.12 cny | Time: 07:08:49 | Date: 2016/02/23
Ichimoku: Bearish
TRADER: SELLING 0.194 btc at 2899.22 cny
TRADER: Order Mostly Filled; Leftover Too Small
Candle: 520 | Price: 2899.12 cny | Time: 07:09:43 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 521 | Price: 2899.12 cny | Time: 07:10:37 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 522 | Price: 2899.12 cny | Time: 07:11:31 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 523 | Price: 2899.19 cny | Time: 07:12:25 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 524 | Price: 2899.19 cny | Time: 07:13:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 525 | Price: 2899.19 cny | Time: 07:14:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 526 | Price: 2899.19 cny | Time: 07:15:07 | Date: 2016/02/23
Ichimoku: Bearish
TRADER: Wanted to SELL 0.002 btc at 2899.48 but needed more btc
Candle: 527 | Price: 2899.19 cny | Time: 07:16:01 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 528 | Price: 2899.19 cny | Time: 07:16:55 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 529 | Price: 2899.08 cny | Time: 07:17:49 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 530 | Price: 2899.08 cny | Time: 07:18:43 | Date: 2016/02/23
Ichimoku: Bearish
Candle: 531 | Price: 2899.08 cny | Time: 07:19:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 532 | Price: 2901.37 cny | Time: 07:20:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 533 | Price: 2901.37 cny | Time: 07:21:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 534 | Price: 2901.37 cny | Time: 07:22:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 535 | Price: 2901.37 cny | Time: 07:23:13 | Date: 2016/02/23
Ichimoku: Bullish
TRADER: BUYING 0.194 btc at 2901.45 cny
TRADER: Order Mostly Filled; Leftover Too Small
Candle: 536 | Price: 2901.37 cny | Time: 07:24:07 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 537 | Price: 2901.37 cny | Time: 07:25:01 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 538 | Price: 2901.37 cny | Time: 07:25:55 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 539 | Price: 2901.37 cny | Time: 07:26:49 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 540 | Price: 2901.37 cny | Time: 07:27:43 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 541 | Price: 2901.37 cny | Time: 07:28:37 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 542 | Price: 2901.37 cny | Time: 07:29:31 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 543 | Price: 2901.37 cny | Time: 07:30:25 | Date: 2016/02/23
Ichimoku: Bullish
Candle: 544 | Price: 2901.37 cny | Time: 07:31:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 545 | Price: 2901.37 cny | Time: 07:32:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 546 | Price: 2901.37 cny | Time: 07:33:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 547 | Price: 2901.37 cny | Time: 07:34:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 553 | Price: 2901.37 cny | Time: 07:39:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 554 | Price: 2901.37 cny | Time: 07:40:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 555 | Price: 2901.37 cny | Time: 07:41:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 556 | Price: 2901.37 cny | Time: 07:42:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 557 | Price: 2901.37 cny | Time: 07:43:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 558 | Price: 2901.37 cny | Time: 07:43:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 559 | Price: 2901.37 cny | Time: 07:44:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 560 | Price: 2901.37 cny | Time: 07:45:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 561 | Price: 2901.37 cny | Time: 07:46:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 562 | Price: 2901.37 cny | Time: 07:47:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 563 | Price: 2901.37 cny | Time: 07:48:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 564 | Price: 2901.37 cny | Time: 07:49:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 565 | Price: 2901.37 cny | Time: 07:50:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 566 | Price: 2901.37 cny | Time: 07:51:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 567 | Price: 2901.37 cny | Time: 07:52:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 568 | Price: 2901.37 cny | Time: 07:52:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 569 | Price: 2901.37 cny | Time: 07:53:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 570 | Price: 2901.37 cny | Time: 07:54:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 571 | Price: 2901.37 cny | Time: 07:55:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 572 | Price: 2901.37 cny | Time: 07:56:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 573 | Price: 2901.37 cny | Time: 07:57:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 574 | Price: 2901.37 cny | Time: 07:58:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 575 | Price: 2901.37 cny | Time: 07:59:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 576 | Price: 2901.37 cny | Time: 08:00:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 577 | Price: 2901.37 cny | Time: 08:01:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 578 | Price: 2901.37 cny | Time: 08:01:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 579 | Price: 2901.37 cny | Time: 08:02:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 580 | Price: 2901.37 cny | Time: 08:03:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 581 | Price: 2901.37 cny | Time: 08:04:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 582 | Price: 2901.37 cny | Time: 08:05:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 583 | Price: 2901.37 cny | Time: 08:06:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 584 | Price: 2901.37 cny | Time: 08:07:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 585 | Price: 2901.37 cny | Time: 08:08:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 586 | Price: 2901.37 cny | Time: 08:09:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 587 | Price: 2901.37 cny | Time: 08:10:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 588 | Price: 2901.37 cny | Time: 08:10:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 589 | Price: 2901.37 cny | Time: 08:11:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 590 | Price: 2901.37 cny | Time: 08:12:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 591 | Price: 2901.37 cny | Time: 08:13:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 592 | Price: 2901.37 cny | Time: 08:14:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 593 | Price: 2901.37 cny | Time: 08:15:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 594 | Price: 2901.37 cny | Time: 08:16:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 595 | Price: 2901.37 cny | Time: 08:17:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 596 | Price: 2901.37 cny | Time: 08:18:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 597 | Price: 2901.37 cny | Time: 08:19:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 598 | Price: 2901.37 cny | Time: 08:19:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 599 | Price: 2901.37 cny | Time: 08:20:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 600 | Price: 2901.37 cny | Time: 08:21:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 601 | Price: 2901.37 cny | Time: 08:22:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 602 | Price: 2901.37 cny | Time: 08:23:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 603 | Price: 2901.37 cny | Time: 08:24:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 604 | Price: 2901.37 cny | Time: 08:25:19 | Date: 2016/02/23
Ichimoku: No trend
Candle: 605 | Price: 2901.37 cny | Time: 08:26:13 | Date: 2016/02/23
Ichimoku: No trend
Candle: 606 | Price: 2901.37 cny | Time: 08:27:07 | Date: 2016/02/23
Ichimoku: No trend
Candle: 607 | Price: 2901.37 cny | Time: 08:28:01 | Date: 2016/02/23
Ichimoku: No trend
Candle: 608 | Price: 2901.37 cny | Time: 08:28:55 | Date: 2016/02/23
Ichimoku: No trend
Candle: 609 | Price: 2901.37 cny | Time: 08:29:49 | Date: 2016/02/23
Ichimoku: No trend
Candle: 610 | Price: 2901.37 cny | Time: 08:30:43 | Date: 2016/02/23
Ichimoku: No trend
Candle: 611 | Price: 2901.37 cny | Time: 08:31:37 | Date: 2016/02/23
Ichimoku: No trend
Candle: 612 | Price: 2901.37 cny | Time: 08:32:31 | Date: 2016/02/23
Ichimoku: No trend
Candle: 613 | Price: 2901.37 cny | Time: 08:33:25 | Date: 2016/02/23
Ichimoku: No trend
Candle: 614 | Price: 2901.37 cny | Time: 08:34:19 | Date: 2016/02/23

Request

Would it be possible to add in arbitrage for that extremely RARE occasion when there is profit to be made using LTC, BTC, and Yuan?

ltc not supported

Litecoin is currently not supported. It throws an error if you try to run avarice.py

WebUI

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."

  • Move genconfig.py over to configparser for easily storing/reading configuration. This seems like a better solution than using a db while still maintaining the ability to manually edit/run avarice with a similar format.
  • Finish configuration page
  • Write dashboard
  • Write graph page

Major Rewrite in Progress

I've decided to change the direction of Avarice a bit after being rather aimless with this project for quite some time.

After getting new threaded/locking API code half done, I decided to redo most of Avarice to be fully threaded. I'm also working on a gtk3 gui and a layer between gui, threads, config files, and logging to support new native gui easier. This will additionally allow multiple indicator instances to run side by side if used in a "preset" (described below).

Next I'll be redoing configobj support in the layer to support reading config presets. Any new indicator level configuration (combined configuration for trading) will be written to a preset in this path. At launch, you may select which created presets you which to run, and they'll be run separately.

I'm starting with the gtk3 gui (using pygobject) so I can see the progress imediately and be better motivated on the project.

To reiterate and summarize:

  • basic (disconnected) gtk3 gui for motivation
  • thread all the things
  • add layer between GUI, threads, config files, and logging, to make support for new platform-specific gui support easier.
  • rewrite configobj support in the new layer to handle indicator presets.
  • Add actual functionality to gtk3 gui with new layer.
  • Pythonwin (still undecided) and PyObjc windows/cocoa (osx) gui.

(after some release at this point):

  • Batch trade configurables with similar preset support as indicators.

I still believe that with a decent interface, there are many traders who want something easy to configure with trade strategy presets, but don't want to give their API keys to a web trading platform.

[Issue?] XMPP Dependacies

When installing the dependencies for XMPP I get the following:

Could not find a version that satisfies the requirement xmpppy (from xmpp-logging-handler->-r requirements.txt (line 5)) (from versions: 0.5.0rc1)
Cleaning up...
No distributions matching the version for xmpppy (from xmpp-logging-handler->-r requirements.txt (line 5))
Storing debug log for failure in /home/rdash/.pip/pip.log

Debug log:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 322, in find_requirement
    raise DistributionNotFound('No distributions matching the version for %s' % req)
pip.exceptions.DistributionNotFound: No distributions matching the version for xmpppy (from xmpp-logging-handler->-r requirements.txt (line 5))

Task exception was never retrieved

I've had this happen a couple of times after upgrading and started using the websockets version of avarice instead of the api version.

Here is the error I receive:

Task exception was never retrieved
future: <Task finished coro=<RunCommon() done, defined at C:\Avarice\avarice.py:
23> exception=TypeError("Can't convert 'int' object to str implicitly",)>
Traceback (most recent call last):
File "C:\Python34\lib\asyncio\tasks.py", line 236, in _step
result = next(coro)
File "C:\Avarice\avarice.py", line 51, in RunCommon
trd.TradeFromStrategy()
File "C:\Avarice\trader.py", line 77, in TradeFromStrategy
TradeAmount = GetTradeAmount('sell')
File "C:\Avarice\trader.py", line 19, in GetTradeAmount
ta = gu.RoundIfGreaterThan(el.GetTradeAmount('asset'), 3)
File "C:\Avarice\exchangelayer.py", line 55, in GetTradeAmount
Amount = (gc.Trader.TradeVolume / 100) * GetFree('asset')
File "C:\Avarice\exchangelayer.py", line 39, in GetFree
okwspriv.userinfo())[-1]['data']['info']['funds']['free'][gc.API.Asset]
File "C:\Avarice\okcoin\WebSocketAPI.py", line 69, in userinfo
'parameters':{ 'api_key':'" + self.api_key + "', 'sign':'" + sign + "'} }")
TypeError: Can't convert 'int' object to str implicitly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.