Pages:
Author

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

full member
Activity: 154
Merit: 102
Fell free to do a pull and have a look at the new code.
Only have USD/BTC wallet set up, sold a bit of BTC so far, based on trend. Thanks for the info.

Yeah in the case of someone with only 1 wallet setup, the commit only effects the askArrow and gives you a new --debug-live=false option which will force it INTO simulation mode at runtime.

If you have multiple wallets it will just run the same algorithm (in different threads) on all of them.  There is nothing to configure, just add a wallet at MtGox and restart the application.  It will start trading the new currency in about 10 minutes.

I've also discovered, that MtGox may get a little slow to fill the orders, or at least update balances.  I checked my balance 10 seconds after I shut the bot down and had no bitcoins, but 15 minutes later I had 0.84 BTC (and a whole lot of CAD & RUB as well).

If I were to sweep everything to BTC at this moment I would have 6.1 BTC so most of my initial loss was just orders caught up in the system.  In otherwords MtGox balances may be delayed.

FYI you will get a massive performance increase on this app the more cores you have.  Each Ticker runs it's own thread, each observer is in it's own thread.  I'll probably add a thread pool to manage the super short lived agents since the current design is death by a thousand paper cuts. (thread creation overhead is too much on these shorter lived ones).
full member
Activity: 154
Merit: 102
Can you clarify the risks in the latest commit? Still bugs, or have you sorted more of it?

Latest commit has fixed the askArrow and is playing the same algorithm across all currencies that you have a wallet for at MtGox.
It's still using market orders, therefore if you have a market with little to no liquidity but a large order book it may fill for a different price than the engine anticipated.  This could effect profits.

In my case it shotgunned all my  6 of my BTC across all 16 different currencies since they're all evidently going up at this time.

I did a calculation by hand of my balances and I'm down .5 BTC if I swept everything back to BTC, so it's not too bad.

If someone had a really significant BTC balance (as in greater than 100 BTC) they would probably be making some serious cash right now.  As it is there isn't enough momentum in any of the markets as they trend down to allow the algorithm to buy back any of the BTC and my holdings are too low to cover the weighted bid, thus it's missing out of a lot of smallish bargains.

Now that I have holdings in all 16 currencies I'm going to finish fully implementing arbitrage and have it seek for the cheapest place to buy and most profitable place to sell.

My last commit was code only, I didn't commit a binary because I wasn't confident of the performance.

Fell free to do a pull and have a look at the new code.
full member
Activity: 154
Merit: 102
Thought yall might enjoy my latest email from MtGox

Quote
Ask(s) (Sell)

        Order Filled at: Wed 19 Sep 2012 03:32:35 AM GMT
        Amount: 0.25642442 BTC
        Price: @CA$11.79538
        Total: CA$3.02462

        Order Filled at: Wed 19 Sep 2012 03:32:35 AM GMT
        Amount: 0.25642442 BTC
        Price: @฿373.45556
        Total: ฿95.76313

        Order Filled at: Wed 19 Sep 2012 03:32:36 AM GMT
        Amount: 0.12067032 BTC
        Price: @9.42501 €
        Total: 1.13732 €

        Order Filled at: Wed 19 Sep 2012 03:33:35 AM GMT
        Amount: 0.09804463 BTC
        Price: @CA$11.79538
        Total: CA$1.15647

        Order Filled at: Wed 19 Sep 2012 03:33:36 AM GMT
        Amount: 0.09804463 BTC
        Price: @฿373.45556
        Total: ฿36.61531

        Order Filled at: Wed 19 Sep 2012 03:33:37 AM GMT
        Amount: 0.04546997 BTC
        Price: @9.42501 €
        Total: 0.42855 €

        Order Filled at: Wed 19 Sep 2012 03:34:36 AM GMT
        Amount: 0.03765482 BTC
        Price: @CA$11.79538
        Total: CA$0.44415

        Order Filled at: Wed 19 Sep 2012 03:34:38 AM GMT
        Amount: 0.03765482 BTC
        Price: @฿373.45556
        Total: ฿14.06240

        Order Filled at: Wed 19 Sep 2012 03:34:38 AM GMT
        Amount: 0.01309733 BTC
        Price: @9.42501 €
        Total: 0.12344 €

        Order Filled at: Wed 19 Sep 2012 03:35:37 AM GMT
        Amount: 0.01555308 BTC
        Price: @CA$11.79538
        Total: CA$0.18345

        Order Filled at: Wed 19 Sep 2012 03:35:39 AM GMT
        Amount: 0.01555308 BTC
        Price: @฿373.45556
        Total: ฿5.80838




