butor/blackbird

Advantage of short selling & minimum budget

tbc1 opened this issue ยท 60 comments

tbc1 commented

Hi, thank you for open sourcing your project. I have two questions I would like to ask you.

Why do you claim that one advantage of short-selling is that "the strategy is always market-neutral"?
I think if you would just sell bitcoins instead of short-selling them, the strategy would still be market-neutral.

How much do you think is the minimum budget you need to successfully use the software?

butor commented

Hi @tbc1,

I noticed that the market-neutral concept is sometimes difficult to grasp. You do need short selling to be market-neutral. Just selling bitcoins won't protect you against market risk, because to sell bitcoins means that you own bitcoins on your account in the first place, which bears a market risk.

Let me explain what short selling means and the strategy in general. Short selling is not a Bitcoin thing and it is common in the financial market industry.

  • First the basics: Let's say you think, based on your financial analysis or your favorite crystal ball, that the Apple stock will go up within the next few weeks and you want to profit from that. So today you buy 10 shares of AAPL at $100. Then the stock price goes up (your crystal ball was right!) and after two weeks AAPL is priced at $120. You decide to sell your 10 shares of AAPL. Your profit: 10x$120 - 10x$100 = $1,200 - $1,000 = $200. Well done! We say that you were long on this position (buy then sell later).

  • Now let's say that you think that the Apple stock will drop. You don't own any AAPL shares but you want to profit from that drop. So this is what you can do: you can ask your broker to borrow from him, say, 10 shares of AAPL and you promise that you will give him back these 10 shares later. Once your broker agrees to lend you the 10 shares (I won't go into the details about margin accounts) you can go to the market and sell these 10 shares, even if you don't actually own them!
    Let's say today AAPL is at $100. You borrow 10 shares from your broker and sell them on the market at $100. You make $1,000 of that selling, but you still have a debt of 10 shares towards your broker. Two weeks later, your crystal ball is right (again!) and the price of AAPL drops to $80. You decide to buy 10 shares on the market at $80 and give them back to your broker. That's it! You cleared your debt towards your broker and this is your profit on the operation: sell 10x$100 then buy back 10x$80 = $1,000 - $800 = $200. Well done again! The whole operation you just did is called short selling and we say you were short on this position (sell then buy later).

The examples I gave are speculative ones where you try to forecast the market. But short selling is also used to protect your investments against market fluctuation, in particular sudden market falls. Here is an oversimplified example to illustrate:

AAPL is at $100 and MSFT (Microsoft) is at $50. To be market-neutral (i.e. protected against market fluctuation) you can be long on AAPL and short on MSFT at the same time. For that you would buy 10 shares of AAPL (long $1,000) and short sell 20 shares of MSFT (short $1,000). Now let's see what happens when the market suddenly drops by 20%!

  • AAPL price goes from $100 to $80 (-20%).
  • MSFT price goes from $50 to $40 (-20%).

You decide to exit the market by closing your two positions:

  • You sell your AAPL shares for $800 (10x$80). You originally bought them $1,000: you lose $200 on that long position.
  • You buy back your MSFT shares for $800 (20x$40). You originally sold them for $1,000: you make $200 on that short position.

As you can see your loss is $0 thanks of the long/short strategy you used (long AAPL, short MSFT).

As you can imagine, if the whole market goes up your profit will be ...$0. So how do we make money in a long/short strategy? By betting on the discrepancy between the positions and this is exactly what we do with Blackbird on Bitcoin: if Bitfinex prices Bitcoin at $240 and Bitstamp prices at $200 we think that Bitfinex is overpriced while Bitstamp is underpriced: we go short on Bitfinex and go long on Bitstamp until the two prices are similar again.

Regarding your second question, the profit is a percentage of your exposure so there is no minimal budget. However, you need at least $10 (parameter TestedExposure) otherwise some exchanges might reject your orders.

tbc1 commented

Thank you for your answer, but I'm still not convinced, that short-selling is necessary to be market-neutral.

I give you the (very simplified) example:
At exchange A we have a balance of: 1 Bitcoin, 1000 Dollar
At exchange B we have a balance of: 1 Bitcoin, 1000 Dollar

Bitcoin price at A is 900 Dollar. Bitcoin price at B is 1000 Dollar.
You now buy 1 Bitcoin at A, and sell 1 Bitcoin at B:
A: +1 Bitcoin, -900 Dollar (new balance: 2 Bitcoin, 100 Dollar)
B: -1 Bitcoin, +1000 Dollar (new balance: 0 Bitcoin, 2000 Dollar)

Now we wait until the discrepancy decreases:
Bitcoin price at A is still 900 Dollar, Bitcoin price at B is now also 900 Dollar.
Now we reverse our actions (sell Bitcoin at A, buy Bitcoin at B):
A: -1 Bitcoin, +900 Dollar (new balance: 1 Bitcoin, 1000 Dollar)
B: +1 Bitcoin, -900 Dollar (new balance: 1 Bitcoin, 1100 Dollar)

I claim that this is market-neutral (as we only relied on the discrepancy, not on the market price).

What am I missing? Why do we short-selling instead of selling?

butor commented

Very simple reason. Only look at your first assumption:

At exchange A we have a balance of: 1 Bitcoin, 1000 Dollar
At exchange B we have a balance of: 1 Bitcoin, 1000 Dollar

Now the bitcoin market suddenly loses value for some reason, and drops from $1000 to $700.

Before the crash you had:

  • 1 bitcoin (worths $1000) and $1000 cash: $2000
  • 1 bitcoin (worths $1000) and $1000 cash: $2000

After the crash you only have:

  • 1 bitcoin (worths $700) and $1000 cash: $1700
  • 1 bitcoin (worths $700) and $1000 cash: $1700

You just lost $600 without trading anything.

tbc1 commented

Oh, now I get it. So the point is, that we do not own any bitcoins (as we are only borrowing the ones we sell) and therefore are completly independent from the market.

Thank you very much for the explanation!

butor commented

Precisely!

Thank you, you are a true master!

How do you make money then?
Referring to above explanation and the chart

IF you have
At Bitfinex a balance of $1000 and no BTC
At Bitstamp a balance of $1000 and no BTC

At the first vertical line, the spread between the exchanges is high so you buy (long) Bitstamp and short sells Bitfinex. Then, when the spread closes (second vertical line), Blackbird exits the market by short selling Bitstamp and (long) buying Bitfinex back.

Bitcoin price at Bitfinex is 430 Dollar. Bitcoin price at Bitstamp is 425 Dollar.
You now (long) Bitstamp $100 and short sells $100 Bitfinex:

Now we wait until the discrepancy decreases:
Bitcoin price at second line
Now we reverse our actions (You now (long) $100 Bitfinex and short sells $100 Bitstamp ):
You decide to exit the market by closing your two positions. How did you make money?

butor commented

I can give you an example I gave on a forum, with numbers. I think it helps understand the Blackbird mechanism.

Market quotes are in italic.

Situation 1
OKCoin BTC@$300.00
Bitfinex BTC@$300.00
No opportunity, system 100% cash, no market risk.
Balance on OKCoin: 1000.00 USD, 0.0000 BTC
Balance on Bitfinex: 1000.00 USD, 0.0000 BTC

Situation 2
OKCoin BTC@$290.00
Bitfinex BTC@$310.00
Opportunity ($20.00 spread): system 0% cash, but still no market risk since long/short.
Balance on OKCoin: 0.00 USD, 3.4483 BTC (buy for $1000.00)
Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short sell with $1000.00)

