Bitcoin Forum
November 06, 2024, 05:34:48 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Seal's automated trading systems  (Read 5199 times)
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
September 30, 2012, 02:23:18 PM
Last edit: October 01, 2012, 01:22:09 PM by Seal
 #1

Hi all,

I've been lurking for a while now so I would like to share something constructive into my dealings with bitcoin.

I've worked in the world of finance for a number of years and have taken an interest in automated trading systems. In the Bitcoin world there is huge opportunity as the markets are not very efficient. Over the last year, I have developed and successfully run a number of automated trading bots on various brokers.

Here is a screenshot of one of my arbitrage bots:



Certain details have been obscured

There are plenty of trading opportunities within Bitcoin, whatever your investment style. One thing I would recommend, is managing your risk from a broker perspective. In the banking industry, we call this counterparty risk. The biggest threat to your profitability is your broker being hacked / shutting down / running off with your money. As we all unfortunately know, this happens frequently in the Bitcoin world.

In the style of reddit's AMA where visitors can post questions. Go ahead and ask me anything and I will do my best to answer.

This thread was inspired by Goomboo and the sharing of his trading activities.

DefiDive - Filter the noise
A clean crypto asset management terminal
phungus
Full Member
***
Offline Offline

Activity: 128
Merit: 100


I'm doin' fine on cloud 9


View Profile
October 01, 2012, 12:50:43 PM
 #2


So, these trades show you buying on Gox at one price and selling on XXX exchange for a different price and pocketing the difference?

Do the other exchanges always catch up in price?

I'm still trying to put together the mechanics of it in my head, which until recently was not very learned in the ways of brokerage and financial exchange. :-)

-p

I can do stuff
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 01:20:52 PM
 #3

Yes thats right phungus, the buy side most frequently happens at MtGox and the sell side elsewhere. The difference after fees is your profit and is virtually guaranteed if you can place your orders quick enough. In essence, this is what arbitrage trading is all about.

The broker with the highest volume will almost always attract the best prices (which can be measured by a small spread). MtGox consistently has a higher trading volume then any other broker so leads any price movement. The other exchanges almost always catch up to the price movements that happen on MtGox. This fact alone is enough to profitably trade on the smaller brokers.

One of the first lessons in economics 101 is the theory of supply and demand. Have a read if you are interested in a solid understanding of the basics.

DefiDive - Filter the noise
A clean crypto asset management terminal
SkRRJyTC
Legendary
*
Offline Offline

Activity: 1008
Merit: 1000


View Profile
October 01, 2012, 01:42:46 PM
 #4

How do you combat the risk of having monies at lots of different exchanges?

How many different exchanges do you utilize?
molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
October 01, 2012, 02:12:03 PM
 #5

How do you move the FIAT from one exchange to the other and what's the associated cost (fees, moneys frozen up for certain time).

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
squid
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
October 01, 2012, 02:27:10 PM
 #6

I am assuming having a significant bank roll is relatively important to make a decent amount of profit in this short exchanges. Is this correct?
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 03:05:53 PM
 #7

How do you combat the risk of having monies at lots of different exchanges?

How many different exchanges do you utilize?

At different points in time I ran the bot(s) on 4 different exchanges, MtGox, Intersango, CryptoXChange and the ill fated WorldBitcoinExchange  Cry. Trading was done in a number of different currencies.

As I said in my OP, risk came to be one of my biggest threats to profitability. One way I lowered my risk was by increasing the number of exchanges I traded on. I placed a personal limit with each broker of how much I would trust them with and due diligence was always a part of my risk management. Getting in touch with the people running the brokers and asking questions / gauging responses on a number of occasions helped.

Balancing the amount of bitcoin is straightforward as all API's support automatic withdrawals and deposits. Limiting the amount of fiat risk I'm exposed to is more tricky.

Disclaimer: None of the bots are currently active.

DefiDive - Filter the noise
A clean crypto asset management terminal
thezerg
Legendary
*
Offline Offline

Activity: 1246
Merit: 1010


View Profile
October 01, 2012, 03:12:51 PM
 #8

why aren't they active?
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 03:18:31 PM
 #9

How do you move the FIAT from one exchange to the other and what's the associated cost (fees, moneys frozen up for certain time).

Fiat was moved through my personal bank accounts. The fee structure at each broker differs a lot. Some want a percentage, some have a fixed fee for any balance and some are free. This has to be taken into account in the bot's trade execution calculations are performed so that it will never execute an unprofitable trade.

Careful calculations in excel showed me if it was viable to arbitrage the various brokers and the optimum transfer amounts (taken into account risk). e.g. if a broker wanted to charge a $10 fixed fee, then transferring $5000 at a time resulted in a cost of 0.2% of my trading profits; transferring $1000 at a time would equate to a 1% cost of trading profits.

Transfer times are a pain, fiat transfers are sporadic at best with certain brokers taking days to even initiate a transfer. I kept an amount of fiat as reserve in my bank account and would use that as a buffer. Keeping the bot trading depended on keeping the fiat amounts up. Volatility is a good signal of when I would have to step in.