Bid(s) (Buy)

        Order Filled at: Wed 19 Sep 2012 03:31:34 AM GMT
        Amount: 0.05522346 BTC
        Price: @386.16853 RUB
        Total: 21.32556 RUB

        Order Filled at: Wed 19 Sep 2012 03:31:34 AM GMT
        Amount: 0.25796609 BTC
        Price: @387.76148 RUB
        Total: 100.02931 RUB

        Order Filled at: Wed 19 Sep 2012 03:31:34 AM GMT
        Amount: 0.68681045 BTC
        Price: @387.94166 RUB
        Total: 266.44239 RUB
full member
Activity: 154
Merit: 102
Well, despite the trading halt, here's today's numbers.

BTC0.14280064 $20.71723
Overall change from initial;
Loss in USD if I were to convert to initial BTC:
$-1.49839
Loss in BTC if I were to convert back to BTC only:
BTC-0.16899936

Losses have entirely been the fault of bugs. Trading executed a very slight gain today, despite another known issue. This is looking much better with each iteration.

So I have finished the refactor and decided to try it in live mode.
As it turns out if there is no volume on a market  we get a trend arrow of 0, add that to an increasing bid arrow and you end up dumping all your bitcoins into rubles. Sad

On the bright side I can confirm it is infact bringing cross market liquidity.  I'll make a commit now in case anyone wants to try this stage out.

Looks like it's gonna need more work, but better me than you guys.  (p.s. Please keep the donations coming, I just bought a lot of rubles by accident)
full member
Activity: 154
Merit: 102
Not to mention buying up that many BTC would drive the prices up Wink

It would be nice if ATP looked at that sort of thing. Ever been on freenode IRC and spoken with a bot named gribble?

Code:
;;market sell 100
A market order to sell 100 bitcoins right now would net 1222.2737 USD and would take the last price down to 12.2110 USD, resulting in an average price of 12.2227 USD/BTC.
;;market buy 100
;;market buy 1000
A market order to buy 100 bitcoins right now would take 1231.4490 USD and would take the last price up to 12.3150 USD, resulting in an average price of 12.3145 USD/BTC.
A market order to buy 1000 bitcoins right now would take 12321.7316 USD and would take the last price up to 12.3300 USD, resulting in an average price of 12.3217 USD/BTC.

Since gox does not provide fill or kill type orders, that I am aware of, will the arbitrage strategy do similar calculations to insure fills and profits?

Thanks for the continued work on the project.

That's market depth which is a result of doing some calculations against the orderbook.
The current engine doesn't take depth into account at all.  However the new one will use the order book to determine if an order can be fulfilled for a profit and what that expected profit would be, which is itself a type of depth calculation.
sr. member
Activity: 409
Merit: 250
Not to mention buying up that many BTC would drive the prices up Wink

It would be nice if ATP looked at that sort of thing. Ever been on freenode IRC and spoken with a bot named gribble?

Code:
;;market sell 100
A market order to sell 100 bitcoins right now would net 1222.2737 USD and would take the last price down to 12.2110 USD, resulting in an average price of 12.2227 USD/BTC.
;;market buy 100
;;market buy 1000
A market order to buy 100 bitcoins right now would take 1231.4490 USD and would take the last price up to 12.3150 USD, resulting in an average price of 12.3145 USD/BTC.
A market order to buy 1000 bitcoins right now would take 12321.7316 USD and would take the last price up to 12.3300 USD, resulting in an average price of 12.3217 USD/BTC.

Since gox does not provide fill or kill type orders, that I am aware of, will the arbitrage strategy do similar calculations to insure fills and profits?

Thanks for the continued work on the project.
full member
Activity: 154
Merit: 102
Started with 102 BTC. Sitting at USD $1202 now. If I sold it for BTC I would have a loss of 5 BTC.
Hard to keep track on the app as I restarted it so many times that it lost track of real P/L