Now the Bitcoin market plummets, but the $20.00 spread is still here.

Situation 3
OKCoin BTC@$180.00
Bitfinex BTC@$200.00
There is still a spread. No action taken.
Balance on OKCoin: 0.00 USD, 3.4483 BTC (long)
Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short)

Now the spread closes:

Situation 4
OKCoin BTC@$200.00
Bitfinex BTC@$200.00
Exit opportunity: we close the long and short positions.
Balance on OKCoin: 689.66 USD, 0.0000 BTC
Balance on Bitfinex: 1354.84 USD, 0.0000 BTC

Before the opportunity we had $2000.00 in cash and now we have $2044.50. So even though during the trade the market lost 33%, we made a 2.2% profit (trading fees not considered).

Good explanation. Thanks.
So what would happen if you only do one side, the short side?
Balance on OKCoin: 1000 USD, 0.0000 BTC
Balance on Bitfinex: 1354.84 USD, 0.0000 BTC

Before the opportunity we had $2000.00 in cash and now we have $2354.84. Isn't it?

butor commented

Yes that's correct, but if you only trade Bitfinex you won't be protected against market moves anymore.
Imagine you only have a short sell position on Bitfinex and the market, instead of going down, goes way up... You might lose a lot of money on this position.

Hey,

I hope this is the correct place to ask. I've got a qusetion about your situation 2 (Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short sell with $1000.00)). Why does the balance drop down from 1000$ to 0$ if I sell short? From your explanation, I understood that I borrow BTC from the vendor to sell them and pay back my "credit". But why do those 1000$ get removed that were there in the situation 1 before? I didn't buy BTC, I borrowed them - so why did I pay 1000$?