DefiDive - Filter the noise
A clean crypto asset management terminal
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 03:22:02 PM
 #10

I am assuming having a significant bank roll is relatively important to make a decent amount of profit in this short exchanges. Is this correct?

Yes thats right, profitability on overall trading volume is a few % at best. In the real markets, Prop trading houses who are the biggest players in high frequency trading / automated trading / arbitrage trading etc... regard 1% profit on trades as a huge figure.

DefiDive - Filter the noise
A clean crypto asset management terminal
BitcoinRate.com
Member
**
Offline Offline

Activity: 116
Merit: 11



View Profile WWW
October 01, 2012, 03:25:35 PM
 #11

Nice work!

What language did you write this bot in?

Do execution/calculation speed differences between for example C and slower languages like Python matter in the current Bitcoin market? As in: will your bot be fast enough using Python in executing orders profitably? Or is the slightly slower execution time of Python no problem at all for the foreseeable future?

★ Get +16GB extra on your Dropbox: https://bitcointalk.org/index.php?topic=142163.0
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 03:42:44 PM
 #12

why aren't they active?

I have a few reasons, the main one being that I can't trust most of the brokers besides MtGox for the amounts I want to trade. They are by far the most professional.

Its difficult and expensive it is to operate a good bitcoin brokerage. Profit is hard to come by unless you have massive trading volume and unless you have a large trading volume, your prices will never lead meaning fewer customers. Its a double edged sword which is very unfortunate.

This is compounded by the fact that serious IT security is very expensive and only affordable by the largest brokers. I won't even get started on that topic... Roll Eyes

DefiDive - Filter the noise
A clean crypto asset management terminal
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 01, 2012, 04:07:22 PM
 #13

Nice work!

What language did you write this bot in?

Do execution/calculation speed differences between for example C and slower languages like Python matter in the current Bitcoin market? As in: will your bot be fast enough using Python in executing orders profitably? Or is the slightly slower execution time of Python no problem at all for the foreseeable future?

Thanks BitcoinRate Smiley

Mine is done in PHP, purely because thats what I'm most experienced in.

No, different languages do not make a difference, in fact PHP is notorious for being one of the slowest languages out there.

My trading engine, calculates if a trade is profitable takes less than 0.00003 seconds. Placing the trade on the other hand using the http calls can take upto and over 1 second which in comparison is an eternity. Execution depends upon the broker's matching engine (some of which are slow).

I was hoping to rewrite my bot in Python someday as I've been teaching myself. I quite like the language!

For those that would like to try their hand at arbitrage trading, I'd encourage you to give it a go. Opportunities are reasonably good still and I regularly see trading opportunities lasting for minutes at a time. Make sure you have some fiat and bitcoin on both brokers to start with and wait for some volatility! Using the websites to place orders are good enough.

DefiDive - Filter the noise
A clean crypto asset management terminal
BitcoinRate.com
Member
**
Offline Offline

Activity: 116
Merit: 11



View Profile WWW
October 01, 2012, 08:55:01 PM
 #14

Nice work!

What language did you write this bot in?

Do execution/calculation speed differences between for example C and slower languages like Python matter in the current Bitcoin market? As in: will your bot be fast enough using Python in executing orders profitably? Or is the slightly slower execution time of Python no problem at all for the foreseeable future?

Thanks BitcoinRate Smiley

Mine is done in PHP, purely because thats what I'm most experienced in.

No, different languages do not make a difference, in fact PHP is notorious for being one of the slowest languages out there.

My trading engine, calculates if a trade is profitable takes less than 0.00003 seconds. Placing the trade on the other hand using the http calls can take upto and over 1 second which in comparison is an eternity. Execution depends upon the broker's matching engine (some of which are slow).

I was hoping to rewrite my bot in Python someday as I've been teaching myself. I quite like the language!

For those that would like to try their hand at arbitrage trading, I'd encourage you to give it a go. Opportunities are reasonably good still and I regularly see trading opportunities lasting for minutes at a time. Make sure you have some fiat and bitcoin on both brokers to start with and wait for some volatility! Using the websites to place orders are good enough.

Thanks for the elaborate response. I was asking since I am most fluent in Python. Having seen how in HFT milliseconds do matter, I was wondering how it was in the Bitcoin world.

I am just now working on building out bitcoinrate.com and getting familiar with the API's of different exchanges. Definitely planning on using those skills to explore other avenues.

Could you elaborate on the volatility. You mean you look for volatility at MTGox?

If volatility is high at MTGox, your data has historically shown that large enough price increases/decreases tend to happen and the lag of other exchanges tends to be enough to be able to exploit arbitrage opportunities?

★ Get +16GB extra on your Dropbox: https://bitcointalk.org/index.php?topic=142163.0
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 02, 2012, 07:18:35 AM
 #15

Nice work!

What language did you write this bot in?

