Not a newbie anymore, so finally I can stop spamming Aido's inbox
Thank you for picking up my idea of having a maximum risk option
Did you consider my other suggestion of having an option to trade using only the wallet configured as LocalCurrency? If you were to integrate that, too, I could stop maintaining my own private version and it might come in handy for others, too...the code I sent you earlier via PM should be ok to commit.
This would still leave this error, which only happens when using more than one currency to trade with (after I put the UseLocalOnly option in my private version, it was gone):
2013-05-07 04:46:18,759 : ERROR: Caught unexpected exception, shutting down MtGox trend following trading agent now!. Details are listed below.
si.mazi.rescu.HttpException: Status code 403; first body line: {"result":"error","error":"Identification required to access private API","token":"login_error_invalid_nonce"}
at si.mazi.rescu.HttpTemplate.checkHttpStatusCode(HttpTemplate.java:217)
at si.mazi.rescu.HttpTemplate.executeRequest(HttpTemplate.java:182)
at si.mazi.rescu.HttpTemplate.executeRequest(HttpTemplate.java:93)
at si.mazi.rescu.RestInvocationHandler.invokeHttp(RestInvocationHandler.java:59)
at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:54)
at com.sun.proxy.$Proxy6.placeOrder(Unknown Source)
at com.xeiam.xchange.mtgox.v1.service.trade.polling.MtGoxPollingTradeService.place MarketOrder(MtGoxPollingTradeService.java:80)
at org.aido.atp.TrendTradingAgent.marketOrder(TrendTradingAgent.java:554)
at org.aido.atp.TrendTradingAgent.evalAsk(TrendTradingAgent.java:432)
at org.aido.atp.TrendTradingAgent.run(TrendTradingAgent.java:344)
at java.lang.Thread.run(Unknown Source)
I had this happen frequently using two wallets (one USD, one EUR) at MtGox, only using USD it was gone.
As I already wrote in PM, spawning several non-synced trading threads (one for each currency) might be the root cause of the problem (nonce not being properly handled/incremented). Still wondering, whether it can be handled somehow with XChange (the lib) or at the bot's level without completely rewriting the code (one trading instance per exchange (MtGox etc.) or some syncing of threads etc.)
Since I personally only use one currency to trade with at MtGox (which atm still needs my suggested UseLocalOnly option, see above, if you have any other wallets in your MtGox account) and I didn't dive deep enough into the bot's and/or XChange's code, I'll leave that to someone else to figure out though
In any case, having the UseLocalOnly option should be quite useful for anyone who does not want to spread his money among several currencies...