Not to mention buying up that many BTC would drive the prices up Wink

I'm in the middle of a fairly significant refactor, when it runs it should bring your BTC back at best market prices.
In the meantime everyone please shut down your bots and take your profit.  The buy portion of the engine has an issue because the ask arrow is not being calculated at all.  Since the bid side of the equation looks at the ask arrow to calculate weight and to determine whether or not to bother buying.

I'll have the refactor done sometime tonight and we can try again in the morning.

If you're stuck with a large amount of local currency just hold onto it until I have the next release fully tested.
legendary
Activity: 1358
Merit: 1002
Started with 102 BTC. Sitting at USD $1202 now. If I sold it for BTC I would have a loss of 5 BTC.
Hard to keep track on the app as I restarted it so many times that it lost track of real P/L
sr. member
Activity: 409
Merit: 250
Code:
Sep 18, 2012 3:49:20 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: BTC -0.03346634 | -19.42325300%
Sep 18, 2012 3:49:20 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Current P/L: USD -10.48401 | -2.40800%
Sep 18, 2012 3:49:20 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
INFO: Overall P/L: -10.889290724034 USD

Bought $500 worth of BTC. Sold off all BTC. 12 hrs, -$11.
full member
Activity: 154
Merit: 102
Code:
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent run
INFO: Ticker Size: 191 | Trend Arrow: 3.0 | Bid Arrow: 13.0 | Ask Arrow: 0.0 | VWAP: USD 12.11436
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: Weight is 0.08376963350785341
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: Attempting to sell 0.006257293403141361636458084305445481732022017240524291992187500 of 0.07469644 BTC available
Sep 18, 2012 9:01:49 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
SEVERE: Failed to sell 0.006257293403141361636458084305445481732022017240524291992187500 at current market price.
Please investigate

down about ~0.18btc

Judging from the messages you might be running an version a little bit before the current version or you have minBTC set below the MtGox minimum trade amount 0.01BTC
full member
Activity: 154
Merit: 102
Code:
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent run
INFO: Ticker Size: 191 | Trend Arrow: 3.0 | Bid Arrow: 13.0 | Ask Arrow: 0.0 | VWAP: USD 12.11436
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: Weight is 0.08376963350785341
Sep 18, 2012 9:01:48 PM org.open.payment.alliance.isis.atp.TradingAgent evalAsk
INFO: Attempting to sell 0.006257293403141361636458084305445481732022017240524291992187500 of 0.07469644 BTC available
Sep 18, 2012 9:01:49 PM org.open.payment.alliance.isis.atp.TradingAgent marketOrder
SEVERE: Failed to sell 0.006257293403141361636458084305445481732022017240524291992187500 at current market price.
Please investigate

down about ~0.18btc

Everyone who has suffered a loss in the current market please shutdown your bot for a little bit.
I'm working on refining the algorithm to ensure that it requires a profit on each trade and won't trade into a loss.

A loss is possible if there is an extended up trend with several upward bumps in market pressure and a large bid/ask spread.
What happens is that it runs out of bitcoins too quickly at what it believes will be the peak, but it turns out the sale actually occured someplace in the middle of the curve.

After about an hour that old volume drops out of the equation, the bot sees this as a change to vwap and it buys again, but ends up doing so at or above the price it previously sold at.

The change I'm going to make is to move from market orders to limit orders and set the price so that it splits the spread.
This will ensure that money isn't being left on the table.

In addition to those changes I'm going to modify the trading pathways to use cross currency arbitrage if there aren't sufficient funds to execute a trade at market prices.

This will have the effect of pulling in bitcoins from markets where the price is a bargain and selling them on the market that is currently generating profit.  It will also help to close the huge spreads we're currently seeing and ensure cross market liquidity.

If you've taken a loss and you've been running more than 6 hours with the latest version, please stop the bot until further notice and post your beginning and ending balances, in BTC & Local, along with the total runtime for the bot.

This will help me vet my numbers.

full member
Activity: 154
Merit: 102
To continue my thought from above.

I've realized that the algorithm as it currently stands actually seeks to stabilize the price.
Thus if enough folks were running it the market would be less volatile.
However the algorithm only makes money from volatility (price volatility /hr = profit).