Would be nice if you could explain that to me!

butor commented

Hi @Mayesters

The $1000 used while short selling are the initial margin. Blackbird is configured so that the initial margin is 100%.

We could use leverage to lower the margin: I think Bitfinex offers leverage up to 2.5:1. But while you hold the short position the market will move and having a 100% initial margin will mitigate the risk of getting margin calls if the price goes up.

Hey there! I'm completely new to fintech and in Finance whatsoever but I gained huge interests in the past couple of days. So I have rookie questions like I'm 5.

Stop me if I'm wrong but if I get it right, to start playing with Blackbird and make trades, I need at least 2000$ ($1000 on OKC + $1000 on Bitfinex) since the price of 1 BTC is around $1000 ($992 when writing). Am I correct?

If so, what is the thing with the $25 CashForTesting?

Plus, I've been watching logs for a day to get a sense of all of it. I see OKCoin/Bitfinex with a delta inferior to -0.8 about 90% of the time. Am I right thinking that if Blackbird could handle OKCoin shorts, we could trade Bitfinex/OKCoin? Or it's not that simple?

Tell me if I should not have continued on this thread.


NB: This comment of yours is great but I'd like to bring a clarification that might be obvious for you but is not for some neophyte like me and took me some time to get. So I share it here for the next rookie reading this thread.

You say:

Situation 2
OKCoin BTC@$290.00
Bitfinex BTC@$310.00
Opportunity ($20.00 spread): system 0% cash, but still no market risk since long/short.
Balance on OKCoin: 0.00 USD, 3.4483 BTC (buy for $1000.00)
Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short sell with $1000.00)

Then you say:

Situation 4
OKCoin BTC@$200.00
Bitfinex BTC@$200.00
Exit opportunity: we close the long and short positions.
Balance on OKCoin: 689.66 USD, 0.0000 BTC
Balance on Bitfinex: 1354.84 USD, 0.0000 BTC

That was mystical to me. I got the lost with OKC but I had trouble figuring where the 354.84 USD came from.

So, if I got it right, in situation 2:

  • I owe Bitfinex 3.2258 BTC for which I gave $1000.
  • I sell those 3.2258 BTC on the market which gives me back my $1000.
  • When I close the trade at situation 4, I buy 3.2258 BTC at 200$, which costs me $645,16 and give this BTC to Bitfinex. At this point, does Bitfinex gives me back my $1000 I gave him first to borrow the BTC? I don't see how it could not be, otherwise I don't get where I am winning in this.
butor commented

I need at least 2000$ ($1000 on OKC + $1000 on Bitfinex) since the price of 1 BTC is around $1000 ($992 when writing).

You don't need $2000 because you can buy a fraction of a bitcoin. As a best practice, with Blackbird I recommend sending orders of at least $10 because otherwise the orders might get rejected by some exchanges.

what is the thing with the $25 CashForTesting?

CashForTesting is used to limit your exposure to $25, regardless what you have on your USD accounts.

I see OKCoin/Bitfinex with a delta inferior to -0.8 about 90% of the time. Am I right thinking that if Blackbird could handle OKCoin shorts, we could trade Bitfinex/OKCoin?

