Pages:
Author

Topic: Isis ATP [Automated Trading Platform] - Discussion - page 16. (Read 45225 times)

sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
More updates at https://github.com/aido/IsisATP/commits/master:

commit ee4bf173b02d75048b966aece7fc0007508bc371

    Added --use-trend=true/false commandline parameter (default true)


This enables/disables trend following trades as discussed in previous posts.


commit 978b03b29aaf5e7b3e1701a29c7067892607de84

    Moved Trading Agent start() from TrendObserver class to Application class


This was done to make above commit possible and really stretched my nascent java coding ability.


commit eed78364569b2715fe7bc7ed773b66dcd9795a73

    Added more generic way of getting exchange hostname and port for dropped connection test


Tidied up a previous fix. Still not 100% happy though.



Commits are in reverse chronological order because that's how git log command prints them!
legendary
Activity: 965
Merit: 1000
Hi!

You code is only stored local, you haven't used github or anything like that?

As you stated, 100 plus classes would take me a long time to understand. And as a java novice I may not ever understand it. I think I'll concentrate on understanding how IsisATP does its thing first before biting off more than I can chew.

Since I'm the only developer, I don't use svn or git yet. Just drop me a PM, if you want to check the sources, and I'll upload it on one of my servers and give you temporary URL to download it.
But, as I said, it's quite rough yet and work in progress. I'm still struggling with some method to get the automatic trading going, so I guess I'm behind the Isis-project.

Ciao,
Andreas
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
--use-trend it will be.

Now, to code it.................
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
No worries daybyter.

I think another correct term is "trend following". Well, that's what wikipedia calls it anyway.

You code is only stored local, you haven't used github or anything like that?

As you stated, 100 plus classes would take me a long time to understand. And as a java novice I may not ever understand it. I think I'll concentrate on understanding how IsisATP does its thing first before biting off more than I can chew.
legendary
Activity: 965
Merit: 1000
I was told, that it's 'technical trading'. But I don't speak english, so I just accepted the term.

Btw: sorry for my late reply on your query for my sources, but I just overlooked that line in your response. Sad  Or did you edit it? As I said: I can give you the sources, but it's > 100 classes and with the required jars an 8.8 MB zip file. And it's far from being complete. I'm still working on the trading interface and only the gox and btc-e implementation are halfway complete.
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
I'm going to tidy up the switches giving options to disable arbitrage, disable 'normal' trading or run in simulation mode for both.

We already have --simulation-mode and --use-arbitrage. Simulation mode does not affect arbitrage at the moment. What switch name would people suggest for non-arbitrage trading trades? --use-normal-trades is a bit long and I don't like --use-normal i.e. what's normal? I am just looking for a simple but descriptive term to differentiate arbitrage trading from the other type.

Once I have the swtches working I'll look at putting them into the config file.
legendary
Activity: 965
Merit: 1000
Care to share?

I can show you my sources, but I guess it'll take you too much time to study them?
sr. member
Activity: 350
Merit: 250
Thanks Aido!
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
New commit on github:

commit 790351ae9d849c9fee4f11dff25d602efbade343

    A possibly better fix for ArrayIndexOutOfBoundsException in getLastTick method of TickerManager that will not cause NullPointerException's later in code.


A few other cosmetic changes in there also.

Linux/UNIX/Mac OS users now get fancy coloured log output, INFO, WARN and ERROR etc.  Windows users........sigh! Roll Eyes


good grief, how much precision do we need? Wink

The latest version keeps the precison in calculations but no longer prints out the unnecessarily long string of digits to the log, rounding output to eight decimal places instead.


I use log4j in my app. It should fill your requirements.