Do execution/calculation speed differences between for example C and slower languages like Python matter in the current Bitcoin market? As in: will your bot be fast enough using Python in executing orders profitably? Or is the slightly slower execution time of Python no problem at all for the foreseeable future?

Thanks BitcoinRate Smiley

Mine is done in PHP, purely because thats what I'm most experienced in.

No, different languages do not make a difference, in fact PHP is notorious for being one of the slowest languages out there.

My trading engine, calculates if a trade is profitable takes less than 0.00003 seconds. Placing the trade on the other hand using the http calls can take upto and over 1 second which in comparison is an eternity. Execution depends upon the broker's matching engine (some of which are slow).

I was hoping to rewrite my bot in Python someday as I've been teaching myself. I quite like the language!

For those that would like to try their hand at arbitrage trading, I'd encourage you to give it a go. Opportunities are reasonably good still and I regularly see trading opportunities lasting for minutes at a time. Make sure you have some fiat and bitcoin on both brokers to start with and wait for some volatility! Using the websites to place orders are good enough.

Thanks for the elaborate response. I was asking since I am most fluent in Python. Having seen how in HFT milliseconds do matter, I was wondering how it was in the Bitcoin world.

I am just now working on building out bitcoinrate.com and getting familiar with the API's of different exchanges. Definitely planning on using those skills to explore other avenues.

Could you elaborate on the volatility. You mean you look for volatility at MTGox?

If volatility is high at MTGox, your data has historically shown that large enough price increases/decreases tend to happen and the lag of other exchanges tends to be enough to be able to exploit arbitrage opportunities?

Its not lag of an exchange which makes the prices follow MtGox. Its the people placing orders on the other exchanges not knowing that the price has suddenly changed on MtGox (for better or worse). Most of these people won't care as they are not traders but just want to acquire bitcoin at a price which seems reasonable to them.

I don't actively look for volatility as its something out of my control. I just wait for times of volatility (which often means high volume) as arbitrage opportunities become more frequent. When this happens, I make more of an effort to monitor the bots and each of their trades.

DefiDive - Filter the noise
A clean crypto asset management terminal
thezerg
Legendary
*
Offline Offline

Activity: 1246
Merit: 1010


View Profile
October 02, 2012, 11:55:19 PM
 #16

why aren't they active?

I have a few reasons, the main one being that I can't trust most of the brokers besides MtGox for the amounts I want to trade. They are by far the most professional.

Its difficult and expensive it is to operate a good bitcoin brokerage. Profit is hard to come by unless you have massive trading volume and unless you have a large trading volume, your prices will never lead meaning fewer customers. Its a double edged sword which is very unfortunate.

This is compounded by the fact that serious IT security is very expensive and only affordable by the largest brokers. I won't even get started on that topic... Roll Eyes

Yes, my non-quantitative assessment is that the risk of holding money on these exchanges outweighs the profit that can be extracted from arbitration. 

Also, in a bullish trending market, the portion of the cycle time the $ spends in fiat is significant -- you miss out on the BTC price appreciation which may be significantly more then the arb profit since moving the fiat takes days.
phungus
Full Member
***
Offline Offline

Activity: 128
Merit: 100


I'm doin' fine on cloud 9


View Profile
October 03, 2012, 11:26:07 AM
 #17


Dwolla was really good for moving fiat when it was working correctly. One could move USD between Tradehill and MtGox instantly.

And then that dried up...

-p

I can do stuff
Kontakt
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
October 04, 2012, 02:10:35 AM
 #18

I wrote half of one of these bots in Python, just a CampBX buy/sell bot. I never finished it though, because with the capital I could muster, it just wasn't profitable. I would need 20 cent arbitration just to cover my fees. Still have the code for that if anyone wants to see it. Never got around to working out an algorithm for it.
Seal (OP)
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
October 04, 2012, 05:37:57 AM
 #19

Also, in a bullish trending market, the portion of the cycle time the $ spends in fiat is significant -- you miss out on the BTC price appreciation which may be significantly more then the arb profit since moving the fiat takes days.

There are ways around this, my method was to keep a btc 'float' amount which is always fixed. However much btc I would buy on one broker, I would sell on the other, keeping this float level the same. Profits were taken out of the fiat.

A crude analogy is a corner shop owner keeping a fixed amount of change in his till every night and taking out his profits. This will lower risk slightly.

Be careful not to mix up arbitrage trading with trading market movements... with arbitrage you are hoping for good market movement regardless of direction as this equals profit. If you are trading market movements or investing, then you will be betting for a the price to go up or down in the same direction your bet is.

DefiDive - Filter the noise
A clean crypto asset management terminal
thezerg
Legendary
*
Offline Offline

Activity: 1246
Merit: 1010


View Profile
October 04, 2012, 06:52:19 PM
 #20

yes, my issue is a bull (or bear) trending market means that the average of exchange A - exchange B over time is non-zero, in other words the opportunities tend to be in the same direction.  So I have to move the BTC and USD back around which is instant for the BTC but takes days for the USD.

Pages: [1] 2 »  All
  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!