Yes this is correct.

Regarding your last question: your rationale is correct, but the situation 4 is automatic. You have a debt of 3.2258 BTC towards Bitfinex. When you decide to close the position, Bitfinex will buy 3.2258 BTC at market price ($200) and gives you the difference.
You sold 3.2258 BTC for $1000 and bought them back for $645.16. Bitfinex gives you the difference when the position is closed: $1000-$645.16 = $354.84.

$354.84 is your profit on the operation, which is added to your initial margin: $354.84 + $1000 = $1354.84 on your account.

Note: to simplify, the trading and lending fees are not taken into account in this example.

Hello Butor,

It seems like both of the two exchanges need to support Margin Trading for short-sell, is it correct? In that case we don't have many choices of the trading platforms.

butor commented

No, just the short one needs margin trading. Not the long one.
As for now we can only capture opportunities when Bitfinex is the short exchange, because it's the only one implemented for short-selling.

I think you'd need to short-sell on another platform at some point.

Let's use your example:

===============
Situation 1
OKCoin BTC@$300.00
Bitfinex BTC@$300.00
No opportunity, system 100% cash, no market risk.
Balance on OKCoin: 1000.00 USD, 0.0000 BTC
Balance on Bitfinex: 1000.00 USD, 0.0000 BTC

Situation 2
OKCoin BTC@$290.00
Bitfinex BTC@$310.00
Opportunity ($20.00 spread): system 0% cash, but still no market risk since long/short.
Balance on OKCoin: 0.00 USD, 3.4483 BTC (buy for $1000.00)
Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short sell with $1000.00)

Now the Bitcoin market plummets, but the $20.00 spread is still here.

Situation 3
OKCoin BTC@$180.00
Bitfinex BTC@$200.00
There is still a spread. No action taken.
Balance on OKCoin: 0.00 USD, 3.4483 BTC (long)
Balance on Bitfinex: 0.00 USD, -3.2258 BTC (short)

Now the spread closes:

Situation 4
OKCoin BTC@$200.00
Bitfinex BTC@$200.00
Exit opportunity: we close the long and short positions.
Balance on OKCoin: 689.66 USD, 0.0000 BTC
Balance on Bitfinex: 1354.84 USD, 0.0000 BTC

===============

Situation 5
OKCoin BTC@$230.00 //Now the price on Okcoin is higher, what should Blackbird do?
Bitfinex BTC@$200.00

If you don't take actions at all, you will lose a lot of trade chances.

butor commented

That's correct. We can only trade opportunities where Bitfinex is higher than the other exchange. So in Situation 5, Blackbird would do nothing.

Thanks for the confirmation.

As for now we can only capture opportunities when Bitfinex is the short exchange, because it's the only one implemented for short-selling.

@butor so will Blackbird not work for U.S. users? I thought Bitfinex has disabled margin trading for U.S. users?

butor commented

@litwi1rm you are correct, unfortunately.

Hey guys,

just curious. What if we go short on Bitfinex and then the price goes up and we get a margin call before discrepancy between exchanges converges?

I guess there should be a safety margin for us to have time to transfer BTCs to Bitfinex to close short position manually just in case.

Would it be possible to use BTC as the baseline currency instead of USD? In other words, trade the BTC/ETH or other Alt Coin pairs, and exclude the USD all together. This would make many more exchanges available for the short sell side.

butor commented

@mkutny To minimize the risk of margin calls, we have a margin account of 100%: if you have $2,000 on your Bitfinex margin account, Blackbird will short sell up to $2,000. That being said, there is no mechanism implemented to handle margin calls if they did occur (which is unlikely).

@shibley It's not possible for the moment, but we are moving in that direction. See issue #193.

Kraken allows shorting with up to a 5:1 margin now, so theoretically you can always cover your arbitrage position, or am I missing something?

(Numbers exaggerated to keep my brain from melting :)

Gemini: $2000
Kraken: $5000 <<==== this is what you expect to return after sell on Kraken
Opportunity is $3000 net gain

Buy Gemini -- 1 BTC for $2000 USD
Short Kraken -- Borrow and sell -- 1 BTC @ $5000 with a 1:1 margin