I changed IsisATP to use logback (http://logback.qos.ch/). According to the logback website:

Quote
Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off.

XChange also uses logback so the class files were already included in the original IsisATP jar file.

I'm impressed by the power of logback. If a user doesn't like the format or how IsisATP logs its output they can use their own logback config file to decide how and where log output is presented. Want your logs mailed to you? Easy....just add an e-mail appender to your logback config. And, all without changing a single line of code.



Some of the calculations used in the arbitrage engine need to be looked at. For example, I just don't believe the following output:

    Arbitrage Engine has detected an after fee profit opportunity of 58.43022025% on currency pair USD/GBP

Anyone care to try and get their head around the calculations and advise?

legendary
Activity: 965
Merit: 1000
That's good and necessary....

I use factor 100000000 for the price and the amount. However, if you start calculating with those amount and do (amount * price) / 100000000 you have a problem with longs. I use an ugly hack and cast temporarily to double, but I guess I'll use some BigDecimal-like format in the future. Just a lot of places, where I have to modify my code... Sad
sr. member
Activity: 350
Merit: 250
good grief, how much precision do we need? Wink

Quote
Nov 13, 2012 11:58:46 AM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: 0.0000009982608695652174034262937851735841832123696804046630859375 was less than the configured limit of 0.01
There just isn't enough momentum to trade at this time.
legendary
Activity: 965
Merit: 1000
I use log4j in my app. It should fill your requirements.
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
A couple more commits:

commit 6d95bf71f75a7fb251102fd2083804d397bab4ee

    Improved exception handling for disconnection from exchange


When a com.xeiam.xchange.HttpException is thrown we now create a test socket to the exchange. If this test socket fails to connect we wait one minute before trying again. At the moment the test socket is as follows:

    testSock = new Socket("www.mtgox.com",80);

mtgox.com port 80 is hardcoded. I couldn't figure out how to dynamically get the host and port from ExchangeSpecification. Any suggestions on how to do this?


commit 46ea53d031019356d0815069d82a533d22fc7463

    Fix for ArrayIndexOutOfBoundsException in getLastTick method of Ticker Manager


This fix is a bit of a hack. I'm sure it will result if some NullPointerException's further down the line.


Also, when testing it may be a good idea to redirect STDERR to a file so error messages can be analysed later:

    java -jar aido.jar --simulation-mode=false 2>> aido.error


I think this thread may have gone off topic a bit and become more of a crash course in java. Apologies.

sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
Well, your exception already tells you the problem...your index is -1 , so the size() seems to be 0. The array is empty...

Nice one!

thanks daybyter.

btw: this thread gave me the great idea to use a special class for amounts and prices. Thank you!

Care to share?
legendary
Activity: 965
Merit: 1000
Well, your exception already tells you the problem...your index is -1 , so the size() seems to be 0. The array is empty...

btw: this thread gave me the great idea to use a special class for amounts and prices. Thank you!
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
I see the following rare exception occur in the ticker manager:

Code:
Exception in thread "Thread-8" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at org.open.payment.alliance.isis.atp.TickerManager.getLastTick(TickerManager.java:160)
at org.open.payment.alliance.isis.atp.AccountManager.getLastTick(AccountManager.java:155)
at org.open.payment.alliance.isis.atp.ArbitrageEngine.executeTrade(ArbitrageEngine.java:135)
at org.open.payment.alliance.isis.atp.ArbitrageEngine.run(ArbitrageEngine.java:86)
at java.lang.Thread.run(Thread.java:722)


The problematic code is as follows:

Code:
ATPTicker tick;
synchronized(tickerCache) {
tick = tickerCache.get(tickerCache.size()-1);
}

I don't understand why it is throwing an ArrayIndexOutOfBoundsException when the code checks the size of the array with tickerCache.size()-1

any ideas?
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
A few more commits to play with and test (https://github.com/aido/IsisATP/commits/master):

commit 81057758348b0f35c8c1803086c13aec676c1b04

    Tweak highFactor and lowFactor values in arbitrage engine

commit 6e95342753e71029215d773ab42c9f5a40232456

    Moved build_IsisATP.sh to make.sh and updated

commit 42018488c33d7c00ca6c5e3f6755b2fc8e2e4b99

    Attempted fix for ConcurrentModificationException error in arbitrage engine

commit bc90d5cf77d884aee452a3e85f6834145048eec3

    Fixed BigDecimal.ONE.divide problem in arbitrage engine which was stopping market orders

commit d2474d5d8dbd1be153aa8acf74517d3b543991cc

    Fixed BigMoney parsing in trading agent which was causing NullPointerException



I think I fixed the ConcurrentModificationException error. It will need more testing to confirm.
I left the latest commit run for a few hours and didn't receive any errors. Please test and report back if it re-occurs.

I have now hopefully ironed out most of the bugs introduced with the previous bunch of commits.

sr. member
Activity: 350
Merit: 250
Your machine doesn't have a registry but it does have ~/.java/.userPrefs/org/open/payment/alliance/isis/atp/prefs.xml
Wink

Hey, that looks suspiciously like the key in the registry... Wink
[HKEY_CURRENT_USER\Software\JavaSoft\Prefs\org\open\payment\alliance\isis\atp]

Thanks, I didn't know how that translated.
legendary
Activity: 1372
Merit: 1002
Your machine doesn't have a registry but it does have ~/.java/.userPrefs/org/open/payment/alliance/isis/atp/prefs.xml
Wink
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
The NullPointerException problem was introduced when I changed the trading agent to use BigMoney instead of BigDecimal for currency amounts.

I am currently debugging it and hope to have a fix soon. I've added some debug messages and it seems that some values are null because the trading agent isn't parsing the config file values into BigMoney correctly.

daybyter is correct about the ConcurrentModificationException problem and it's also on my todo list. This isn't as frequent as the NullPointerException which is stopping trades.

The past few commits have introduced a bump in the road but I'll get over it with the next commit. I think I may have been introducing too many changes lately without testing them as thoroughly as I should have.

Can we disable the trend engine and leave only the arbitrage one working?
Or passing it --simulation-mode=true will put the arbitrage engine also in simulation mode?

--simulation-mode and --debug-live don's affect arbitration trades. In fact, if the arbitration engine decides to perform an arbitration trade it temporarily disables the other trades.

I have been thinking about sorting out these switches but for now the way you suggest should work.

Instead of having parameters that are set at command line for the trading, arbitrage, and simulation settings, could we handle them in the registry so we only have 1 place to manage settings? It might also be nice to be able to turn different modes on/off during a longer run by updating the registry without relaunching the program.

I don't think my Linux machine has a registry Smiley.  At the moment it's convenient for me to have the switches on the command line while I test them. But I may reconsider in the future when I tidy up how they work. Also, if not supplied in command line, both --simulation-mode and --use-arbitration default to true.
Pages:
Jump to: