Bitcoin Forum
November 10, 2024, 05:27:08 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 »
  Print  
Author Topic: Isis ATP [Automated Trading Platform] - Discussion  (Read 45225 times)
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 02:31:55 AM
 #41

Thanks. 

How do I take this out of stimulation mode.  (it's currently building a market profile)



Start it with the --debug-live=true flag appended. Restart it if it's not set now.
If you built it, you can change the learn time to oneminute, or add your own constant.

My next commit will cause it to save the market profile periodically and load that profile at startup.
As long as the newest tick is less than 10 minutes old it will use that profile instead of trying to build a new one.

I don't recommend changing the constants.  There are lots of places that use them, and will be using them in the future, but you are free to modify the learnTime to 0.
Just remember the application really needs about an hour of market data to start making wise decisions and 10 minutes is about the least amount of current market data for it not to do crazy stuff like selling all your bitcoins at startup Wink

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 03:01:07 AM
 #42

is it possible to show the current Balance in BTC and USD right after the P/L info ?

Code:
High: Ticker [timestamp=2012-09-17T02:25:37.637Z, last=USD 11.95, bid=USD 11.84597, ask=USD 11.94999, tradableIdentifier=BTC, volume=2410703771458]
Low: Ticker [timestamp=2012-09-17T01:45:06.213Z, last=USD 11.841, bid=USD 11.841, ask=USD 11.85, tradableIdentifier=BTC, volume=2429478613418]
Current: Ticker [timestamp=2012-09-17T02:43:40.584Z, last=USD 11.86, bid=USD 11.86, ask=USD 11.947, tradableIdentifier=BTC, volume=2423495794991]
VWAP: 11.84343
The market is trending up.


Sep 17, 2012 2:44:21 AM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: Attempting to sell 0.00 of 0.51 BTC available
Sep 17, 2012 2:44:21 AM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: 0.00 was less than the configured limit of 0.01
Increasing order size to 0.01
Sep 17, 2012 2:44:22 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Successfully sold 0.01 at current market price.
Sep 17, 2012 2:44:22 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC -0.09 %120.0
Sep 17, 2012 2:44:22 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD 1.06091 %90.73600

Good Idea, I'll get that added while I'm in here.

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
RicRock
Sr. Member
****
Offline Offline

Activity: 290
Merit: 250



View Profile
September 17, 2012, 03:08:01 AM
 #43

Working great on my Mac.

I had 0 USD in my account (waiting on the 30 day dwolla thing) and just .12 BTC.

I'm confused by the PL lines

Sep 16, 2012 11:04:48 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC -0.20819411 %2193.00472300
Sep 16, 2012 11:04:48 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD 2.95137 %0

I'm assuming they are incredibly screwed since I had 0 USD to start with.


isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 03:20:56 AM
 #44

The first day it gained 350% (It managed to turn 1 BTC into 3.5 so don't take it to mean anything much.)

was this on option 1 high risk or option 2 conservative ?

High Risk was the only algorithm at that time.  Remember this was the day there was a big dip that started the long climb we're on now.

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
BCB
CTG
VIP
Legendary
*
Offline Offline

Activity: 1078
Merit: 1002


BCJ


View Profile
September 17, 2012, 04:05:13 AM
 #45

is isis calculating its own vwap? 

the vwap isis is reporting is not consistent with the actual mt.gox vwap.
BCB
CTG
VIP
Legendary
*
Offline Offline

Activity: 1078
Merit: 1002


BCJ


View Profile
September 17, 2012, 04:12:01 AM
 #46

where is that in the code?
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 04:18:06 AM
 #47

Remember this was the day there was a big dip that started the long climb we're on now.
This is not able to make any profit if the market trends one direction only. When the market is volatile, it reads trends and takes what advantage is available.

Market trending down = sell
Market trending up = buy

The net result is selling before a low, and buying before a high.

Close but backwards.

Market Trending Down = Look at buying
Market Trending Up = Look at selling

Once it's decided the trend is up (ask) or down (bid) it then compares the last transaction to the vwap.

The ratio of last vs vwap is used as a waterline to make the final determination that we will take an action.

If trend = down & last < vwap then buy
If trend = up & last > vwap then sell

Once we have decided to buy or sell, then we look at the ask, bid and trend arrows.
This gives us an indication of how much momentum is in the current trend and is used to calculate a weight.

current balance (BTC or USD depending on Bid or Ask) * weight = how much we will be trading with.


For instance, if we have 100 ticks in our ticker...
If of those ticks 60 were up and 40 were down, the trendarrow will be +20, the market is now trending up.
During that same time there were 75 instances where the bidArrow went up and 25 where it went down, the bidArrow is now+50
The last trade was 10.25, the vwap is 10.20.
Now is a good time to sell because there is enormous pressure in the market to buy.

So how much do we sell?
Let's assume we have 100 BTC.
trendArrow / ticker.size = 20/100 = 0.2
bidArrow / ticker.size = 0.5

(0.2 * 0.5) =  10% of our 100 BTC balance.
100BTC * 0.1 = 10BTC

So now we sell 10 BTC at market price for 102.5 local currency

Now an hour later the market has taken a dip.
We have 100 ticks in our ticker.
60 were down, 40 were up the trendArrow is now -20
There were 75 instances where the askArrow went down and 25 where it went up.  The askArrow is now -50
The last trade was 10.20, the current vwap is 10.25

Our local currency balance is 102.5
(0.2 * 0.5) = 10% of our 102.5 local currency balance
102.5 * 0.1 = 10.25
We now buy 1.025 BTC for 10.25, this gives us a profit of 0.025BTC

Now imagine that each of these trends continue on average for about 30 minutes before reversing and during that time we place 10 trades essentially identical (since these conditions are really only present for about 10 minutes out of each 30 minute trend), this is a profit of 0.25BTC during that 30 minute period or .5BTC per hour.
24 * 0.5 BTC = 12 BTC or 12% profit in a day.

Hope that helps!

BTW new commit coming very soon, just trying to figure out how to cache the market profile to disk so I only have a single large commit today.



Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
BCB
CTG
VIP
Legendary
*
Offline Offline

Activity: 1078
Merit: 1002


BCJ


View Profile
September 17, 2012, 04:27:35 AM
 #48

is this calculating for the gox fee.
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 05:05:34 AM
 #49

is this calculating for the gox fee.

No, and yes.

The PL reflects the fee automatically since it pulls the current balance directly from mtgox.
However there is no way of obtaining the fee itself as far as I can see and there really isn't a place in the algorithm to place it since the algorithm is based on market pressure and all trades are market orders.

I will however be adding a fee calculation into the arbitrage engine I've started to build because the profitability of an arbitrage trade could be adversely impacted by that fee.  An arbitrage trade by definition carries a penalty of (fee*2).


Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 05:12:12 AM
 #50

where is that in the code?

Yes it is, it's in the trend observer.
The vwap is available from MtGox, but the API we're using (xchange) does not report it, thus we have to calculate it ourself.

I'm considering modifying xchange's Ticker object to reflect this and seeing if I can get the maintainer to accept it upstream. 
That way I don't have to build and package my own jars etc.

I have to admit, this thing was a bit more profitable when we had the vwap from MtGox instead of the Roll Your Own version I had to hack together.

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
Ignatius
Sr. Member
****
Offline Offline

Activity: 409
Merit: 250


View Profile
September 17, 2012, 06:24:27 AM
 #51

Thank you for sharing your work with us isis. Please keep it coming, I would also be interested in the arbitrage version (as would most here, I'd imagine).

My thanks to nomorecoin, who's tips above helped me get eclipse going and have allowed me to tinker with this budding project.

Last but not least thanks to RicRock for bringing this project to my attention over in IRC.

Has this vwa strategy been backtested against historical data? If so, please post the results.
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 07:01:47 AM
 #52

Thank you for sharing your work with us isis. Please keep it coming, I would also be interested in the arbitrage version (as would most here, I'd imagine).

My thanks to nomorecoin, who's tips above helped me get eclipse going and have allowed me to tinker with this budding project.

Last but not least thanks to RicRock for bringing this project to my attention over in IRC.

Has this vwa strategy been backtested against historical data? If so, please post the results.

You're welcome.  And this strategy is itself the result of backtesting against historical.

As I mentioned in the original thread, I used all the historical data I could get my hands on (about 3 years worth) and ran it on a map reduce cluster with various algorithms that I remembered from my finance classes at school.

What emerged was this hybrid which showed the strongest and most consistent performance.  It worked about 30% better than just holding onto bitcoins and trading at random times during the day but making sure to trade each day, (dollar cost averaging).

For the record I also ran the same algorithm against historical NYSE data and it didn't do well at all.


Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 07:04:22 AM
 #53

Thank you for your patience.
A new commit is in with a new jar file.
I still haven't fixed the license file issue, but the rest of the bugs are all taken care of ( i think).
Algorithm selection now appears to actually be working.

You still need to start with --debug-live=true if you want to leave simulation mode.

Startup "learning time" has been reduced from 1 hour to 10 minutes.
MarketData caching is enabled, as long as your application restart occurs within 10 minutes it will reuse the cache data.

Enjoy!

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 07:08:30 AM
 #54

After 15 minutes of runtime on the new codebase...
Code:

Sep 17, 2012 1:06:53 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Successfully bought 0.01 at current market price.
Sep 17, 2012 1:06:53 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC 0.04000000 %20.58895000
Sep 17, 2012 1:06:53 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD -0.47568 %-0.87500
Sep 17, 2012 1:06:53 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: AccountInfo [username=isis, wallets=[Wallet [balance= BTC 0.23427897], Wallet [balance= USD 53.91089], Wallet [balance= EUR 0.09964], Wallet [balance= GBP 0.07921], Wallet [balance= AUD 0.22792], Wallet [balance= CAD 0.21845], Wallet [balance= CHF 0.10945], Wallet [balance= JPY 9.773], Wallet [balance= CNY 0.72304], Wallet [balance= DKK 0.7253], Wallet [balance= HKD 9.80315], Wallet [balance= NZD 0.15005], Wallet [balance= PLN 0.36728], Wallet [balance= RUB 3.59428], Wallet [balance= SEK 0.757], Wallet [balance= THB 3.90461]]]

Looks like it's working Wink

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
Ignatius
Sr. Member
****
Offline Offline

Activity: 409
Merit: 250


View Profile
September 17, 2012, 08:11:49 AM
 #55

You're welcome.  And this strategy is itself the result of backtesting against historical.

As I mentioned in the original thread, I used all the historical data I could get my hands on (about 3 years worth) and ran it on a map reduce cluster with various algorithms that I remembered from my finance classes at school.

What emerged was this hybrid which showed the strongest and most consistent performance.  It worked about 30% better than just holding onto bitcoins and trading at random times during the day but making sure to trade each day, (dollar cost averaging).

For the record I also ran the same algorithm against historical NYSE data and it didn't do well at all.

Did you write a paper about this process? Are charts or any results available to peruse? I read the original thread but have not come across hard numbers.

Looks like I need to go merge some new changes. I will try to keep a "stock" version running and pass along the results.

Thanks again
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 08:48:11 AM
 #56

You're welcome.  And this strategy is itself the result of backtesting against historical.

As I mentioned in the original thread, I used all the historical data I could get my hands on (about 3 years worth) and ran it on a map reduce cluster with various algorithms that I remembered from my finance classes at school.

What emerged was this hybrid which showed the strongest and most consistent performance.  It worked about 30% better than just holding onto bitcoins and trading at random times during the day but making sure to trade each day, (dollar cost averaging).

For the record I also ran the same algorithm against historical NYSE data and it didn't do well at all.

Did you write a paper about this process? Are charts or any results available to peruse? I read the original thread but have not come across hard numbers.

Looks like I need to go merge some new changes. I will try to keep a "stock" version running and pass along the results.

Thanks again

This originated as just a test case for the exchange connector for openpay.
Once I realized that to properly test the exchange connector I would essentially need to write a trading bot I went algorithm seeking.

On a lark I decided to use map reduce on a hadoop cluster to analyze the market data and its performance against a small handful of algorithms.

My top 2 were the ones I blended into this one.

I coded it, ran it for a couple of days and realized I didn't have sufficient funds to properly test it out.
That's when I created the original thread.

No I don't have hard numbers.  I could barely afford the cost to run the algorithm selection program on elastic map reduce.  You're more than welcome to run the app as much as you want, but understand tha the risk is yours.  That was sort of the point of making it open source and asking folks to test it and give me some hard numbers.

I hope you enjoy it

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
BCB
CTG
VIP
Legendary
*
Offline Offline

Activity: 1078
Merit: 1002


BCJ


View Profile
September 17, 2012, 01:36:56 PM
 #57

What information do you want reported?
This has been running for about 12 hours.


Code:
Sep 17, 2012 1:38:06 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC  %188.62453300
Sep 17, 2012 1:38:06 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD %73.89400


downloading new jar today.
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 02:05:43 PM
 #58

What information do you want reported?

After each trade it shows a profit & loss.
I'm looking for a daily PL after about 24 hrs of run time.

For instance after 6hrs of run time (which was the last time I had any bitcoins)...

Code:
Sep 17, 2012 6:29:52 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Successfully sold 0.01 at current market price.
Sep 17, 2012 6:29:52 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC -0.25585187 %-96.81128600
Sep 17, 2012 6:29:52 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD 4.16889 %7.78400
Sep 17, 2012 6:29:52 AM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: AccountInfo [username=isis, wallets=[Wallet [balance= BTC 0.0084271], Wallet [balance= USD 57.72266], Wallet [balance= EUR 0.09964], Wallet [balance= GBP 0.07921], Wallet [balance= AUD 0.22792], Wallet [balance= CAD 0.21845], Wallet [balance= CHF 0.10945], Wallet [balance= JPY 9.773], Wallet [balance= CNY 0.72304], Wallet [balance= DKK 0.7253], Wallet [balance= HKD 9.80315], Wallet [balance= NZD 0.15005], Wallet [balance= PLN 0.36728], Wallet [balance= RUB 3.59428], Wallet [balance= SEK 0.757], Wallet [balance= THB 3.90461]]]

Now of course the reason why it shows me as down 97% on the BTC side is that there is a run up and it sold all my bitcoins and I'm still waiting for a market correction (or to implement arbitrage so I can buy some BTC at a lower cost).  

My new USD balance is $57.72 and is up %7.78 from 6 hours ago.  If I were to convert my entire balance to BTC at the current market rate of $11.90  I would have 4.85 BTC.

Of course to compare that to my original figures, I could draw down my USD to just the original investment amount of ~$20.  
Which would give me
57 - 20 = 37
37 / 11.90 =  3.102 BTC = 310% profit since the first iteration of the software executed it's first trade on Sept 10th.

310 / 7 =  44%/day = Not too shabby.  Obviously that's not sustainable and was at least in part due to the low figures involved, a market hiccup and a subsequent run up in price.  Still it's not bad.

Oh one more tip...  If you post the entire PL including wallet balances make sure to remove the username field from it, otherwise you'll end up posting your MtGox username to a public forum, which is a HUGE security risk.

Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
zaj
Member
**
Offline Offline

Activity: 103
Merit: 10



View Profile
September 17, 2012, 02:58:13 PM
 #59

for me it has been selling 0.01 coins for the 10 hours all time, that is normal behaviour i hope? :p
isis (OP)
Full Member
***
Offline Offline

Activity: 154
Merit: 102


View Profile
September 17, 2012, 03:06:41 PM
 #60

for me it has been selling 0.01 coins for the 10 hours all time, that is normal behaviour i hope? :p

If you're running the latest version which was uploaded a few hours ago and its still doing that you may need to restart with --clear-config=true since there are some new options.
Make sure maxbtc is a reasonable level.  If you have it set to 0.01 its going to trade a single bitcent ad nauseum forever.

If it is still doing it, check your btc balance and make sure you actually have some.
In the current market as of this moment, anything less than 10btc and it will be trading at the minimum.  The current trend has been treading water for about the last 8 hours, in my case more sells than buys.  But then again I didn't start with much to begin with.


Interested in OpenPay?
https://github.com/openpay
Donate to show your appreciation and support the effort!

1LMDCSAwjhT2Vp1sSf62dybEYW3MYpsoZj

Pyramining Links - Help OpenPay and get a 10% bonus on your funds.
http://pyramining.com/referral/zre9ysgqt
http://pyramining.com/referral/ans9km72g
http://pyramining.com/referral/f3k4xebzp
http://pyramining.com/referral/nc3ag2sdb
Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!