Send Gemini -- 1 BTC =========> 4min to 4hrs! =========> Recieve Kraken -- 1 BTC

  1. KRAKEN MARKET GOES UP by $1000
    Close Short Kraken -- Buy back and return 1 BTC @ $6000
    $5000 sell price - $6000 buy back price = ($1000 loss)
    Sell Kraken -- 1 BTC @ $6000 return = $6000 more than target
    $6000 + ($1000 loss) = $5000 <==== what you expect correct?

  2. KRAKEN MARKET GOES DOWN by $1000
    Close Short Kraken -- Buy & return to exchange -- 1 BTC @ $4000
    $5000 sell price - $4000 buy back price = $1000 left over for daddy
    Sell Kraken -- Sell 1 BTC @ $4000 return = ($1000 less than target)
    $4000 + $1000 gain = $5000 <==== what you expect correct?

--
Somebody, please poke holes in this because I must be missing something.

@flavioespinoza also waiting for those poked holes :)

@mikefogg @flavioespinoza I'll take a poke. You didn't discover the hole in your theory, because you didn't think about what happens next.

Let's assume scenario 1 happened. Let's also assume the BTCUSD price at Gemini didn't move.

So now you're sitting happy with a $3000 profit at Kraken. Let's assume you had $2000 stored at Gemini at the start to trade with.

So now after your trade you have:

Rates:
Gemini: BTCUSD $2000
Kraken: BTCUSD $6000

Balances:
Gemini: 0 BTC, 0 USD
Kraken: 0 BTC, 10000 USD

What now?

@casper @mikefogg I only end up with $5000 on Kraken, and $0 on Gemini -- just to be clear. After the trade, I have $5,000 USD on Kraken and $0 on Gemini. Which means I have $3000 more than I had before on both of them combined.

I apologize if I made the mistake of saying I had any USD on Kraken at the start. I didn't. I had $0 on Kraken and $2000 on Gemini.

I start with $2000 on Gemini and buy 1 BTC. I send it to Kraken and sell 1 BTC for $5000 without hedging. That leaves me with $5000 return. $5000 - $2000 = $3000 profit.

@casper @mikefogg but I see I would have to have to have money on Kraken to hedge. Thanks for poking holes in this! :)

@butor what about a case where we've already opened the trades on both the exchanges, and now instead of converging the spread start diverging? wouldn't we be start losing money?

@alpha0geek
A spread naturally tends to close, since many trader make massive arbitrage between exchanges, sometimes with much more aggressive techniques than Blackbird, with much more volume. A spread can survive as long as there is some volatility (and can even close before), but closes when traders see a spread between exchanges but low risk.
If a spread diverge, then we have opened a position too soon and could've made more money (If we had waited for the spread to be wide open). But, if we stay on market until the spread close, and it eventually will, we make the expected profit, only a little later.

@mhuusko5 - You can lose money if the spread closes within $2 which will most likely not cover your buy, sell, and open, close fees if you invest under $2500 (or about 8 ETH coins or 0.5 BTC) in my experience.

@flavioespinoza But Blackbird does take all these fees into account when entering a market, right?

@bertrandfalguiere @butor
Hi
regarding the diverging spread and it's lost opportunity: In this case could Blackbird not place a second order (while an extra 'TestedExposure' and 'SpreadEntry' or 'SpreadTarget' is defined for this case)?
I see there normally is no reason to define two different max-exposures, but there could be if one reserves an amount for manual trading.

After you open a short position in Bitfinex @$4100 and a long position in Kraken at @4000. Can you transfer the bitcoin from Kraken to Bitfinex to 'settle' the short position? Or do must you purchase a bitcoin in Bitfinex thru their exchange to cover the short?

@leunghay After you open a short position in Bitfinex @$4100 and a long position in Kraken at @4000. Can you transfer the bitcoin from Kraken to Bitfinex to 'settle' the short position? Or do must you purchase a bitcoin in Bitfinex thru their exchange to cover the short? would be great to get an answer for this one :)

Don't the exchange fees pretty much kill any opportunities here? .25% in and .25% out on TWO exchanges. Thus the spread\opportunity has to be greater than 1% to realize any profits. No?