I'm going to run mine for a week and see how it compares with the market before tinkering with it again.
full member
Activity: 154
Merit: 102
It sold almost all my BTC yesterday. I stopped it when it wasn't buying and only upgraded this morning because it was getting late yesterday.
It's working for 1 hour now, let's wait and see what it does. I hope losing all the market data isn't a big problem.

It only considers the last hour of data so that's not a problem.

We've had a huge surge in the market this morning.  The algorithm is doing what it was designed to do, sell as the price is going up in proportion to the amount of pressure pushing the market up.  When the market pressure goes down it will start buying again in proportion to the amount of pressure pushing it down.

I do think that I could improve the algorithm a bit.

We need to institute water marks against each of the arrows so that it does a better job of capturing only the high and low points on a given curve.

It could do that by looking for a sustained upswing followed by indications of a down turn, then sell at the start of that downturn in proportion to the distance between the last buy and the current sell (profit proportional).

If we did this it would mean more profitability during huge surges like this, but might destabilize the price by triggering a rapid "race to the bottom" as everyone seeks to close out their positions as quickly as possible. 

Imagine a market with an hourly volume of 1000 suddenly being hit with 10,000 all at once and all seeking to sell at the market price.



BCB
vip
Activity: 1078
Merit: 1002
BCJ
me too.  I updated with the latest commit last night and this morning it had sold almost all of my [edit]USD for[/edit] bitcoin.

legendary
Activity: 1358
Merit: 1002
It sold almost all my BTC yesterday. I stopped it when it wasn't buying and only upgraded this morning because it was getting late yesterday.
It's working for 1 hour now, let's wait and see what it does. I hope losing all the market data isn't a big problem.
full member
Activity: 154
Merit: 102
I cleaned up some of the messages a bit and tidied up some sections of code so it doesn't jump down any unnessecary rabbit holes anymore.
This will be my last release for a bit unless something major is uncovered.

I've decided to take a bit more time with the multi-currency arbitrage version.  This experience has shown me that it would be best if when I write financial apps that I take a "test first" approach instead of the agile rapid iteration process that I've been using.

All in all with it's latest release, the bot seems pretty stable now.
full member
Activity: 154
Merit: 102
Up and building market profile.

I'll skip the fine details for today's P/L - it's a lot of sell, down about BTC0.11 overall, if I bought back to BTC. This should not be counted against the current build, for anyone reading into it.

Here's to actually trading!

I ran out of bitcoins, likely because of the no-buying bug.
I do have $59.15 USD now that I get to hold onto until the market corrects *sigh*

Morning balance $53.91
Current balance  $59.15

Profit= $5.24
%PL = 9.71%

Market Change for the day

Market Open = $11.81
Market Close = $11.93

Market Profit = 0.12USD/BTC
%change = 1.01%

Even with all the issues encountered today the application managed to beat the market a little bit.
full member
Activity: 154
Merit: 102
BTW, my bot crashed because of connectivity issues. It should probably just wait instead of crashing.

Same issue here.

Fix has been comitted.
Please upgrade immediately.

This also fixes part of the Overall PL by normalizing the BTC component to local currency before computing the PL.  Overall PL % is still broken but the currency amount is correct.

I don't see the commit yet, but I will keep an eye on it. Thanks isis

I'm just having one of those days ending in Y (why).

Just pushed the commit to the central repo on the master branch.
sr. member
Activity: 409
Merit: 250
BTW, my bot crashed because of connectivity issues. It should probably just wait instead of crashing.

Same issue here.

Fix has been comitted.
Please upgrade immediately.

This also fixes part of the Overall PL by normalizing the BTC component to local currency before computing the PL.  Overall PL % is still broken but the currency amount is correct.

I don't see the commit yet, but I will keep an eye on it. Thanks isis
full member
Activity: 154
Merit: 102
I'm going to eventually have to refactor both the evalAsk & evalBid.

Half the problem is that significant sections of code are duplicated between the two functions.  Honestly it doesn't need to be that way, it's just rushed and sloppy.

Anyways it seems to be working now so I'll clean it up, write some unit tests and then leave this part the heck alone.

Thanks for your patience everyone!
Pages:
Jump to: