
Blackbird: Bitcoin arbitrage - vega_empire
https://github.com/butor/blackbird/blob/master/README.md
======
eriktrautman
Two notes. First, as others have said, while the market may contain
inefficiencies, they tend to close fast especially with a public solution.
That said, this may be a good starting point for you to go nuts on for
generation 2.0 so enjoy the code.

Second, while I won’t comment on this particular strategy, I want to note that
many so-called “arbitrage” systems are actually sleeves for another important
risk: liquidity. These strategies typically assume normal trading behavior and
don’t take into account that exchanges break during crisis events, the exact
events (even if they’re rare “black swans”) which can leave you half in a
trade and wearing massive exposure during extreme volatility. The analogy is
picking up nickels before a bulldozer... use at your own risk.

~~~
mdgrech23
huh, you give an analogy w/ out actually explaining how this would happen.

~~~
sb8244
I think that poster does explain how it happens. The exchanges tend to shut
down or break during extreme volatility events. If one breaks and the other
doesn't, you're half in the market. What if you can't sell your positions
until after the price drops, but the other position doesn't exist to balance
it out?

~~~
nugget
With cryptocurrencies you also have other exchange risks, notably the risk an
exchange is hacked or otherwise goes out of business. Imagine if you had been
buying BTC on Coinbase and selling BTC on MtGox in 2013, making a great profit
(on paper) through arbitrage, until MtGox tanked and all those profits were
frozen.

------
thisisit
For people wondering, does it work? Short answer. No.

Long answer - The biggest flaw lies in the "advantages" section:

 _Unlike other Bitcoin arbitrage systems, Blackbird doesn 't sell but actually
short sells Bitcoin on the short exchange_

The problem is only Bitfinex allows _short selling_. So, the example is an
excellent case of cherry picking.

There are other issues with their strategy too.

~~~
jaaames
Also Bitfinex uses Tether tokens, not USD, which are by their own terms of
service worthless, and it's dubious as to whether their actually backed by any
real USD.

This arbitrage exists because of the huge counterparty risk of exchanges