Do you think it can be applied to any pairs? BTC/BHC, BTC/ETH?

@christiec1

Don't the exchange fees pretty much kill any opportunities here? .25% in and .25% out on TWO exchanges. Thus the spread\opportunity has to be greater than 1% to realize any profits. No?

Blackbird already takes this fact into account, see the SPREAD TARGET parameter:

This is the targeted profit. It represents the net profit and takes the exchange fees into account. If SpreadEntry is at 0.80% and trades are generated at that level on two exchanges with 0.25% fees each, Blackbird will set the exit threshold at -0.70% (0.80% spread entry - 4x0.25% fees - 0.50% target = -0.70%)

@bertrandfalguiere

But, if we stay on market until the spread close, and it eventually will, we make the expected profit, only a little later.

That, unless you get margin called right?

Hello @butor ,

I have a question about how Blackbird works. While explaining how it works above, you said,

Now we wait until the discrepancy decreases:

However, in some exchanges, like Quadriga and GDAX, there is almost always a significant discrepancy. What does the bot do in this case? In theory, bot cannot work profitable when the discrepancy is stable? I'm asking because I'm planning to test it in Quadriga. Your insights will be appreciated.

Hi @butor

What does a margin account of 100% mean? How much must the price go up before you get a margin call?

I'm new to this, and this may sound stupid, but this whole premise is based on "borrowing shares from a broker." How do we short-sell shares we don't own? Where are we "borrowing" BTC?

@butor
Thank you so much for this code. I understand your logic of market-neutral. But can I feed historical data to this code and test it? If yes, then what is the best way for that? Because I am scared of losing money in short trading. I want to test it before I put actual money in this.

Thanks again.

butor commented

@priyanka1773

can I feed historical data to this code and test it?

Not, backtest capabilities haven't been implemented for now (see db code here).

butor commented

@pur3substance

How do we short-sell shares we don't own? Where are we "borrowing" BTC?

We are borrowing from the exchanges that offer that feature, against a fee.

From Wikipedia:

In our case the lender is the exchange, where it can be other people wanting to lend their bitcoin against an interest rate (see OKCoin implementation for borrow_money). This is usually all managed by the exchanges.

butor commented

@GerhardLiebenberg

What does a margin account of 100% mean? How much must the price go up before you get a margin call?

It means that there won't be any margin call until the market price doubles.

butor commented

@aekanman

I have a question about how Blackbird works. While explaining how it works above, you said, now we wait until the discrepancy decreases. However, in some exchanges, like Quadriga and GDAX, there is almost always a significant discrepancy. What does the bot do in this case? In theory, bot cannot work profitable when the discrepancy is stable?

@alpha0geek

what about a case where we've already opened the trades on both the exchanges, and now instead of converging the spread start diverging? wouldn't we be start losing money?

The basic principle of our arbitraging strategy is capturing temporary discrepancies between exchanges. Temporary, because in an efficient market there should be one unique BTC/USD price offered across all the exchanges.

So when a divergence comes up between two exchanges then it is likely, but not certain, that the prices will converge at some point. If there is no convergence (per @aekanman) or worst, the divergence continues to expand (per @alpha0geek), then yes Blackbird will lose money if you manually close the positions.

This non-convergence can happen for reasons that are outside the market itself: an exchange is going bankrupt, an exchange doesn't allow USD withdrawal anymore, or an exchange significantly increase its trading fees.

Of course it's not something that can be managed through Blackbird, but you can limit the risk by only using exchanges with exceptional reputation (easier said than done), or maybe only exchanges from the same country.

Basically it can be done with any 2 coins(I mean no USD or USDT), however no shorting is available at most of crypto exchanges.

So let's say my goal is to accumulate both ETH and BTC, then I need to keep some amount of ETH and BTC at both exchanges in order to make money(and most likely rebalance them from time to time by sending some coins back and forth). Could you give a tip on this one?

@butor has these numbers changed as the BTC value and amount of transactions increased?
You mentioned this way back in Jan 2017, when BTC trading was less common than now, and BTC/USD rate was different.

Regarding your second question, the profit is a percentage of your exposure so there is no minimal budget. However, you need at least $10 (parameter TestedExposure) otherwise some exchanges might reject your orders.

@alfonsoperez thank you for this explanation. I just wish I understood it. :-)

Don't the exchange fees pretty much kill any opportunities here? .25% in and .25% out on TWO exchanges. Thus the spread\opportunity has to be greater than 1% to realize any profits. No?

Blackbird already takes this fact into account, see the SPREAD TARGET parameter:

This is the targeted profit. It represents the net profit and takes the exchange fees into account. If SpreadEntry is at 0.80% and trades are generated at that level on two exchanges with 0.25% fees each, Blackbird will set the exit threshold at -0.70% (0.80% spread entry - 4x0.25% fees - 0.50% target = -0.70%)

For

OKCoin BTC@$290.00
short_exchange BTC@$310.00

Why do we buy $1000 in both instead of 3 BTC(same amounts) in both exchanges? When do we use same amount in hedge? When do we use same money in hedge?

Can we use future to achieve market neutral strategy in this project?

butor commented

Hi @Jay54520

Why do we buy $1000 in both instead of 3 BTC(same amounts) in both exchanges? When do we use same amount in hedge? When do we use same money in hedge?

Because we want to be market-neutral on USD, not BTC. So we need to have the same USD notional on both sides.

Can we use future to achieve market neutral strategy in this project?

Yes that would be possible. But last time I checked there was no robust API to trade futures automatically like we do. Maybe that has changed since.

We can do market-neutral on USD for either same quote(USD) amount or base(symbol) amount.

Same base amount

  1. Profit in long_exchange: base_amount * (long_exchange_sell_price - long_exchange_buy_price)
  2. Profit in short_exchange: base_amount * (short_exchange_sell_price - short_exchange_buy_price)

1 + 2 =
base_amount * (l_sell + s_sell - l_buy - s_buy)

If s_sell > l_buy, l_sell <= s_buy, so the profit > 0; If s_sell = l_sell, s_buy = l_buy, the profit = 0.

Same quote amount

  1. long_exchange: quote_amount / long_exchange_buy_price * (long_exchange_sell_price - long_exchange_buy_price)
  2. short_exchange: quote_amount / short_exchange_sell_price * (short_exchange_sell_price - short_exchange_buy_price)

Total profit = 1 + 2

= quote_amount * (long_exchange_sell_price / long_exchange_buy_price - short_exchange_buy_price / short_exchange_sell_price)

If s_sell > l_buy, l_sell <= s_buy, so the profit > 0; If s_sell = l_sell, s_buy = l_buy, the profit = 0.

Is Bitfinex still the only market that allows short trading? I am now reading that they have a minimum balance of $10,000 to activate your account, which is a little bit more than I want to invest in this.

Can anyone share what percentage their profits have been from using this? If it is even higher than a bank's interest, using this bot could be my new savings account.

Is Bitfinex still the only market that allows short trading? I am now reading that they have a minimum balance of $10,000 to activate your account, which is a little bit more than I want to invest in this.

A couple of disclaimers:

  1. I'm writing my own bot based on the concepts Blackbird uses. It's not open source (yet) and hasn't been allowed to make any live trades (yet).
  2. I don't endorse or have any affiliation with either of the exchanges I'm about to mention aside from being a customer.

US based customers can short on Kraken and liquid.com. I am using both of those plus a few others which don't allow margin trading to get a good array of exchange pairs and currency pairs to search for opportunities on. Neither of those requires a large deposit to get started.

At the moment I see the price of Bitfinex always above most brokers, if it stays that way, without prices being the same in 2 brokers, is this strategy ineffective?

@tretonis Blackbird's strategy only works if the baseline assumption holds true: that two exchanges with different prices will tend to equalize with one another. Usually this is true due to arbitrage action, but crypto markets are still so small that it can sometimes take a long time. If you find that one exchange is always significantly higher than others, you could consider some "manual" arbitrage. Buy on a cheap exchange, transfer to the expensive one and sell there.

Has this program been shutdown? I no longer see any conversation past 2019. I wanted to look into this program but I am unable to get it to download. Can anyone tell me if it is still possible to do so?