~~~
Pyxl101
I thought you were being hyperbolic about Tether tokens being worthless. Turns
out you're completely right:
[https://tether.to/legal/](https://tether.to/legal/)

> Tethers are not money and are not monetary instruments. They are also not
> stored value or currency. There is no contractual right or other right or
> legal claim against us to redeem or exchange your Tethers for money. We do
> not guarantee any right of redemption or exchange of Tethers by us for
> money.

> We make no representations, warranties, or guarantees to you of any kind,
> including with respect to any right of redemption or exchange of Tethers for
> any property.

That doesn't make any sense. Those are absolutely _outrageous_ terms of
service for what Tether purports to be.

I thought the _entire point_ of Tethers is that they're redeemable for USD on
a 1-to-1 basis with a fixed exchange rate. That's exactly what the Tether FAQ
says, but based on the actual ToS, I'd have to consider these statements to be
absolute bullshit:

> Tether Platform currencies are 100% backed by actual fiat currency assets in
> our reserve account. Tethers are redeemable and exchangeable pursuant to
> Tether Limited’s terms of service. The conversion rate is 1 tether USD₮
> equals 1 USD.

[https://tether.to/faqs/](https://tether.to/faqs/)

The FAQ says "Tethers are redeemable[] pursuant to Tether's terms of service"
and the ToS says "There is no contractual right or other right or legal claim
against us to redeem or exchange your Tethers for money"

That is just fucking outrageous. I'm sorry, but it is.

I do not understand how or why anyone would use Tether without a contractual
guarantee from the issuer to redeem each token for the underlying currency
that it reserves. Without this, there's no reason for Tether to have a value.

I thought that the concept of Tether had sound technical merit -- essentially,
a cryptocurrency with a fixed exchange rate backed by a full-reserve central
bank for each currency -- but when offered with those legal terms, I have to
consider it a scam. Under their ToS, money can flow into Tether but not out!

I can speculate about all sorts of reasons why they might have put up those
ToS, but at the end of the day, it's a morally wrong contractual relationship
for them to have with their customers. They should operate like a bank or
otherwise with a guarantee that customers can convert Tether back to the
reserve currency.

Edit: While doing some searches on this topic, I also found a news article
about their questionable ToS, quoting this statement from the company:

> Our Terms of Service have been carefully picked apart by various malcontents
> and twisted to suggest that Tethers would not be redeemable for currency on
> some bizarre, malicious whim by Tether. That is untrue.
> [https://cointelegraph.com/news/tether-really-isnt-a-scam-
> com...](https://cointelegraph.com/news/tether-really-isnt-a-scam-company-
> promises)

Yeah, okay guys ... this interpretation is not carefully picking apart the ToS
with malcontent. It's just a basic plain English reading of the ToS. I would
stay away from Tether, and any company that responds in this way to completely
reasonable criticisms.

~~~
Jasper_
And you can't withdraw anymore. [0] The whole trick was that Bitfinex could
claim to have a price for USD, because they have a price for USDT, and the
ratio of USDT/USD is 1. But since they've printed over 1 billion USDT without
any assurance that they have USD to back them up, and now you can't withdraw
at the source for the USD that they supposedly have backed in a bank
somewhere, expect the value of USDT/USD to plummet on exchanges. Fun times.

[0] [https://tether.to/wallet-service-and-platform-
update/](https://tether.to/wallet-service-and-platform-update/) [1]
[https://wallet.tether.to/transparency](https://wallet.tether.to/transparency)

------
cdolan
@JulienHamilton (author at bottom of page), why would you share this with
others? If arbitrage exists, there is not benefit to you allowing others to
profit, as it eats into your profit. So what’s the reasoning behind releasing
this?

~~~
MaxfordAndSons
You're right in theory, but that's only really a risk if it actually works,
which this doesn't.

Also, if the author is interested in increasing market efficiency, but not in
exposing themselves to the risk of being caught in a halfway position when an
exchange breaks, it makes sense to release as FOSS. The target users would
then be the exchanges themselves.

------
scoot
Two words: "counterparty risk".

~~~
bkruse
I'm surprised this comment isn't #1!

~~~
scoot
I probably should have added an explanation for those unfamiliar with the
term, but then it wouldn't have been two words! :)

Essentially conterparty risk is the risk that the other party to a contract,
in this case the broker, defaults.

Bacause automated arbitrage trading requires you to hold your funds with the
broker, rather than transferring them to your own (preferably cold) wallet,
you are exposed to the risk that the broker goes out of business without
returning your funds, or otherwise fails to live up to its side of the
bargain.

With crypto-currency exchanges, that risk over the long term might be assessed
to outweigh the possible rewards from arbitrage trading.

~~~
ericjang
This. I wrote a crypto arb bot in 2014 and decided to stop working on it /
open-source it for the same reason after a couple exchanges that I had cryptos
in mysteriously vanished.

------
tempestn
"The Bitcoin market could suddenly lose twice its value that this won't make
any difference in the strategy returns."

Just FYI I think you mean 'lose half its value'. I doubt we're going to see
BTC go negative.

~~~
if_by_whisky
All right settle down

------
jluxenberg
From the README:

    
    
      >> your maximum loss on an exchange won't be 
      >> greater than $xx no matter what.
    

Unless I'm misunderstanding; the bot sells short on one exchange and buys on
the other. If there was a bug where it didn't cover the short sale with a long
buy, and Bitcoin price goes up, you'd be liable for the increase in price.

~~~
jluxenberg
And here's an instance of this very bug!
[https://github.com/butor/blackbird/issues/348](https://github.com/butor/blackbird/issues/348)

~~~
tomaskafka
And they will always happen - once you send a first transaction of the pair,
if anything goes wrong (eg. overloaded exchange timeouts on API call) with the
second one, there is no undo.

------
ReverseCold
Note that unlike most other arbitrage, this isn't foolproof. High volatility
can kill it, and price differences on some exchanges only exist due to
geographical or technical restrictions (so the price is always a few dollars
higher/lower). Definitely a fun experiment, but don't expect it to make you a
lot of money.

------
mshenfield
It's worth reading the linked issue for a refresher on how arbitrage, and this
scheme in particular, work:
[https://github.com/butor/blackbird/issues/100](https://github.com/butor/blackbird/issues/100).

I think the pathalogicial case is if the markets never converge significantly,
or more likely diverge wildly, e.g. one gets hacked. Otherwise, Blackbird will
wait it out until it hits a pre-determined settable profit margin.

I'm guessing plausible return rates are low, but with the relative safety you
can risk a bit more than just "crystal-ball"ing the market or playing daily
lows and highs.

------
jps359
previous discussion:
[https://news.ycombinator.com/item?id=13889608](https://news.ycombinator.com/item?id=13889608)

------
c1utch1
The issue is BTC trading costs are so high that arb'ing it doesn't work well.
You need massive spreads and perfect trading execution for this to work.

~~~
dannyw
Since when is a trading cost of 0% (maker, high volume, bitfinex) and 0.1%
(taker, high volume, bitfinex) so high?

------
KasianFranks
"Information arbitrage" will become more important with crypto: "Contagious
Speculation and a Cure for Cancer: A Non-Event that Made Stock Prices Soar,"
with Tomer Regev, Journal of Finance, February 2001, Vol. 56, No.1, pp.
387-396.

[https://www0.gsb.columbia.edu/faculty/ghuberman/research.htm...](https://www0.gsb.columbia.edu/faculty/ghuberman/research.html)

------
ilitirit
BTC arbitrage is very risky due to transaction times, volatility, and volume.
And it's often not worth it depending on your region due to potentially high
fees. It's not something I would recommend to people who have never done it
before.

As an experiement, go on to a site like CoinMarketCap. Click on BTC->Markets.
Sort by price. It looks like a _ton_ of arbitrage opportunities, right?
Well... now try to take advantage of it.

~~~
valuearb
The OP claims their system isn’t affected by transfer times. Read it and tell
us what you think.

~~~
makomk
Of course it's affected by transfer times, it just takes some thought to
understand why. Ultimately, in order for this to close out the position for a
profit, the prices have to converge for long enough, and in order for that to
happen reliably someone has to do arbitrage the slow way by transferring
money. While you're waiting for that to happen, you're paying interest on the
short position and exposed to the risk of a price increase causing a margin
call that liquidates your short at a loss. The amount of profit you can make
is also limited by the time it takes for the prices to converge.

~~~
disiplus
it does not work like that, it requires you to have "money" or the ability to
short/long at all exchanges and then u simply buy/sell locally.

------
g09980
Given how slow BTC transfers are now (can be 1+ day out of gdax), you would
need to keep sizable amounts of BTC on each exchange and rebalance
periodically.

While technically opportunities exist daily (compare the huge difference in
prices this moment at
[https://coinmarketcap.com/currencies/bitcoin/#markets](https://coinmarketcap.com/currencies/bitcoin/#markets))
but tough to execute due to BTC transfers or fiat transfers being high-
friction.

~~~
moduspwnens14
I just tried to do this last week.

The issue I ran into is you can't move dollars between exchanges easily, so to
rebalance, you've got to switch to something else. So you're profiting from
volatility on one side and then betting on it not happening when you
rebalance... and for the rebalancing, you have to wait a lot longer (as
compared to trading instantly between currencies on the same exchange).

The other issue is that you have to anchor to something, and you can't anchor
to the USD generally because even dollars in various exchanges aren't
effectively worth the same amount (since you can't get them out as quickly /
easily / risklessly in all exchanges). So you've basically got to anchor to US
dollars on a certain exchange, and make trades based on the value of, for
example, "Litecoin if sold on GDAX." That adds complexity, but might just be
the reality of arbitrage.

That and I'm not sure the order books were large enough to make anything other
than small amounts of money. The "last sell" price is just that--the price it
last sold for. It doesn't take a whole lot of money before you've driven the
price toward parity (and your arbitrage opportunity away).

Anyway--for me it was just a winter vacation project more for the experience
than expecting real success. And it may actually work better on a week that
wasn't last week (which was a bit uncommon). I guess we'll see.

------
artur_makly
can someone explain this app in laymen's terms? is it an automatic sausage
maker? or a slot machine?

~~~
ReverseCold
Arbitrage:

Person A is selling apples for $5 and buying for $4.50.

Person B is selling apples for $4 and buying for $3.50.

You buy apples from person B and sell to person A. Of course, this is a bit
oversimplified- this project uses a few tricks to get around volatility.

------
ztbrown
And the more people that run this, the more efficient crypto markets will be!
It's a win-win.

------
jabagonuts
I find it odd that Bittrex isn’t even mentioned as one of the potential
exchanges. I’ve found them to be more stable and user-friendly than other
exchanges.

~~~
zeep
There was a few users on reddit recently that claimed to have gotten robbed by
Bittrex, not sure if it has anything to do with it:
[https://www.reddit.com/r/CryptoCurrency/comments/7lfhfu/bitt...](https://www.reddit.com/r/CryptoCurrency/comments/7lfhfu/bittrex_stolen_my_money_too_its_far_worse_333230/)

------
linkmotif
I didn’t read this, but think about it: if someone knew how to arbitrage BTC,
or anything, why would they share it?

------
davidw
Or: just invest a bit at a time in
[https://finance.yahoo.com/quote/VTSAX/](https://finance.yahoo.com/quote/VTSAX/)
and forget about Bitcoin. Concentrate on advancing your own skills and career,
and maybe invest in some local real estate if you have some extra cash.

~~~
icedchai
Or do both. Diversification across asset classes is good.

~~~
davidw
VTSAX has a lot of diversification built into it, and most importantly, has
extremely low fees. Get some bonds if you'd like too.

~~~
icedchai
Thanks, but I already know, I've been investing in it for over 10 years! It's
done very well. I also have some BTC and ETH.

------
ipince
Wait, since when does GDAX allow short-selling?

------
jutworks
Last time I checked they were using floating points to represent monetary
values. I would not trust this piece of software regardless of how clever
their strategy may be.

~~~
pgwhalen
The whole “never use floats as money” thing is a little overblown. If you need
exact values, where everything needs to add up in the end, sure. But if you’re
generating the value yourself it doesn’t really need to be precise. For
example - create a sell order for ten percent less than the current price -
that doesn’t need to be exact.

------
overcast
I will tell you that any working piece of code that allows someone to make
money, is not public. Use this if you want to inevitably lose money.

~~~
kristiandupont
That seems like a silly statement to me. Obviously, huge amounts of code that
"allows someone to make money" is available publicly, for some definition of
"making money" or other. I am guessing your statement is specifically directed
towards code that is meant for trading markets and referring to the efficient
market hypothesis. That may or may not be true but I think it would suit you
to at least back up such a claim, especially when it comes to crypto
currencies which are obviously a very immature asset class.

~~~
valuearb
Yea he means trading systems. There are thousands of people selling “trading
systems” for the stock market, by definition none of them work.

An example is why Warren Buffett got special permission from SEC to withhold
reporting his trades for longer periods then normal. If you know that WEB
bought a stock today, then you know he’s done the research and it’s a clearly
profitable trade to buy and hold it for the long run. If WEB had to report
trades daily, he’d be out of business, he’d never be able to buy more than a
tiny amount of a stock in a single day, because the next day its price would
have increased at least 20%.

Selling any kind of successful trading system is to invite others into your
trades and make them less profitable for you. Selling the system only makes
sense if the system is unprofitable or it's so thinly profitable that selling
it to suckers is more profitable.

~~~
bramen
If the price of the stock would increase tomorrow by 20%, why wouldn't he be
able to buy more than a tiny amount today?

~~~
valuearb
Warren has over $100B invested in public equities (stocks). He’s s believer in
concentrated portfolios, ie he doesn’t want to own more than a few stocks st a
time. If he can’t buy $10B worth of a stock he’s not interested.

There isn’t a stock in the world you can buy even $1B of in a day without
driving it’s price up dramatically yourself. So Buffett has to slowly
accumulate a position over weeks and months.

~~~
bramen
Oh right, thanks for the explanation.

------
bigtunacan
Anyone actually using this? I’ve looked at it recently, but not sure how well
it works.

~~~
ReverseCold
I used it late 2015 and it was working okay (still lost money sometimes, ended
up with a very tiny gain). It doesn't work very well anymore, mostly due to
Bitfinex being the only short exchange that's supported.

------
rajacombinator
Amazing people are naive enough to post this kind of stuff publicly!

------
rdslw
I'm sad at the quality level of comments on this discussion. Lot of people are
commenting clearly without reading EVEN the readme.md of the linked post.

This tool advantage relies on the fact that NO bitcoin needs to be moved, so
all posts about long time of btc transfers make (almost) no sense.

On the other side only ONE (so far) person mentioned (importantly) that it
works only on bitfinex, and even him didnt clearly wrote that this work ONLY
if bitfinex has higher price than other exchange (reducing arbitrage
opportunities by half), because you can short btc only on bitfinex.

Where is HN from 5 years ago? :(

~~~
Spooky23
Was HN ever a place to talk about financial speculation schemes?

If you want to talk about this stuff, you want a forum full of financial
trader people, not engineers.

~~~
roel_v
Yes it was. It was much more business oriented than it is now.

------
companyhen
Seems like majority of HN hates crypto which is disappointing. Luckily there
are a ton of great subreddits, slack, telegram, and discord channels out
there.

~~~
chishaku
Would you mind posting those?

~~~
kmf
I just started a Telegram group up recently for people casually interested in
altcoins/trading. Welcome to anyone -
[https://t.me/tradetradetrade](https://t.me/tradetradetrade)

------
kang
How to add a new exchange to this? Which interface need to be implemented?

------
SZJX
Why not run arbitrage on ETH etc. which have far shorter transaction time than
BTC. That surely is a much safer bet with essentially the same API. With the
current transaction time BTC arbitrage doesn't seem to be a wise idea at all.
In between the several hours the price could have easily changed more than
10%.

~~~
ReverseCold
This doesn't actually ever send coins over the network. It shorts on one
exchange and goes long on the other.

 _As such it is market neutral (since prices should converge) and transaction
time doesn 't matter.

_Still doesn't work too well.

~~~
WJW
In particular "prices should converge" is hiding a pretty big precondition in
very few words. You don't only need prices to converge, but you need them to
converge within a reasonable time span, which is obviously not guaranteed.
(because if the market was efficient already then the prices would have
converged already and it would not be feasible to run arbitrages like this)

~~~
lodi
It's the other way around... market efficiency is caused by things like this
(not only arbitrage, but that's one important factor).

