Bitcoin Forum
May 12, 2024, 12:07:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 3 4 5 6 7 8 [All]
  Print  
Author Topic: Bitcoin arbitrage on GitHub: ~2% monthly return, market-neutral long/short  (Read 38227 times)
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 11, 2015, 05:43:58 PM
Last edit: February 05, 2016, 04:22:43 AM by butor
 #1

Hi guys,

I just released the C++ code of my Bitcoin exchange arbitrage system that generates a ~2% monthly return with a USD 2,000 exposure.

I think you guys might be interested in seeing how arbitrage can work with Bitcoin exchanges.

The full code is on the following GitHub page: https://github.com/butor/blackbird. I tried to write a pretty complete Readme file that explains the arbitrage mechanism.

It is also a good way to see how you can connect a C++ system to two Bitcoin exchanges (Bitfinex and OKCoin) using JSON and base64 encoding.

Please let me know what you think. I will try to find C++ contributors that will be able to improve the code and connect to new exchanges.

I hope it can help you understand and actually test how arbitrage between Bitcoin exchanges works.

Here is a quick real life example where arbitrage can occur because of market inefficiency between Bitfinex and Bitstamp in November 2014 (between the two vertical gray lines):

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715472428
Hero Member
*
Offline Offline

Posts: 1715472428

View Profile Personal Message (Offline)

Ignore
1715472428
Reply with quote  #2

1715472428
Report to moderator
1715472428
Hero Member
*
Offline Offline

Posts: 1715472428

View Profile Personal Message (Offline)

Ignore
1715472428
Reply with quote  #2

1715472428
Report to moderator
1715472428
Hero Member
*
Offline Offline

Posts: 1715472428

View Profile Personal Message (Offline)

Ignore
1715472428
Reply with quote  #2

1715472428
Report to moderator
DeboraMeeks
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500


View Profile
March 11, 2015, 05:47:03 PM
 #2

Don't know much about C++ language, but all I can say is, I might try this out with a few bucks.
You said 2% return with USD 2k exposure, so can't I try this out with some less amounts just to check out, only want to make a check with some play money (I mean what I can afford to lose). Wink
Amph
Legendary
*
Offline Offline

Activity: 3206
Merit: 1069



View Profile
March 11, 2015, 06:15:43 PM
 #3

with other exchanges, the 2% can be raised or this is the best the bot can do?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 11, 2015, 06:36:34 PM
 #4

For the moment the system can only connect to Bitfinex and OKCoin. The project is really work in progress but I think it's a good practical example to understand how arbitrage works. I'm currently looking for C++ developers to help me out with the project.

I will also improve the documentation on how to test it "out of the box". Currently to use it you need to understand and edit a little bit the source code (work in progress I told you Wink )

If you do want to test it, yes please try with a low amount of cash. I did all my testing with a $10.00 exposure. So please only put a low amount of money on your Bitfinex and OKCoin trading accounts. My monthly returns are surprisingly constant: between 1.7% and 2.3%. Of course I cannot guarantee these returns under any circumstances. My average activity so far is 8 trades per month with the system running 24/7.

I'm pretty confident the system would be able to generate better returns with new exchange connections, specially to Bitcoin exchanges that allow short selling. The system is able to test all the possible long/short combinations for a given set of exchanges. So more exchanges really means more arbitrage opportunities.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 12, 2015, 02:28:47 PM
 #5

Indeed. That's what I'm looking for, specially with exchanges that offer short selling. As I said earlier the software tests all the possible long/short combinations between the given exchanges.

The current situation is this one, with an exchange A (Bitfinex) that offers short selling and an exchange B (OKCoin) that doesn't offer short selling:
  • A short selling OK
  • B short selling NOK

In this case we only have one combination to test:
  • short A / long B

Now let's add a new exchange C that doesn't allow short selling. We now have:
  • A short selling OK
  • B short selling NOK
  • C short selling NOK

And the software will automatically test the two following combinations:
  • short A / long B
  • short A / long C

But now let's suppose C actually offers short selling:
  • A short selling OK
  • B short selling NOK
  • C short selling OK

In this case we will automatically test four combinations:
  • short A / long B
  • short A / long C
  • short C / long A
  • short C / long B


However, the selected Bitcoin exchanges have to offer good liquidity to make sure our orders will be executed quickly. I'm currently working on a mechanism that will adapt the limit orders sent based on the real-time bid/ask offers.

If you guys know a C++ developer that would be interested in participating in a nice arbitrage project then 100% of the code is on the GitHub page (https://github.com/butor/blackbird).

joesmoe2012
Hero Member
*****
Offline Offline

Activity: 882
Merit: 501


Ching-Chang;Ding-Dong


View Profile WWW
March 12, 2015, 02:56:14 PM
 #6

Added it to my list of trading robots - http://easybitinvesting.com/bitcoin-trading/trading-robots/

Check out BitcoinATMTalk - https://bitcoinatmtalk.com
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 12, 2015, 03:26:35 PM
Last edit: March 12, 2015, 07:32:07 PM by butor
 #7

I do not know a C++ coder but Im looking to hire a meteor eveloper to make an arbitrage trading tool developer for bitcoinpricelab[dot].com
Check out that website, I have a simple overview of markets. Im looking to get a much advanced version which helps traders

Thank you for the link. I noticed that you do your arbitrage by buying bitcoin on an exchange and selling bitcoin on another exchange. You don't use short selling and this is a fondamental difference: on my side my system is completely market-neutral. This means that it's not impacted by the Bitcoin price fluctuation at all. And this is a huge advantage.

Here is how it works, current Bitcoin quotes in blue:

OKCoin BTC@$300.00
Bitfinex BTC@$300.00
No opportunity, system 100% cash, no market risk:
  • On OKCoin: 1000.00 USD, 0.0000 BTC
  • On Bitfinex: 1000.00 USD, 0.0000 BTC

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

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

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

Now the spread closes:

OKCoin BTC@$200.00
Bitfinex BTC@$200.00
Exit opportunity: we close the long and short positions and we get:
  • On OKCoin: 689.66 USD, 0.0000 BTC
  • 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 thought during the trade the market lost 33%, we made a 2.2% profit (trading fees not considered). As you can see being market-neutral is a huge advantage when the market is bearish.
tomii
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
March 12, 2015, 09:25:34 PM
Last edit: March 12, 2015, 09:42:16 PM by tomii
 #8

hello! sounds really nice i like it! i wanna test it but im not that confident with programmin
i have a debian Server, but never compiled somethin myself
do i have to config in source code? if yes where?
and which libarys are needed to make?



e: ok i got it... not that hard..  but adding other exchanges i would need help Smiley
funtotry
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


Ever wanted to run your own casino? PM me for info


View Profile
March 12, 2015, 09:31:15 PM
 #9

Interesting script but how would the funds be transferred between exchanges? Your script can't possibly automated bitcoin transactions and send it, including checking for deposit addresses and that. How does that work?

Jamacn
Full Member
***
Offline Offline

Activity: 236
Merit: 100



View Profile
March 13, 2015, 01:51:56 AM
 #10

only 2 exchanges, if is it can be kade best profits?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 13, 2015, 02:12:57 AM
 #11

hello! sounds really nice i like it! i wanna test it but im not that confident with programmin
i have a debian Server, but never compiled somethin myself
do i have to config in source code? if yes where?
and which libarys are needed to make?

Yes the project is not very user-friendly for the moment and I apologize for that. But please read the section How to test Blackbird to see how you can compile it. Once you succeed to start it everything else will be automatic.

Good luck
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 13, 2015, 02:45:49 AM
Last edit: March 13, 2015, 03:09:09 AM by butor
 #12

Interesting script but how would the funds be transferred between exchanges? Your script can't possibly automated bitcoin transactions and send it, including checking for deposit addresses and that. How does that work?

That's the best part! Wink There is absolutely no transfer between the exchanges. Please read the example I gave earlier with the $20 spread. You will see that there is no transfer in cash or in Bitcoin between the exchanges at any time. I hope my example is clear enough to understand the arbitrage mechanism.


That being said, a cash rebalancing might need to be done when two specific conditions are met:
  • the market is either only bullish (up) or only bearish (down), and
  • the arbitrage opportunity is always the same over and over (e.g. short Bitfinex / long OKCoin)

In this case we can have after a while a situation where the available cash is not well balanced, e.g:
  • On OKCoin: 436.11 USD, 0.0000 BTC
  • On Bitfinex: 1829.08 USD, 0.0000 BTC

The above example can occur when the market is bearish and we are always long on OKCoin (so we systematically lose money because of the bear market) and short on Bitfinex (so we systematically make money because of the bear market).

Note that in this example the system will enter the next arbitrage opportunity with the lowest amount of cash: $436.11. So the total exposure for that new trade will be only 2 * $436.11 = $872.22 even though the total amount of available cash is $436.11 + $1829.08 = $2265.19.
Therefore it would be a good idea to rebalance the cash between the exchanges to have:
  • On OKCoin: 1132.59 USD, 0.0000 BTC
  • On Bitfinex: 1132.60 USD, 0.0000 BTC

Gebbit
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
March 13, 2015, 12:26:36 PM
 #13

Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.

It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.

Please explain to me where my logic falters.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 13, 2015, 03:15:19 PM
Last edit: March 13, 2015, 04:41:38 PM by butor
 #14

Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.

It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.

Please explain to me where my logic falters.

The profit is always on the fiat side. See the simple example I wrote earlier.

As I said, the biggest advantage of arbitrage is the independence of the market direction. The goal is to generate a constant profit regardless of the market direction. So yes you will miss opportunities from a bull market but your investment will be safe during a bear market. It's a choice.

The largest risk is if the spread between two exchanges never closes for some reasons or if an exchange goes bankrupt like Mt. Gox.

If you are interested, here is a good Wall Street example where the spreads didn't close as expected during arbitrage investments:
Long-Term Capital Management L.P.
area
Full Member
***
Offline Offline

Activity: 177
Merit: 100


View Profile
March 14, 2015, 05:35:18 PM
 #15

I suppose the obvious question to ask here is why make it public, if it's making you money?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 14, 2015, 08:10:25 PM
 #16

I suppose the obvious question to ask here is why make it public, if it's making you money?

For the moment I get a 2% monthly profit for a USD 2,000 exposure. It means that I make about USD 40 per month... Nothing too crazy and I don't know how long it will last.

If I want to invest more money I will need to develop a mechanism to check that there is enough liquidity for my limit orders to be executed before they are sent. I am working on a mechanism that reads the order books of the two involved exchanges. If and only if there is enough liquidity on both exchanges then the trades are generated.

But more that than I like the challenge of building automatic systems. I like to see my system live, sending orders automatically. But I want to improve it (new exchange connections, order books analysis, failover, etc) and I'm not a professional C++ developer. My goal is to find C++ guys that would be interested in contributing. Also, the system is pretty fast and securely connected to Bitcoin exchanges using C++ libraries and in the future I hope to make it a good example for the open source community (not really the case right now...  Tongue).
Gebbit
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
March 16, 2015, 03:37:43 PM
 #17

Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.

It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.

Please explain to me where my logic falters.

The profit is always on the fiat side. See the simple example I wrote earlier.

As I said, the biggest advantage of arbitrage is the independence of the market direction. The goal is to generate a constant profit regardless of the market direction. So yes you will miss opportunities from a bull market but your investment will be safe during a bear market. It's a choice.

The largest risk is if the spread between two exchanges never closes for some reasons or if an exchange goes bankrupt like Mt. Gox.

If you are interested, here is a good Wall Street example where the spreads didn't close as expected during arbitrage investments:
Long-Term Capital Management L.P.


In that case the yearly return is less than 30% and judging by what happened to bitcoin platforms in previous years it has been a negative return. That is because the risk of default from these places was far greater than the 30% return. And have not most major currencies inflated greatly the past year? It seems a lot of extra work and risk to slightly beat out the most transparent stocks in Western countries.
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
March 16, 2015, 03:59:51 PM
 #18

Added it to my list of trading robots - http://easybitinvesting.com/bitcoin-trading/trading-robots/



I had never seen this list before, thanks for sharing. I bookmarked the page for future reference.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 16, 2015, 10:01:29 PM
 #19

In that case the yearly return is less than 30% and judging by what happened to bitcoin platforms in previous years it has been a negative return. That is because the risk of default from these places was far greater than the 30% return. And have not most major currencies inflated greatly the past year? It seems a lot of extra work and risk to slightly beat out the most transparent stocks in Western countries.

Are you saying that, according to you, more than 30% of the current Bitcoin exchanges will go bankrupt within one year from now? Did that happen in the past? Note that I'm only considering the large exchanges that offer enough liquidity to do short-term trading.

Even if it's true, the impact of that default risk is pretty much the same whether you are on an arbitrage strategy or a buy and hold strategy.

hgerson
Full Member
***
Offline Offline

Activity: 251
Merit: 100


View Profile
March 18, 2015, 01:57:03 AM
 #20


Very interesting concept.

I hope you don't abandon it.
Mieehayii
Hero Member
*****
Offline Offline

Activity: 490
Merit: 500



View Profile
March 19, 2015, 05:12:29 AM
 #21

thank you, i will take it a look.

███████████████████████████████████████████████████████████████████▀███▀████
████████████████████████████████████████████████████████████████████▄▀▄█████
███████████████████████████████████████████████████████████████████▀▄█▄▀████

███▀▀▀▀▀▀▀▀██████▀▀▀████████▀▀▀██▀▀▀███████████▀▀▀██▀▀▀▀▀▀▀▀████████▀▀▀█████
███          ▀███   ████████   ██    ▀█████████   ██           ▀████   █████
███   █████▄   ██   ████████   ██      ▀███████   ██   ██████▄   ███   █████
███   ██████   ██   ████████   ██   █▄   ▀█████   ██   ████████   ██   █████
███   █████▀   ██   ████████   ██   ███▄   ▀███   ██   ████████   ██   █████
███          ▄███   ▀██████▀   ██   █████▄   ▀█   ██   ███████▀   ██   █████
███   ▄▄▄▄▄███████   ▀▀▀▀▀▀   ███   ███████▄      ██   ▀▀▀▀▀▀   ▄███   █████
███   █████████████▄        ▄████   █████████▄    ██        ▄▄▄█████   █████
████████████████████████████████████████████████████████████████████████████
████████████████████████████████████████████████████████████████████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
.Any Store Can Buy, Sell and Accept Cryptocurrency.██
██
██
██
██
██
██
██
██
██
██
██
██
[[[ Whitepaper    Twitter     Facebook]]]
[[[  Telegram      Medium     Youtube ]]]
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
March 19, 2015, 07:55:59 AM
 #22

Even if it's true, the impact of that default risk is pretty much the same whether you are on an arbitrage strategy or a buy and hold strategy.
Not true strictly as you can buy limited amount (say $1000) at a time and transfer bitcoin off the exchange. So you are only exposed to $1000 exchange risk but may be holding $10 000 worth of bitcoin in your own wallet.

The problem with arbitrage is you are always risking your principal on 2 exchanges.  You need the full amount on exchange to do the arbitrage and to maximise profits that are usually a small % of principal.  So if one of them goes you lose half your principal.

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 19, 2015, 01:01:26 PM
Last edit: March 19, 2015, 01:19:13 PM by butor
 #23

Very interesting concept.

I hope you don't abandon it.

Thank you. I won't. My goal now is really to find C++ enthusiasts that can help me improve the code quality and build new stuff.


Not true strictly as you can buy limited amount (say $1000) at a time and transfer bitcoin off the exchange. So you are only exposed to $1000 exchange risk but may be holding $10 000 worth of bitcoin in your own wallet.

This is not a buy and hold strategy.


The problem with arbitrage is you are always risking your principal on 2 exchanges.  You need the full amount on exchange to do the arbitrage and to maximise profits that are usually a small % of principal.  So if one of them goes you lose half your principal.

Actually the risk assessment is the same: twice the risk but only of half your investment.

The interesting question here is: in case of an exchange default, do you consider that you're going to lose 1) only your Bitcoins or 2) all your Bitcoins and all your cash on that exchange?

  • case 1: arbitrage is less risky than buy and hold since in arbitrage you spent lots of time in cash.
  • case 2: this is a real problem with arbitrage because if you want to do arbitrage on, say, 8 exchanges with $1000 cash on each then your total exposure to exchange default is $8000 even though your long/short Bitcoin exposure will be only $2000 at a time.


spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
March 19, 2015, 02:33:15 PM
 #24

...
Not true strictly as you can buy limited amount (say $1000) at a time and transfer bitcoin off the exchange. So you are only exposed to $1000 exchange risk but may be holding $10 000 worth of bitcoin in your own wallet.
This is not a buy and hold strategy.
The problem with arbitrage is you are always risking your principal on 2 exchanges.  You need the full amount on exchange to do the arbitrage and to maximise profits that are usually a small % of principal.  So if one of them goes you lose half your principal.

Actually the risk assessment is the same: twice the risk but only of half your investment.

The interesting question here is: in case of an exchange default, do you consider that you're going to lose 1) only your Bitcoins or 2) all your Bitcoins and all your cash on that exchange?

  • case 1: arbitrage is less risky than buy and hold since in arbitrage you spent lots of time in cash.
  • case 2: this is a real problem with arbitrage because if you want to do arbitrage on, say, 8 exchanges with $1000 cash on each then your total exposure to exchange default is $8000 even though your long/short Bitcoin exposure will be only $2000 at a time.
Buying and holding bitcoin should have less risk of exchanges crashing as you can hold your balance off exchange.  It has of course more price movement risk.  Not sure what you mean by buy and hold. 

Exchange risk is about losing both fiat and bitcoin balances.  These may have slightly different risks though.  But at some point an exchange can be completely gone in which case both balances will be gone.
Case 1: Arbitrage is less risky not because you spend time in cash, but because you are not taking views on prices and betting on that.
Case 2: Adding the exchanges distributes the risk.  This is good.  But of course typically you might end up with more total exposure, so it's a bit of a balance, as you point out. 

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
March 19, 2015, 02:43:38 PM
 #25

Buying and holding bitcoin should have less risk of exchanges crashing as you can hold your balance off exchange. 

I see your point now and yes you're perfectly right. You can keep your Bitcoin investment off exchange. Now I don't know whether a Bitcoin wallet also has a risk of default...  Tongue
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
May 31, 2015, 06:07:31 PM
 #26

For information I added a new exchange, Bitstamp, to my arbitrage system.

https://github.com/butor/blackbird
Lawk
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
June 09, 2015, 01:54:08 PM
 #27

Very cool stuff!

Couple of questions:

- Why C++? Maybe porting it to a Ruby or Python would give you more success in finding the coder you need?
- Any plans of adding USD/LTC? Since the framework is already there and all the major exchanges support it, why not add it too, it will increase the arbitrage opportunities a lot right?
- What other exchanges do you plan on adding? BTC-E? BTER?

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 10, 2015, 02:45:26 AM
 #28


Thats great progress. Do you have a donation address or anything as such?
Thank you Bitcoin Explorer it's always appreciated. Here is my address: 3NmAGEeRmbdeMyaNjUaASr9Dv2NEssmafY


Lawk to answer your three questions:

Why C++? Maybe porting it to a Ruby or Python would give you more success in finding the coder you need?
Because of the speed. C++ is the main language for this kind of automatic trading program in the industry anyway (quantitative trading, HFT, etc). As you probably know compiled languages are usually far more faster than interpreted languages like Python.
For the moment my program analyzes the market every 5 seconds (can be adapted) and simply computes then compares the spreads between the exchanges. But in the future I would like to add more features within these 5-second loops, e.g. check the short-term volatility or save all the data in a database. So it's good to know that speed shouldn't be an issue. But yes, C++ is a pretty challenging language.


Any plans of adding USD/LTC? Since the framework is already there and all the major exchanges support it, why not add it too, it will increase the arbitrage opportunities a lot right?
Yes and that's something I want to do. Doing arbitrage on multiple exchanges between multiple cryptocurrencies is a great project. Note that the cryptocurrencies have to be liquid enough to allow fast order execution.


What other exchanges do you plan on adding? BTC-E? BTER?
The next exchange will probably be Kraken. As for now, the bid/ask information from Kraken is displayed but the system won't trade it. Again, since the orders have to be quickly executed we need to only add exchanges that offer good liquidity.
Also, it's now possible to short sell on OkCoin so I will need to add that too.
tofm2
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
June 10, 2015, 09:46:36 AM
 #29

Hello, thanks for this work

I am trying to install it on my Linux mint 17 box but got this error message at make :

$HOME/blackbird-master > make
g++ -c -g -Wall -O2  base64.cpp -o base64.o
g++ -c -g -Wall -O2  bitcoin.cpp -o bitcoin.o
g++ -c -g -Wall -O2  bitfinex.cpp -o bitfinex.o
bitfinex.cpp: In function ‘bool Bitfinex::isOrderComplete(CURL*, Parameters, int)’:
bitfinex.cpp:91:68: error: ‘json_boolean_value’ was not declared in this scope
   isComplete = !json_boolean_value(json_object_get(root, "is_live"));
                                                                    ^
make: *** [bitfinex.o] Erreur 1


have you got any clues what went wrong

arunka71
Sr. Member
****
Offline Offline

Activity: 410
Merit: 257


View Profile
June 11, 2015, 07:24:45 PM
 #30

I'm more a java guy, but I'd be interested to discuss strategies and such with you. I also have quite some implementations for other exchanges.

At the moment, I'd like to get rid of the REST APIs and move on to FIX. Should be quicker, I guess.

PM me, if you are interested in any form of a collab.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
July 11, 2015, 03:27:22 PM
 #31

 
Just wanted to show you guys the actual output of an arbitrage trade if you are interested. It might help to understand the mechanism. Note that this is a real example with real money.

When we start the software it will first check the balances on all our Bitcoin exchanges. As you can see we don't have any Bitcoin (except a negligible amount on OKCoin) but only USD:

Blackbird Bitcoin Arbitrage
Version 0.0.2
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK.

[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.30%

[ Current balances ]
   Bitfinex:    1,299.15 USD   0.000000 BTC
   OKCoin:      1,318.32 USD   0.000582 BTC
   Bitstamp:    1,237.33 USD   0.000000 BTC
   Kraken:      0.00 USD       0.000000 BTC

After this initialization, the system starts to analyze all the spreads between Bitfinex, OKCoin, Bitstamp and Kraken every five seconds. It's only possible to short sell on Bitfinex and Kraken. The targets are different because the trading fees can vary depending on the exchange.

[ 07/10/2015 16:15:55 ]
   Bitfinex:    293.54 / 293.57
   OKCoin:      295.40 / 295.61
   Bitstamp:    291.40 / 292.43
   Kraken:      292.20 / 294.11
   ----------------------------
   Bitfinex/Kraken:     -0.47% [target  1.10%, min -0.47%, max -0.47%]
   OKCoin/Bitfinex:     -0.70% [target  1.00%, min -0.70%, max -0.70%]
   OKCoin/Kraken:       -1.15% [target  1.10%, min -1.15%, max -1.15%]
   Bitstamp/Bitfinex:    0.38% [target  1.10%, min  0.38%, max  0.38%]
   Bitstamp/Kraken:     -0.08% [target  1.20%, min -0.08%, max -0.08%]
   Kraken/Bitfinex:     -0.19% [target  1.10%, min -0.19%, max -0.19%]

[ 07/10/2015 16:16:00 ]
   Bitfinex:    293.54 / 293.57
   OKCoin:      294.65 / 295.28
   Bitstamp:    291.40 / 292.43
   Kraken:      292.20 / 294.11
   ----------------------------
   Bitfinex/Kraken:     -0.47% [target  1.10%, min -0.47%, max -0.47%]
   OKCoin/Bitfinex:     -0.59% [target  1.00%, min -0.70%, max -0.59%]
   OKCoin/Kraken:       -1.04% [target  1.10%, min -1.15%, max -1.04%]
   Bitstamp/Bitfinex:    0.38% [target  1.10%, min  0.38%, max  0.38%]
   Bitstamp/Kraken:     -0.08% [target  1.20%, min -0.08%, max -0.08%]
   Kraken/Bitfinex:     -0.19% [target  1.10%, min -0.19%, max -0.19%]

The software will continue to loop every five seconds, until there is an opportunity at 17:46:55: the spread between OKCoin (long) and Bitfinex (short) equals our 1.00% entry target:

[ 07/10/2015 17:46:50 ]
   Bitfinex:    286.67 / 286.87
   OKCoin:      284.24 / 284.25
   Bitstamp:    286.48 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   Bitfinex/Kraken:     -0.60% [target  1.10%, min -0.94%, max  0.29%]
   OKCoin/Bitfinex:      0.85% [target  1.00%, min -1.11%, max  0.92%]
   OKCoin/Kraken:        0.32% [target  1.10%, min -1.45%, max  0.95%]
   Bitstamp/Bitfinex:    0.06% [target  1.10%, min -0.59%, max  0.67%]
   Bitstamp/Kraken:     -0.46% [target  1.20%, min -0.60%, max  0.68%]
   Kraken/Bitfinex:     -0.20% [target  1.10%, min -1.22%, max  0.50%]

[ 07/10/2015 17:46:55 ]
   Bitfinex:    286.67 / 286.87
   OKCoin:      283.80 / 283.82
   Bitstamp:    285.94 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   Bitfinex/Kraken:     -0.60% [target  1.10%, min -0.94%, max  0.29%]
   OKCoin/Bitfinex:      1.00% [target  1.00%, min -1.11%, max  1.00%]

[ ENTRY FOUND ]
   Date & Time:       07/10/2015 17:46:55
   Exchange Long:     OKCoin (id 1)
   Exchange Short:    Bitfinex (id 0)
   Fees:              0.20% / 0.20%
   Price Long:        $283.82 (target)
   Price Short:       $286.67 (target)
   Spread:            1.00%
   Cash used:         $1,286.16 on each exchange

<OKCoin> Trying to send a "buy" limit order: 4.53@$284.10...
<OKCoin> Done (order ID: xx,xxx,xxx)

<Bitfinex> Trying to send a "sell" limit order: 4.49@$286.39...
<Bitfinex> Done (order ID: xxx,xxx,xxx)

Waiting for the two orders to be filled...
Done

Now that the orders are filled and that we are in the market, we are looking every five seconds for the spread to pass under our exit limit (-0.30%):

[ 07/10/2015 17:47:05 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    286.54 / 286.85
   OKCoin:      283.80 / 283.82
   Bitstamp:    285.94 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   OKCoin/Bitfinex:      1.07% [target -0.30%, min  1.07%, max  1.07%]

[ 07/10/2015 17:47:10 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    286.58 / 286.82
   OKCoin:      283.86 / 284.10
   Bitstamp:    286.02 / 286.60
   Kraken:      285.16 / 287.24
   ----------------------------
   OKCoin/Bitfinex:      1.04% [target -0.30%, min  1.04%, max  1.07%]

Then, at 19:04:10 the spread is under the exit limit (-0.32%). We close the two positions and compute the performance:

[ 07/10/2015 19:04:10 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    284.32 / 284.40
   OKCoin:      285.31 / 285.50
   Bitstamp:    284.29 / 285.00
   Kraken:      284.50 / 288.79
   ----------------------------
   OKCoin/Bitfinex:     -0.32% [target -0.30%, min -0.32%, max  1.07%]

[ EXIT FOUND ]
   Date & Time:       07/10/2015 19:04:10
   Duration:          77.25 minutes
   Price Long:        $285.31 (target)
   Price Short:       $284.40 (target)
   Spread:            -0.32%
   ---------------------------
   Target Perf Long:  0.12% (fees incl.)
   Target Perf Short: 0.39% (fees incl.)
   ---------------------------

BTC exposure on OKCoin: 4.522520
BTC exposure on Bitfinex: -4.486550

<OKCoin> Trying to send a "sell" limit order: 4.52@$284.40...
<OKCoin> Done (order ID: xx,xxx,xxx)

<Bitfinex> Trying to send a "buy" limit order: 4.49@$284.59...
<Bitfinex> Done (order ID: xxx,xxx,xxx)

Waiting for the two orders to be filled...
Done

New balance on Bitfinex:        1,303.81 USD (perf $4.66), 0.000000 BTC
New balance on OKCoin:          1,319.06 USD (perf $0.74), 0.000520 BTC
New balance on Bitstamp:        1,237.33 USD (perf $0.00), 0.000000 BTC
New balance on Kraken:          0.00 USD (perf $0.00), 0.000000 BTC

ACTUAL PERFORMANCE: $5.40 (0.21%)

The system can send us an e-mail with our trade:


So we made $5.40 (+0.21%) in about 1 hour and 17 minutes with an exposure of $2,572.32 and no market risk. Note that the $5.40 is the actual profit after fees. To make sure that all the fees are taken into account the $5.40 amount comes from a straight comparison between the Bitcoin accounts (before the trade and after the trade). +0.21% doesn't seem a lot but remember that with this mechanism you don't get any losing trades since the system always waits for the spread to close (which can take days).

We are currently using the parameters enter=0.20% (plus fees, in this example the fees were 0.80%) and exit=-0.30% that are narrower than a few months ago. The reason being that the Bitcoin volatility these weeks is pretty low. The system needs a volatile market so that arbitrage opportunities can occur. As you can see in the following chart the Bitcoin volatility is pretty low these days (~1.86%):


Our hope is that the Bitcoin volatility re-increases so the spreads can be wider again. The volatility is a key factor of success in this kind of strategy.

I hope this post helped you understand the long/short arbitrage mechanism.


arunka71
Sr. Member
****
Offline Offline

Activity: 410
Merit: 257


View Profile
July 11, 2015, 10:13:01 PM
 #32

I'm working on just this, but I'm using java for now. If you are interested in a collab, let me know.
mattsun
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 16, 2015, 08:11:23 PM
 #33

Hi, I'm really inspired by your job. But have a couple of questions about details of 'How it works'.
1. The 'short term' buy/sell, how is that operated? Do you buy BTC from an exchange (e.g. bitstamp), withdraw it from bitstamp then deposit to another exchange (e.g. bitfinex) and sell it? If that's the case, the long confirmation time might reduce the price difference or even switch the price position, how do you deal with that? If that's not the case, what do you mean by 'short sell'?
2. Still the 'short sell', so far as I know, bitstamp doesn't have an API for 'Instant Transaction', you can only place a buy/ask offer by API. How do you 'short sell'?
3. Do you always see the price position switch between the bitcoin exchanges you selected? I found some exchanges price position maintains the same all the time. For example, bitkonan's price are always higher than bitstamp.
4. The spreadEntry and spreadExit point, how do you decide the value? Do you have any reference or analysis behind?

Thanks. Smiley
Blawpaw
Legendary
*
Offline Offline

Activity: 1596
Merit: 1027



View Profile
August 17, 2015, 04:21:20 AM
 #34


Just wanted to show you guys the actual output of an arbitrage trade if you are interested. It might help to understand the mechanism. Note that this is a real example with real money.

When we start the software it will first check the balances on all our Bitcoin exchanges. As you can see we don't have any Bitcoin (except a negligible amount on OKCoin) but only USD:

Blackbird Bitcoin Arbitrage
Version 0.0.2
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK.

[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.30%

[ Current balances ]
   Bitfinex:    1,299.15 USD   0.000000 BTC
   OKCoin:      1,318.32 USD   0.000582 BTC
   Bitstamp:    1,237.33 USD   0.000000 BTC
   Kraken:      0.00 USD       0.000000 BTC

After this initialization, the system starts to analyze all the spreads between Bitfinex, OKCoin, Bitstamp and Kraken every five seconds. It's only possible to short sell on Bitfinex and Kraken. The targets are different because the trading fees can vary depending on the exchange.

[ 07/10/2015 16:15:55 ]
   Bitfinex:    293.54 / 293.57
   OKCoin:      295.40 / 295.61
   Bitstamp:    291.40 / 292.43
   Kraken:      292.20 / 294.11
   ----------------------------
   Bitfinex/Kraken:     -0.47% [target  1.10%, min -0.47%, max -0.47%]
   OKCoin/Bitfinex:     -0.70% [target  1.00%, min -0.70%, max -0.70%]
   OKCoin/Kraken:       -1.15% [target  1.10%, min -1.15%, max -1.15%]
   Bitstamp/Bitfinex:    0.38% [target  1.10%, min  0.38%, max  0.38%]
   Bitstamp/Kraken:     -0.08% [target  1.20%, min -0.08%, max -0.08%]
   Kraken/Bitfinex:     -0.19% [target  1.10%, min -0.19%, max -0.19%]

[ 07/10/2015 16:16:00 ]
   Bitfinex:    293.54 / 293.57
   OKCoin:      294.65 / 295.28
   Bitstamp:    291.40 / 292.43
   Kraken:      292.20 / 294.11
   ----------------------------
   Bitfinex/Kraken:     -0.47% [target  1.10%, min -0.47%, max -0.47%]
   OKCoin/Bitfinex:     -0.59% [target  1.00%, min -0.70%, max -0.59%]
   OKCoin/Kraken:       -1.04% [target  1.10%, min -1.15%, max -1.04%]
   Bitstamp/Bitfinex:    0.38% [target  1.10%, min  0.38%, max  0.38%]
   Bitstamp/Kraken:     -0.08% [target  1.20%, min -0.08%, max -0.08%]
   Kraken/Bitfinex:     -0.19% [target  1.10%, min -0.19%, max -0.19%]

The software will continue to loop every five seconds, until there is an opportunity at 17:46:55: the spread between OKCoin (long) and Bitfinex (short) equals our 1.00% entry target:

[ 07/10/2015 17:46:50 ]
   Bitfinex:    286.67 / 286.87
   OKCoin:      284.24 / 284.25
   Bitstamp:    286.48 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   Bitfinex/Kraken:     -0.60% [target  1.10%, min -0.94%, max  0.29%]
   OKCoin/Bitfinex:      0.85% [target  1.00%, min -1.11%, max  0.92%]
   OKCoin/Kraken:        0.32% [target  1.10%, min -1.45%, max  0.95%]
   Bitstamp/Bitfinex:    0.06% [target  1.10%, min -0.59%, max  0.67%]
   Bitstamp/Kraken:     -0.46% [target  1.20%, min -0.60%, max  0.68%]
   Kraken/Bitfinex:     -0.20% [target  1.10%, min -1.22%, max  0.50%]

[ 07/10/2015 17:46:55 ]
   Bitfinex:    286.67 / 286.87
   OKCoin:      283.80 / 283.82
   Bitstamp:    285.94 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   Bitfinex/Kraken:     -0.60% [target  1.10%, min -0.94%, max  0.29%]
   OKCoin/Bitfinex:      1.00% [target  1.00%, min -1.11%, max  1.00%]

[ ENTRY FOUND ]
   Date & Time:       07/10/2015 17:46:55
   Exchange Long:     OKCoin (id 1)
   Exchange Short:    Bitfinex (id 0)
   Fees:              0.20% / 0.20%
   Price Long:        $283.82 (target)
   Price Short:       $286.67 (target)
   Spread:            1.00%
   Cash used:         $1,286.16 on each exchange

<OKCoin> Trying to send a "buy" limit order: 4.53@$284.10...
<OKCoin> Done (order ID: xx,xxx,xxx)

<Bitfinex> Trying to send a "sell" limit order: 4.49@$286.39...
<Bitfinex> Done (order ID: xxx,xxx,xxx)

Waiting for the two orders to be filled...
Done

Now that the orders are filled and that we are in the market, we are looking every five seconds for the spread to pass under our exit limit (-0.30%):

[ 07/10/2015 17:47:05 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    286.54 / 286.85
   OKCoin:      283.80 / 283.82
   Bitstamp:    285.94 / 286.49
   Kraken:      285.16 / 287.24
   ----------------------------
   OKCoin/Bitfinex:      1.07% [target -0.30%, min  1.07%, max  1.07%]

[ 07/10/2015 17:47:10 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    286.58 / 286.82
   OKCoin:      283.86 / 284.10
   Bitstamp:    286.02 / 286.60
   Kraken:      285.16 / 287.24
   ----------------------------
   OKCoin/Bitfinex:      1.04% [target -0.30%, min  1.04%, max  1.07%]

Then, at 19:04:10 the spread is under the exit limit (-0.32%). We close the two positions and compute the performance:

[ 07/10/2015 19:04:10 IN MARKET: Long OKCoin / Short Bitfinex ]
   Bitfinex:    284.32 / 284.40
   OKCoin:      285.31 / 285.50
   Bitstamp:    284.29 / 285.00
   Kraken:      284.50 / 288.79
   ----------------------------
   OKCoin/Bitfinex:     -0.32% [target -0.30%, min -0.32%, max  1.07%]

[ EXIT FOUND ]
   Date & Time:       07/10/2015 19:04:10
   Duration:          77.25 minutes
   Price Long:        $285.31 (target)
   Price Short:       $284.40 (target)
   Spread:            -0.32%
   ---------------------------
   Target Perf Long:  0.12% (fees incl.)
   Target Perf Short: 0.39% (fees incl.)
   ---------------------------

BTC exposure on OKCoin: 4.522520
BTC exposure on Bitfinex: -4.486550

<OKCoin> Trying to send a "sell" limit order: 4.52@$284.40...
<OKCoin> Done (order ID: xx,xxx,xxx)

<Bitfinex> Trying to send a "buy" limit order: 4.49@$284.59...
<Bitfinex> Done (order ID: xxx,xxx,xxx)

Waiting for the two orders to be filled...
Done

New balance on Bitfinex:        1,303.81 USD (perf $4.66), 0.000000 BTC
New balance on OKCoin:          1,319.06 USD (perf $0.74), 0.000520 BTC
New balance on Bitstamp:        1,237.33 USD (perf $0.00), 0.000000 BTC
New balance on Kraken:          0.00 USD (perf $0.00), 0.000000 BTC

ACTUAL PERFORMANCE: $5.40 (0.21%)

The system can send us an e-mail with our trade:


So we made $5.40 (+0.21%) in about 1 hour and 17 minutes with an exposure of $2,572.32 and no market risk. Note that the $5.40 is the actual profit after fees. To make sure that all the fees are taken into account the $5.40 amount comes from a straight comparison between the Bitcoin accounts (before the trade and after the trade). +0.21% doesn't seem a lot but remember that with this mechanism you don't get any losing trades since the system always waits for the spread to close (which can take days).

We are currently using the parameters enter=0.20% (plus fees, in this example the fees were 0.80%) and exit=-0.30% that are narrower than a few months ago. The reason being that the Bitcoin volatility these weeks is pretty low. The system needs a volatile market so that arbitrage opportunities can occur. As you can see in the following chart the Bitcoin volatility is pretty low these days (~1.86%):


Our hope is that the Bitcoin volatility re-increases so the spreads can be wider again. The volatility is a key factor of success in this kind of strategy.

I hope this post helped you understand the long/short arbitrage mechanism.




This is a great explanation! And an excellent strategy to use when doing arbitrage trading.
I'll be sure to take this in mind.
stash
Full Member
***
Offline Offline

Activity: 173
Merit: 100

btcmy.net


View Profile WWW
August 19, 2015, 02:50:29 PM
Last edit: August 20, 2015, 05:49:44 AM by stash
 #35

solved.

Tehtarik Fund : 1KxyB3iauJzLvDnZuchekGkB2D7p4UMvuq
BTCitcoin : Mathematical Logic to Eliminate Human Greed
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
August 25, 2015, 03:08:10 AM
Last edit: August 25, 2015, 03:19:23 AM by butor
 #36

Hi Mattsun,

Thank you for your message.

1. The 'short term' buy/sell, how is that operated? Do you buy BTC from an exchange (e.g. bitstamp), withdraw it from bitstamp then deposit to another exchange (e.g. bitfinex) and sell it? If that's the case, the long confirmation time might reduce the price difference or even switch the price position, how do you deal with that? If that's not the case, what do you mean by 'short sell'?

Again, there is no USD transfer and no BTC transfer between the exchanges. So we don't have to deal with the latency of withdraws and deposits. That's one of the advantages of long/short strategies. But let me explain what short selling means and maybe it will help you and others on this forum to understand how the strategy works. Short selling is not a Bitcoin thing and it is common in the financial market industry. I actually work on Wall Street so my examples will be closer to my actual job than Bitcoin.

  • 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 week 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. You will have more details about how the long/short strategy works with Blackbird on the GitHub page of the project.



2. Still the 'short sell', so far as I know, bitstamp doesn't have an API for 'Instant Transaction', you can only place a buy/ask offer by API. How do you 'short sell'?

You're right: as of today it's not possible to short sell on Bitstamp. However, it's possible to short sell on Bitfinex, OKCoin and others. Note that the short selling operation is usually pretty straightforward and the Bitcoin lending part is automatically done for you by the exchanges.



3. Do you always see the price position switch between the bitcoin exchanges you selected? I found some exchanges price position maintains the same all the time. For example, bitkonan's price are always higher than bitstamp.

Between Bitfinex, OKCoin and Bitstamp we see price discrepancies pretty often. It really depends on the overall Bitcoin volatility: the higher the volatility the higher the spreads between the exchanges. But check the prices right now (08/24/2015 21:55:25 EDT):

   Bitfinex:  204.54 / 204.55
   OKCoin:    201.13 / 201.27
   Bitstamp:  204.29 / 204.48

As you can see there is a good opportunity right now between Bitfinex (short) and OKCoin (long) with a 1.62% spread. A word to the wise...



4. The spreadEntry and spreadExit point, how do you decide the value? Do you have any reference or analysis behind?

Good question and that's all the challenge: SpreadEntry and SpreadExit are set based on the historical relationship between the exchanges. If you use values closer to zero you will get more trades, but less profit on each trade. Also, as explained above if the Bitcoin volatility is very low you will have difficulties to get trades and might need to lower your values. The Bitcoin volatility is now at 3.51%. You can check it here in realtime.

Note that I have some ideas to implement using dynamic spreads based on:
1. the short-term historical volatility
2. the fact that we want to let the profits run.

Stay tuned!
mattsun
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 28, 2015, 04:39:18 AM
 #37

Hi Butor,

So much thanks for you detailed answer! It really gives me a brand new perspective of btc arbrtriage. Honestly I'm an engineer mostly good at programming, I don't quite understand these 'short sell' 'long buy' very much, I have to spend some time to teach myself how it works... But anyway, this is a fantastic strategy I've ever seen. If you don't mind, i have several 'follow-ups', just short answer is fair enough I believe...
1. How fast is your trading? I believe c++ is fast, but using API to do trade is mostly network bound ( I assume your algorithms don't take very much time...). Are there any special tricks that makes you trading bot fast other than multi-threading pulling real-time data (and use websocket stream whereever you can)?
2. Have you considered using some machine learning or statistics algorithm to train the bot? Such as using historical data to predict the trend the exchange price, or decide spreadEntry and spreadExit dynamicly? I have seen a article about 'statistical arbitrage', which using statistical method to make profit. Their annual revenue goes up to 280%, which is really amazing.

Hi Mattsun,

Thank you for your message.

1. The 'short term' buy/sell, how is that operated? Do you buy BTC from an exchange (e.g. bitstamp), withdraw it from bitstamp then deposit to another exchange (e.g. bitfinex) and sell it? If that's the case, the long confirmation time might reduce the price difference or even switch the price position, how do you deal with that? If that's not the case, what do you mean by 'short sell'?

Again, there is no USD transfer and no BTC transfer between the exchanges. So we don't have to deal with the latency of withdraws and deposits. That's one of the advantages of long/short strategies. But let me explain what short selling means and maybe it will help you and others on this forum to understand how the strategy works. Short selling is not a Bitcoin thing and it is common in the financial market industry. I actually work on Wall Street so my examples will be closer to my actual job than Bitcoin.

  • 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 week 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. You will have more details about how the long/short strategy works with Blackbird on the GitHub page of the project.



2. Still the 'short sell', so far as I know, bitstamp doesn't have an API for 'Instant Transaction', you can only place a buy/ask offer by API. How do you 'short sell'?

You're right: as of today it's not possible to short sell on Bitstamp. However, it's possible to short sell on Bitfinex, OKCoin and others. Note that the short selling operation is usually pretty straightforward and the Bitcoin lending part is automatically done for you by the exchanges.



3. Do you always see the price position switch between the bitcoin exchanges you selected? I found some exchanges price position maintains the same all the time. For example, bitkonan's price are always higher than bitstamp.

Between Bitfinex, OKCoin and Bitstamp we see price discrepancies pretty often. It really depends on the overall Bitcoin volatility: the higher the volatility the higher the spreads between the exchanges. But check the prices right now (08/24/2015 21:55:25 EDT):

   Bitfinex:  204.54 / 204.55
   OKCoin:    201.13 / 201.27
   Bitstamp:  204.29 / 204.48

As you can see there is a good opportunity right now between Bitfinex (short) and OKCoin (long) with a 1.62% spread. A word to the wise...



4. The spreadEntry and spreadExit point, how do you decide the value? Do you have any reference or analysis behind?

Good question and that's all the challenge: SpreadEntry and SpreadExit are set based on the historical relationship between the exchanges. If you use values closer to zero you will get more trades, but less profit on each trade. Also, as explained above if the Bitcoin volatility is very low you will have difficulties to get trades and might need to lower your values. The Bitcoin volatility is now at 3.51%. You can check it here in realtime.

Note that I have some ideas to implement using dynamic spreads based on:
1. the short-term historical volatility
2. the fact that we want to let the profits run.

Stay tuned!
Lawk
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
August 28, 2015, 12:45:00 PM
 #38

Hi Butor,

Thanks for all the elaborate answers.
Any updates on the software as of may/june?

Greets,

Lawk
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
September 01, 2015, 12:06:10 AM
 #39

Hi Mattsun,

So much thanks for you detailed answer! It really gives me a brand new perspective of btc arbitrage.
You're welcome. I'm glad it can help you to understand how arbitrage works.


1. How fast is your trading? I believe c++ is fast, but using API to do trade is mostly network bound ( I assume your algorithms don't take very much time...). Are there any special tricks that makes you trading bot fast other than multi-threading pulling real-time data (and use websocket stream wherever you can)?
By default Blackbird gets the prices from the exchanges and analyzes all the spreads every 5 seconds. That 5-second loop is pretty large but it's a simple parameter that you can adjust depending on your machine and Internet connection speed. You shouldn't get any latency issues with the parameter by default and the system can handle temporary network issues: if there is an network problem the system will stop the analysis and check the market data connection every two seconds.
Also, a contributor just found some promising C++ optimizations to make Blackbird more robust and faster. Thanks to him. This will be part of a future release. But if you have some network or C++ knowledge and have some optimization ideas, please reach out on the GitHub page! We use cURL to handle the HTTP requests.


2. Have you considered using some machine learning or statistics algorithm to train the bot? Such as using historical data to predict the trend the exchange price, or decide spreadEntry and spreadExit dynamically?
Absolutely. As I said in a previous post, we are going to dynamically adapt SpreadEnter and SpreadExit based on the short-term volatility. We are also going to use some historical data, however note that it's very tricky to train a system on historical prices because you never know what were the volumes of the historical bids and asks. This can lead to very inaccurate simulations.
Let's say that at a given time, the BTC bid price is $130.00 on a given exchange. It means that a trader is ready to buy some Bitcoin at $130.00. That's great, but how many Bitcoin? 0.10 BTC or 10,000.00 BTC? That makes a huge difference! I won't go into too much details but as a general advice: be always very careful when you backtest a strategy on historical prices only, specially for short-term strategies on illiquid markets like it's the case with Blackbird.

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
September 12, 2015, 04:30:22 PM
 #40


Any updates on the software as of may/june?

Hi Lawk,

Currently we are working on improving the code itself. No new features but lots of code improvements for better performance and stability. Thanks to a great contributor, Julian Miller, who made many improvements to the code, we have now a better version of Blackbird which is under validation. You can check the details of his work on his GitHub pull request and this will be merged to the main code very soon as everything looks good so far.

Also, we are working on new ideas to optimize the arbitrage mechanism. The current Bitcoin market conditions are not ideal for exchange arbitrage: the low volatility means a more efficient market and thus less arbitrage opportunities. Two examples of new features: trailing stop and parameter adjustments based on the volatility.

Another idea: to do the arbitrage between Bitcoin exchanges in different currencies: the extra layer of currency conversion generates more inefficiencies that can be captured as opportunities. This will be an interesting implementation challenge because we will need to add the real-time currency rate into the spread calculation.


nqkrasowski
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
October 06, 2015, 09:16:36 PM
 #41

Hi Butor,

Love the work you've done on this and very thoughtful of you to make it open source.  A couple of questions.

1.) What volatility do you deem efficient enough to use blackbird to trade?

2.) While you were alraedy entered into a long and short position have you ever had the short positioned margin be called?  I suppose in that case you're long position would make up for the loss but does blackbird take that transaction into account?
HeroCat
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500


View Profile
October 19, 2015, 02:18:16 PM
 #42

2% monthly return is quite low profit.  Smiley People trying to get more profit as far as I know  Grin
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
October 19, 2015, 03:57:29 PM
 #43

2% monthly return is quite low profit.  Smiley People trying to get more profit as far as I know  Grin


Maybe one of those HYIP mentioned in your trust references will yield more, then again some people prefer a legit 2% profit as opposed to insane one-time yields.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
maokoto
Hero Member
*****
Offline Offline

Activity: 770
Merit: 500


✪ NEXCHANGE | BTC, LTC, ETH & DOGE ✪


View Profile WWW
October 20, 2015, 02:34:05 AM
 #44

2% is not bad at all.There is the possibility to earn more, but always has a risk. As far as I know, arbitrage is 100% secure (if there is something like that) as you only buy/sell when profit is assured.

Worst case scenario is not earning anything. Am I right?

siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
October 20, 2015, 02:07:46 PM
 #45

2% is not bad at all.There is the possibility to earn more, but always has a risk. As far as I know, arbitrage is 100% secure (if there is something like that) as you only buy/sell when profit is assured.

Worst case scenario is not earning anything. Am I right?


I don't consider it bad, especially when it is so easy to use this particular software. Almost like doing nothing for a 2-3% return.

Any trading has it's risk, part of the fun of it. There is also a big difference between the latest "ponzi investment scam game" and arbitrage. If it isn't obvious from my signature, I enjoy options trading too and there are a fair number of places to do this as well. Smiley


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
October 21, 2015, 11:49:30 PM
 #46

Love the work you've done on this and very thoughtful of you to make it open source.

Thank you.


What volatility do you deem efficient enough to use blackbird to trade?

The simple answer is: the higher the better. On the Bitcoin Volatility Index you can follow the 30-day volatility, which is currently 1.44%. This is pretty low. Historically we started to get interesting spreads when the volatility was above 4.00%. I would say that 4.00% was a good volatility for the empirical default parameters SPREAD_ENTRY=0.0030 and SPREAD_EXIT=-0.0040. Now with the current low volatility we are trying to narrow the spread parameters: less spreads but more trades on a shorter timeframe.


While you were already entered into a long and short position have you ever had the short positioned margin be called?  I suppose in that case you're long position would make up for the loss but does blackbird take that transaction into account?

That's a good point and no Blackbird doesn't take into account margin calls for the moment. That being said, the way Blackbird is implemented always makes the initial margin at 100%. Since you can leverage on the short selling exchanges (e.g. 2.5:1) the risk of margin calls stays low. But yes ideally we should take it into account.


butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
October 26, 2015, 02:35:56 AM
 #47

2% is not bad at all.There is the possibility to earn more, but always has a risk. As far as I know, arbitrage is 100% secure (if there is something like that) as you only buy/sell when profit is assured.

Just to clarify: the advantage of our strategy is that it eliminates market risk. If the Bitcoin price suddenly drops from $400 to $50 the strategy won't be impacted by this event at all. It's completely independent. Similarly, if the price suddenly rallies from $400 to $800 we unfortunately won't profit from that rally, as we are still independent from the market.

That's why we call it a market-neutral strategy. But please be aware that there are other risks (liquidity risk for example).
bitmarket.net
Sr. Member
****
Offline Offline

Activity: 323
Merit: 250



View Profile WWW
October 26, 2015, 01:12:10 PM
 #48

Have you been considering running your strategy on btc trading in more than one currency, e.g. BTC/USD and BTC/EUR ?

This way it's likely you will find more price inneficiencies, although you will be adding EUR/USD currency risk (which can be hedged as well).

BitMarket.net- Europe's most advanced cryptocurrency exchange
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
October 28, 2015, 03:45:36 AM
 #49

Have you been considering running your strategy on btc trading in more than one currency, e.g. BTC/USD and BTC/EUR ?
This way it's likely you will find more price inefficiencies, although you will be adding EUR/USD currency risk (which can be hedged as well).

Yes it's part of our future development plans and the currency conversion will add an extra layer of complexity between the exchanges, so the inefficiency (and thus arbitrage opportunities) will increase. As you mentioned the currency risk will need to be hedged. That's definitely something we will do, we just need to find the time to implement it in Blackbird.

For now we focus on the BTC/USD inefficiencies between US/EU exchanges and Asian exchanges. We just added the new US exchange Gemini to our system (GitHub link here).

bitmarket.net
Sr. Member
****
Offline Offline

Activity: 323
Merit: 250



View Profile WWW
October 28, 2015, 09:28:55 AM
 #50

Butor,

What you are doing seems very interesting.
Can you please share what is your long-term plan ?
Are you going to use your own money to trade it, will you be looking for outside investors, or are you planning to keep it open source ?

One piece of advice, which might be helpful to you:
You will get many more arbitrage opportunities if you constantly work your orders on the less liquid exchange and are prepared to hedge your position on the primary exchange once your orders get filled.
If you will wait for the markets to align themselves so that you can you can send orders to both exchanges, most opportunities will pass you by.

BitMarket.net- Europe's most advanced cryptocurrency exchange
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
October 30, 2015, 11:28:11 PM
 #51

Hello Butor,

Thanks for sharing this software, it´s great idea how to trade BTC right now. I was trying to install and launch it through Ubuntu but I wasn´t successful. After typing "make" this message occurs:

src/bitfinex.cpp: In function ‘bool Bitfinex::isOrderComplete(CURL*, Parameters, int)’:
src/bitfinex.cpp:91:73: error: ‘json_boolean_value’ was not declared in this scope
   bool isComplete = !json_boolean_value(json_object_get(root, "is_live"));

Could anybody advice me what to do? I would really appreciate it as I am interested in this project and not really good Linux user.

Thanks in advance.

Install lib Jansson  that should fix the issue.
Code:
apt-get install libjansson-dev
Let me know if it persists.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
October 31, 2015, 12:55:54 PM
 #52

Hello Butor,

Thanks for sharing this software, it´s great idea how to trade BTC right now. I was trying to install and launch it through Ubuntu but I wasn´t successful. After typing "make" this message occurs:

src/bitfinex.cpp: In function ‘bool Bitfinex::isOrderComplete(CURL*, Parameters, int)’:
src/bitfinex.cpp:91:73: error: ‘json_boolean_value’ was not declared in this scope
   bool isComplete = !json_boolean_value(json_object_get(root, "is_live"));

Could anybody advice me what to do? I would really appreciate it as I am interested in this project and not really good Linux user.

Thanks in advance.

Install lib Jansson  that should fix the issue.
Code:
apt-get install libjansson-dev
Let me know if it persists.

Thank you Siameze. The question was actually also asked on GitHub (direct link to the issue here).
You need to install Jansson v2.7 as json_boolean_value doesn't exist in the previous versions.

siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
October 31, 2015, 03:45:48 PM
 #53

Hello Butor,

Thanks for sharing this software, it´s great idea how to trade BTC right now. I was trying to install and launch it through Ubuntu but I wasn´t successful. After typing "make" this message occurs:

src/bitfinex.cpp: In function ‘bool Bitfinex::isOrderComplete(CURL*, Parameters, int)’:
src/bitfinex.cpp:91:73: error: ‘json_boolean_value’ was not declared in this scope
   bool isComplete = !json_boolean_value(json_object_get(root, "is_live"));

Could anybody advice me what to do? I would really appreciate it as I am interested in this project and not really good Linux user.

Thanks in advance.

Install lib Jansson  that should fix the issue.
Code:
apt-get install libjansson-dev
Let me know if it persists.

Thank you Siameze. The question was actually also asked on GitHub (direct link to the issue here).
You need to install Jansson v2.7 as json_boolean_value doesn't exist in the previous versions.




I had forgot to turn on issue tracking and did not see that, thank you! It has run for me without issue though as I already had the necessary libs. Wink


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
Intergalactictrash
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
November 05, 2015, 12:16:02 AM
 #54

I have had this program working for about two days now on Ubuntu 14.0.4 (or whatever the latest is, I got it two days ago).  Then I keep getting this error.  Ive compiled it on two different computers but still get the following:


ubuntu@ubuntu:~/blackbird$ ./blackbird
Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK.

[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.20%

[ Current balances ]
   Bitfinex:   0.00 USD   0.000000 BTC
   OKCoin:   0.00 USD   0.000000 BTC
   Bitstamp:   0.00 USD   0.056127 BTC
   Gemini:   0.00 USD   0.000000 BTC
   Kraken:   0.00 USD   0.000000 BTC
   ItBit:   0.00 USD   0.000000 BTC

[ Cash exposure ]
   TEST cash used
   Value: $25.00

[ 11/05/2015 00:10:51 ]
   Bitfinex:    385.18 / 391.70
   OKCoin:    391.20 / 394.97
   Bitstamp:    389.82 / 391.00
   Gemini:    415.00 / 420.28
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:



Any ideas on How to troubleshoot this?
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
November 05, 2015, 12:55:56 PM
 #55

I have had this program working for about two days now on Ubuntu 14.0.4 (or whatever the latest is, I got it two days ago).  Then I keep getting this error.  Ive compiled it on two different computers but still get the following:


ubuntu@ubuntu:~/blackbird$ ./blackbird
Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK.

[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.20%

[ Current balances ]
   Bitfinex:   0.00 USD   0.000000 BTC
   OKCoin:   0.00 USD   0.000000 BTC
   Bitstamp:   0.00 USD   0.056127 BTC
   Gemini:   0.00 USD   0.000000 BTC
   Kraken:   0.00 USD   0.000000 BTC
   ItBit:   0.00 USD   0.000000 BTC

[ Cash exposure ]
   TEST cash used
   Value: $25.00

[ 11/05/2015 00:10:51 ]
   Bitfinex:    385.18 / 391.70
   OKCoin:    391.20 / 394.97
   Bitstamp:    389.82 / 391.00
   Gemini:    415.00 / 420.28
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:



Any ideas on How to troubleshoot this?


It worries me that you are considering putting your BTC into something, and you cannot troubleshoot something this trivial. Please re-read all the documentation and have a good understanding of the system you are using.

Code:
uname -a

will help you resolve:

Quote
I have had this program working for about two days now on Ubuntu 14.0.4 (or whatever the latest is, I got it two days ago). 

and will also help us understand statements such as:

Quote
Ive compiled it on two different computers ....

so that the people you are asking for help are not left pondering what OS you might have tried to compile on.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
antinomy
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
November 06, 2015, 07:23:22 PM
Last edit: November 08, 2015, 11:26:49 AM by antinomy
 #56

Hi!

Wrote a bit here about shorting on OKCoin but realized I just misinterpreted your example so I edited it out. But couldn't you be able to also short on OKCoin since they have the borrow feature in the API? It would open a lot more possibilities for arbing, wouldn't it?

I'm also curious about what delta limit and aggressive volume stand for in the config?

Great job with the software!
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
November 10, 2015, 01:05:25 AM
Last edit: November 14, 2015, 11:08:22 PM by butor
 #57

Couldn't you be able to also short on OKCoin since they have the borrow feature in the API? It would open a lot more possibilities for arbing, wouldn't it?

Yes, doing short selling on OKCoin will add more opportunities since Bitfinex won't be the only short selling exchange anymore. Unfortunately, the OKCoin API documentation about it is not complete. That being said, if you know how to implement it in C++ or you want to try you are welcome to do a pull request on GitHub.


I'm also curious about what delta limit and aggressive volume stand for in the config?

These two parameters are used to customize the limit orders sent to the exchanges. For obvious risk reasons Blackbird never sends market orders to the exchanges but always limit orders. That being said, how do you define the limit prices in your limit orders? These two parameters help to customize it:

AggressiveVolume
  • true: Blackbird will adapt the limit price to the price that exactly matches the trade's needed liquidity with what is currently available in the exchange order book.
  • false (default): same as above, except that the defined price will be the next entry in the order book to create a kind of a safety net for the trade.
    The difference is that with true the limit price sent to the exchange will be a better one (i.e. more profit on the final trade) but there is a risk that the order is never fully filled because the offered volume at that price is gone. Setting false will generate a less advantageous price but the full order execution should be immediate. This limits the risk of unbalance between the long trade and the short trade.

PriceDeltaLimit
  • If the defined limit price is more than $0.30 disadvantageous regarding the target price then the trade is canceled.
    Example: long trade, target price $381.05, defined limit price $381.42, difference $0.37, trade canceled.

I would strongly suggest to leave these parameters with their default values for the moment.


Please read: If you have troubles installing Blackbird or if you just found a bug please don't post on this thread but open a new issue on the GitHub page instead (link here). Thanks.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
November 14, 2015, 09:22:05 PM
 #58

Can you please share what is your long-term plan ?
Are you going to use your own money to trade it, will you be looking for outside investors, or are you planning to keep it open source ?

For the moment I focus on the software itself: performance improvements and new features (current list here). As an example I just added a trailing spread that should sensibly increase the return per trade. Once Blackbird is mature enough it would be interesting to see it used by professional investors. A couple of Bitcoin quant traders already asked me many questions about the software so I guess there is an interest in the industry. As for now my goal is to offer the best possible open source Bitcoin arbitrage platform.

And yes my plan is to still keep Blackbird open source. Even though arbitrage is a highly competitive environment and therefore strategies should be kept more or less secret, I still believe it is fine to keep Blackbird open source for the following reason: Blackbird is merely the main engine of the arbitrage implementation. It covers the whole arbitrage logic, the bid/ask prices management, the order executions and verification. So it already covers a big part but to do successfully arbitrage you need more than just the engine. Usual examples:

  • Spread parametrization: do you want few long-term trades with high spread? Many short-term trades with small spread? What will make the best profit on the long run? And how do you adapt the parameters based on market conditions? This is where you can make the difference. It will also depend on your exposure (not the same parameter optimal values whether you trade $100, $10,000 or $1,000,000).

  • Accurate and representative backtesting. This is NEVER trivial, specially with short-term strategies.

  • Overall risk management (e.g. VaR of the strategy).

  • IT-related topics like network optimization but also failover, lost network connections, etc.

So I believe that even if everybody shares the same platform you can still have many edges over the other players. And again an implementation for $100 exposure won't be the same as for $1,000,000.

I am happy to discuss any thoughts on this interesting topic.



One piece of advice, which might be helpful to you:
You will get many more arbitrage opportunities if you constantly work your orders on the less liquid exchange and are prepared to hedge your position on the primary exchange once your orders get filled.
If you will wait for the markets to align themselves so that you can you can send orders to both exchanges, most opportunities will pass you by.

Yes you are right and this is actually current practice in the industry. I would add that you want to avoid to be in a situation where you are 99% executed on the non-liquid one and 0% on the liquid one (0% because the non-liquid is not yet fully filled). In this situation you are not market neutral anymore.

To avoid this situation a good option would be to split your order into many child orders and when a child order in the non-liquid one is fully filled then you execute the same amount on the liquid one. And then you continue with the next child order until they are all completed. Your market risk would then always be the size of a child order. Maybe in a future version...



Please read: If you have troubles installing Blackbird or if you just found a bug please don't post on this thread but open a new issue on the GitHub page instead (link here). Thanks.
HeroCat
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500


View Profile
November 15, 2015, 01:48:37 PM
 #59

You can be sure that 2% monthly income is quite small monthly profit  Wink Most of BTC users are interested in quite larger profit  Smiley
bitmarket.net
Sr. Member
****
Offline Offline

Activity: 323
Merit: 250



View Profile WWW
November 16, 2015, 03:30:16 PM
 #60

You can be sure that 2% monthly income is quite small monthly profit  Wink Most of BTC users are interested in quite larger profit  Smiley

It all depends on what risk you are talking.
If it is 2% with relatively low risk, then the strategy sounds great.

BitMarket.net- Europe's most advanced cryptocurrency exchange
frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
January 03, 2016, 07:24:32 AM
 #61

Is it possible to set my default positions to be 100% btc as neutral instead of 100% fiat?  I'd rather have my profit locked in as more btc.  Great job by the way this is very fascinating to look through on github.   and I feel lucky to have stumbled upon it.

Wessman
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
January 03, 2016, 08:20:09 PM
 #62

Hi,
This indeed is a fantastic idea


Just wanted to show you guys the actual output of an arbitrage trade if you are interested. It might help to understand the mechanism. Note that this is a real example with real money.


I am actually new to this method of arbitrage but I find it interesting. I have running in demo mode a copy of blackbird but I would like to understand how it works.

Blackbird Bitcoin Arbitrage
Version 0.0.2
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK.

[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.30%

[ Current balances ]
   Bitfinex:    1,299.15 USD   0.000000 BTC
   OKCoin:      1,318.32 USD   0.000582 BTC
   Bitstamp:    1,237.33 USD   0.000000 BTC
   Kraken:      0.00 USD       0.000000 BTC


In your example, your targets were set at 0.0020 to enter and 0.0030 to exit. Your "target" in this particular example was 1%. Could you explain how the program came about this target? Also, could you explain the log line below

>> OKCoin/Bitfinex:      1.00% [target  1.00%, min -1.11%, max  1.00%] <<

what dose each component mean (traget, min, max) and how do they relate to the set targets of 0.20% and 0.30%.


[ 07/10/2015 16:15:55 ]
   Bitfinex:    293.54 / 293.57
   OKCoin:      295.40 / 295.61
   Bitstamp:    291.40 / 292.43
   Kraken:      292.20 / 294.11
   ----------------------------
   Bitfinex/Kraken:     -0.47% [target  1.10%, min -0.47%, max -0.47%]
   OKCoin/Bitfinex:     -0.70% [target  1.00%, min -0.70%, max -0.70%]
  OKCoin/Kraken:       -1.15% [target  1.10%, min -1.15%, max -1.15%]
   Bitstamp/Bitfinex:    0.38% [target  1.10%, min  0.38%, max  0.38%]
   Bitstamp/Kraken:     -0.08% [target  1.20%, min -0.08%, max -0.08%]
   Kraken/Bitfinex:     -0.19% [target  1.10%, min -0.19%, max -0.19%]


still from logs of your example, why did program  not recognize negative targets. what I mean is 

>> OKCoin/Kraken:       -1.15% [target  1.10%, min -1.15%, max -1.15%] <<

will register a traget greater than 1% if inverted (Kraken/OKCoin) or am I getting the concept wrong?


Could you explain the strategy section and config parameters in blackbird.conf file?

# Strategy parameters
GapSec=3.0
SpreadEntry=0.0020
SpreadTarget=0.0030
PriceDeltaLimit=0.10
AggressiveVolume=true
TrailingSpreadLim=0.0010
OrderBookFactor=1.5
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 07, 2016, 01:55:19 AM
 #63


Is it possible to set my default positions to be 100% btc as neutral instead of 100% fiat?  I'd rather have my profit locked in as more btc.  Great job by the way this is very fascinating to look through on github.   and I feel lucky to have stumbled upon it.

Thank you for your interest. One of the goals of Blackbird is to be market-neutral: you are always 100% USD and 0% BTC when there is no arbitrage opportunity, and then when an opportunity arises you are long on one exchange as well as short on another exchange with the same amount. With this configuration, Blackbird won't be impacted by any market drops or peaks: the price can drop from $430 to $200 or conversely rises to $500 at any time without impacting the strategy: this is why it's market-neutral.

However, it won't be the case if you are 100% BTC: a market drop will impact all your BTC accounts and therefore you will lose the corresponding USD value.
carlo__
Full Member
***
Offline Offline

Activity: 222
Merit: 100

Margin Call


View Profile
January 09, 2016, 10:02:45 AM
 #64

Hello Butor

Nice job.I am a currency and commodity trader and i am completely out from buy and hold logical, so your strategy is quite clear to my eyes.

I just would like to know if your script is getting more user friendly in the near future. I have no linux skills but i want to try it

Thank you
Wessman
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
January 09, 2016, 10:28:56 AM
 #65

Hello Butor,
I see that BTC-e module is not fully implemented. Like I said earlier, I am not an enthusiast in C++ but can adapt my programming skills. I however need to understand how these modules are called from the main program module and where to find the necessary "hooks".


siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 09, 2016, 02:46:26 PM
 #66

Hello Butor

Nice job.I am a currency and commodity trader and i am completely out from buy and hold logical, so your strategy is quite clear to my eyes.

I just would like to know if your script is getting more user friendly in the near future. I have no linux skills but i want to try it

Thank you



LMAO.

Yes I suspect a Windows 10 version or iPhone app will be produced any day now, since learning how to use new things is so difficult for people.

Fire up a persistant live USB of whatever linux distro and try it, the instructions are printed on the tin. What do you have to lose? You might actually gain a few wrinkles on the 'ol gray cells.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 10, 2016, 02:48:36 PM
Last edit: January 13, 2016, 09:22:20 PM by butor
 #67


Hi Wessman,


[ Targets ]
   Spread to enter: 0.20%
   Spread to exit: -0.30%

In your example, your targets were set at 0.0020 to enter and 0.0030 to exit. Your "target" in this particular example was 1%. Could you explain how the program came about this target? Also, could you explain the log line below

>> OKCoin/Bitfinex:      1.00% [target  1.00%, min -1.11%, max  1.00%] <<

what dose each component mean (target, min, max) and how do they relate to the set targets of 0.20% and 0.30%.

Actually, the way we setup Blackbird was improved since that example. It's explained in the REAMDE file, but basically now the two strategy parameters are:

  • SpreadEntry: the limit above which we want the long/short trades to be triggered
  • SpreadTarget: the spread we want to achieve as an arbitrage opportunity. It represents the net profit and takes the exchange fees into account.

As explained, when you set SpreadEntry=0.0020, the target will be that value plus four times the fees (e.g. 0.20% + 4 * 0.20% = 1.00%).

Also, min and max are the minimum and maximum spread values between these two exchanges since the last trade (or since you started Blackbird).


still from logs of your example, why did program  not recognize negative targets. what I mean is  

>> OKCoin/Kraken:       -1.15% [target  1.10%, min -1.15%, max -1.15%] <<

will register a traget greater than 1% if inverted (Kraken/OKCoin) or am I getting the concept wrong?

The program takes into account all the combinations between the exchanges. If two exchanges, say A and B, can both short sell, then you will have:

A/B    -1.15%
and
B/A     1.15%

So your -1.15% value will be handled when B/A is analyzed. Note that because of the bid/ask difference the numbers won't be the exact opposite.

Could you explain the strategy section and config parameters in blackbird.conf file?

# Strategy parameters
GapSec=3.0
SpreadEntry=0.0020
SpreadTarget=0.0030
PriceDeltaLimit=0.10
AggressiveVolume=true
TrailingSpreadLim=0.0010
OrderBookFactor=1.5

Hopefully I will improve the README file soon and by adding explanations for all these parameters.

SpreadEntry and SpreadTarget are already explained.

GapSec=3.0 means that Blackbird analyzes all the spreads every 3 seconds. You can increase or decrease this value based on the quality of your internet connection.

The other parameters are mainly used to manage limit orders based on the exchanges' order books. If you know how to read C++ you should be able to understand what these parameters do, otherwise you can leave them at their default values.

I see that BTC-e module is not fully implemented.

I just opened an enhancement request: link here.
helpcomputah
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 16, 2016, 03:08:16 PM
 #68

Would be cool to have something that creates a time sequence chart of the spreads and does an analysis with the time sequence of the volatility to determine the optimal values for entering at. I think this could be run separate from the actual program (but with something in the program that could reference to it), just as something to find trends, and then update your spread values after each arbitrage (after each new learning opportunity to update it after already learning from the past).


Another thing would be for when you go long; to check and see if the value of bitcoin actually increased in percentage more than the spread you entered at so you could automatically resell on the same exchange if it ever goes above a certain value/parameter you could input. Like an option to automatically pull away from neutrality if its in our benefit. Perhaps I only say this because I still don't understand the program well enough.

And a question: would it be at all beneficial to know the number of trades in the cue, and any info about blocktime that could possibly be correlated in predicting volatility or other factors?

I am still a total newb (only been googling about this stuff for a few days. Started at r/personalfinance and wound up on quite an adventure).

Is it possible to incorporate techniques from this into what you guys are doing in C++?  https://github.com/ericjang/cryptocurrency_arbitrage
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 16, 2016, 04:29:33 PM
 #69

Would be cool to have something that creates a time sequence chart of the spreads and does an analysis with the time sequence of the volatility to determine the optimal values for entering at. I think this could be run separate from the actual program (but with something in the program that could reference to it), just as something to find trends, and then update your spread values after each arbitrage (after each new learning opportunity to update it after already learning from the past).


Another thing would be for when you go long; to check and see if the value of bitcoin actually increased in percentage more than the spread you entered at so you could automatically resell on the same exchange if it ever goes above a certain value/parameter you could input. Like an option to automatically pull away from neutrality if its in our benefit. Perhaps I only say this because I still don't understand the program well enough.

And a question: would it be at all beneficial to know the number of trades in the cue, and any info about blocktime that could possibly be correlated in predicting volatility or other factors?

I am still a total newb (only been googling about this stuff for a few days. Started at r/personalfinance and wound up on quite an adventure).

Is it possible to incorporate techniques from this into what you guys are doing in C++?  https://github.com/ericjang/cryptocurrency_arbitrage

Welcome this is a nice project.

I started trying to graph a few things using perl's Graph::Easy module. Haven't got it tweaked how I want it yet.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 17, 2016, 02:48:27 PM
 #70


Would be cool to have something that creates a time sequence chart of the spreads and does an analysis with the time sequence of the volatility to determine the optimal values for entering at.

Yes you're right: adapting the spread parameters based on the current Bitcoin volatility will be a great advantage. Last year I actually wrote an issue that describes that requirement. I hope to implement it soon.


Another thing would be for when you go long; to check and see if the value of bitcoin actually increased in percentage more than the spread you entered at so you could automatically resell on the same exchange if it ever goes above a certain value/parameter you could input. Like an option to automatically pull away from neutrality if its in our benefit. Perhaps I only say this because I still don't understand the program well enough.

This is directional trading, and as you mentioned you would need to pull away from the neutrality: this is risky because you will be impacted by any market drop. I really want the system to be market-neutral at all times.

As an example: my system runs 24/7 on a Google server and was absolutely not impacted by the sudden price decline we faced the last few days. Rather, the system actually made money since the volatility increased during that period.


And a question: would it be at all beneficial to know the number of trades in the cue, and any info about blocktime that could possibly be correlated in predicting volatility or other factors?

We don't check the number of limit orders in the order book but rather the liquidity in the order book: Blackbird always verifies that there is enough liquidity in the order books for a given price before sending orders to the exchanges. This is specially critical with large orders.

Usually the historical volatility is simply price-based: you can see an example here on the Bitcoin Volatility Index page.


Is it possible to incorporate techniques from this into what you guys are doing in C++?  https://github.com/ericjang/cryptocurrency_arbitrage

Thanks for the link. I didn't know that project which is indeed similar to Blackbird, except that this one is not market-neutral. I'll check it out to see if there are any interesting ideas we can use. Thanks!

helpcomputah
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 18, 2016, 12:50:57 PM
 #71

The idea would be to only pull away from neutrality if the price of bitcoin raised greater the size of the spread you entered at (for any instance where during the arbitrage opportunity the value that bitcoin increased would be worth more than you would make when it would close). You would set a parameter so that you profit in case the cost goes down again only during the same arbitrage opportunity (rare and unlikely, but possible). Here you would actually want to pull away from neutrality (just for that time, and not necessarily for any other arbitrage opportunity, as soon as bitoin goes above some value). I dont know how to explain it better because my lexicon in this field is pretty small. Theres probably a name for this...


also, for anyone interested in incorporating any other series of data sets:
http://arxiv.org/pdf/1502.01073.pdf


Anyways, I am interested in getting everything up and running and testing some stuff out. I am a total noob to finance and coding, (like I said this all started from realizing I should probably be investing money instead of just letting it sit around and decided to check r/personalfinance like a week ago) so I am wondering: after I install all the required software what do I do?
frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
January 18, 2016, 05:21:46 PM
Last edit: January 18, 2016, 06:20:25 PM by frankenmint
 #72

The idea would be to only pull away from neutrality if the price of bitcoin raised greater the size of the spread you entered at (for any instance where during the arbitrage opportunity the value that bitcoin increased would be worth more than you would make when it would close). You would set a parameter so that you profit in case the cost goes down again only during the same arbitrage opportunity (rare and unlikely, but possible). Here you would actually want to pull away from neutrality (just for that time, and not necessarily for any other arbitrage opportunity, as soon as bitoin goes above some value). I dont know how to explain it better because my lexicon in this field is pretty small. Theres probably a name for this...


also, for anyone interested in incorporating any other series of data sets:
http://arxiv.org/pdf/1502.01073.pdf


Anyways, I am interested in getting everything up and running and testing some stuff out. I am a total noob to finance and coding, (like I said this all started from realizing I should probably be investing money instead of just letting it sit around and decided to check r/personalfinance like a week ago) so I am wondering: after I install all the required software what do I do?

Okay so you need to set a plan - lower spread equals more trades but a larger spread may mean perfect trades at the right time, its all on preference and volatility.  From there you need to have at least two but preferrably 3 - 5 different exchange accounts all with equal amounts on them...convert this into USD.... now...generate API keys for them so they can trade (not withdraw).  Use those api keys in the settings .conf file - if you followed his directions, you will have needed to download those dependencies first so the program can successfully compile and run.  They are mentioned on the readme file.  The mysql portion is optional - but I recommend figuring out how to install that first as a good primer to getting you acquainted with the other dependencies.  If you're using windows then be sure to only download from the original sites...if linux then be sure to use your repo package or sudo apt-get.  

Interesting script but how would the funds be transferred between exchanges?

Doesn't work that way - you have to put the money there yourself your arbitrage flexibility is only as good as the amount per exchange not the total amount deposited across all exchanges.


@butor...im curious ...what actually happens if i started the bot with all BTC Huh  does it try to liquidate all back to fiat instantly???  could I somehow build a failsafe to point this out and abort the bot?

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 19, 2016, 03:41:09 AM
 #73



I am interested in getting everything up and running and testing some stuff out. I am a total noob to finance and coding, (like I said this all started from realizing I should probably be investing money instead of just letting it sit around and decided to check r/personalfinance like a week ago) so I am wondering: after I install all the required software what do I do?

Just a thing: if you are looking to invest your money and if, as you said, you are new to finance and coding, then investing through an experimental open source trading system that trades on a volatile cryptocurrency might not be the best thing to do...

My recommendation would be to read good books about personal investment (not websites, books) so you can learn how to build a portfolio based on your investment horizon, how to invest in low cost securities like ETFs, etc.

That being said, if you are interested in Blackbird and the Bitcoin arbitrage in general, you are more than welcome to try it out. As Frankemint said, everything should be detailed in the README file.


Interesting script but how would the funds be transferred between exchanges?
Doesn't work that way - you have to put the money there yourself your arbitrage flexibility is only as good as the amount per exchange not the total amount deposited across all exchanges.

Yes Frankenmint that's correct. As I already explained here and here on this thread, the strategy doesn't need any fund transfer to profit from arbitrage.


@butor...im curious ...what actually happens if i started the bot with all BTC Huh  does it try to liquidate all back to fiat instantly???  could I somehow build a failsafe to point this out and abort the bot?

If you start Blackbird with more than 0.03 BTC on any of your exchanges, a mechanism will prevent from trading and Blackbird will simply stop. You need to be 100% USD to start using Blackbird. Here is the mechanism for reference:

Code:
for (int i = 0; i < num_exchange; ++i) {
  if (balanceBtc[i] > 0.0300) {
    logFile << "ERROR: All BTC accounts must be empty before starting Blackbird" << std::endl;
    return -1;
  }
}

helpcomputah
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 19, 2016, 12:24:08 PM
 #74

well, my moment of realization came when I was transferring money back to the states to pay student loans and couldnt stop watching the foreign currency rates that updated on the wall of the bank. I tried hurriedly in the worst broken Chinese to ask how I could trade currencies online faster than those numbers change: in the 30 minutes waiting and fillilng out paperwork I saw that if any of those numbers didnt update immediately that you could trade currencies and make a buck or two, but since it happened every few seconds this could quickly add up. After r/personalfinance I learned about the term arbitrage and was trying to find the fastest way to immidiately exchange currencies and that led me to bitcoin, and well... the rest got me here.

I will take your recommendation and order some books (do you recommend any in particular?) In the meantime I am going to be ordering books on C++...


I think the program Eric made has some interesting things that added to my ideas for this program. First some questions: is the BTC to USD the most volitile? If not is there another currency that opens up larger spreads more frequently?

 I am wondering about adding a third account in another exchange and then using the different currency options within each exchange to write a program that would automatically find the most volatile high liquidity currency to buy and sell, and then pair it with another currency conversion going in the opposite direction to balance back the money if it keeps going the same way. You would set up a triangle like in Erics program, but using the idea of neutrality you present. I suppose I need to write up a solid example to explain this better...
 
bengal17
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
January 19, 2016, 04:43:41 PM
 #75

Hi,

I have installed blackbird and try to do a test run with kraken and bitfinex. Both accounts should be ablo to go short. However when a trading option is found it produces the following error:

Code:
[ 01/18/2016 22:15:48 ]
   Bitfinex: 385.01 / 385.15
   Kraken: 388.00 / 388.67
   ----------------------------
   Bitfinex/Kraken: 0.74% [target  0.70%, min -0.67%, max  0.91%]   trailing  0.81%  2/2
<Bitfinex> Looking for a limit price to fill 0.04 BTC...
<Bitfinex> order book: 6.49@$385.21

[ ENTRY FOUND ]
   Date & Time:       01/18/2016 22:15:48
   Exchange Long:     Bitfinex (id 0)
   Exchange Short:    Kraken (id 1)
   Fees:              0.20% / 0.26%
   Price Long:        $385.21 (target)
   Price Short:       $388.00 (target)
   Spread:            0.74%
   Cash used:         $15.00 on each exchange
   Exit Target:       -0.48%

Error with JSON:
'[' or '{' expected near '<'. Retrying...
Error with JSON:
'[' or '{' expected near '<'. Retrying...

I would like to help you investigate what goes wrong here. But I am not sure what information you need or actions I could perform to provide you with additional information needed. I'm not a programmer, but in the mean time I will try if I can understand your code and see what goes wrong.

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 19, 2016, 08:27:11 PM
 #76

Hi bengal17,

This is because unfortunately Kraken doesn't provide the API to short sell programmatically for the moment. I really hope they will do it soon. Meanwhile, please change KrakenCanShort back to false. I will hardcode this value to avoid any confusion.

Thanks

bengal17
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
January 19, 2016, 09:58:56 PM
Last edit: January 20, 2016, 05:34:53 PM by bengal17
 #77

Hi bengal17,

This is because unfortunately Kraken doesn't provide the API to short sell programmatically for the moment. I really hope they will do it soon. Meanwhile, please change KrakenCanShort back to false. I will hardcode this value to avoid any confusion.

Thanks



That explains a lot. Thank you for the clarification.

Update: Even with Kraken can short set to false I get the same error. Anything I can do to help find the problem? Or is Kraken not fully supported?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 20, 2016, 04:29:46 AM
 #78

This is because unfortunately Kraken doesn't provide the API to short sell programmatically for the moment. I really hope they will do it soon. Meanwhile, please change KrakenCanShort back to false. I will hardcode this value to avoid any confusion.

FYI, to avoid any confusion I just hardcoded the exchanges that can short sell and the ones that can't. As of today, only Bitfinex can short sell.

Thanks
frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
January 20, 2016, 07:32:19 AM
 #79

I got the bot working...Thanks for your help on github!  So I notice that the console doesn't pipe out data - I could only determine it was running by taking a peek at the logfile - is that expected behavior or should I see output in the console window running blackbird?   

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 20, 2016, 05:26:12 PM
 #80

I got the bot working...Thanks for your help on github!  So I notice that the console doesn't pipe out data - I could only determine it was running by taking a peek at the logfile - is that expected behavior or should I see output in the console window running blackbird?   

Yes this is the expected behavior. We decided to output everything to a log file rather than the console.
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 20, 2016, 06:05:06 PM
 #81

I got the bot working...Thanks for your help on github!  So I notice that the console doesn't pipe out data - I could only determine it was running by taking a peek at the logfile - is that expected behavior or should I see output in the console window running blackbird?   

Yes this is the expected behavior. We decided to output everything to a log file rather than the console.

You can just tail the log file in a separate screen though, if you like to watch it run. I'm guilty of doing this.  Grin


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
January 20, 2016, 06:16:03 PM
Last edit: January 20, 2016, 06:33:46 PM by frankenmint
 #82

I've been running cat occasionally, thanks for the tip.  So I was thinking about maybe moving everything into a log directory.  Is there any reason you don't have the files appending to make a bigger file?

One last thing, before kicking things into high gear with testing, I wanted to just let it run for awhile and at a point, I started running into problems when it tries to execute trades. hold on...

ok here you go:




Max Iteration - means how long the bot should run right (in seconds?)

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 20, 2016, 08:52:15 PM
 #83


Is there any reason you don't have the files appending to make a bigger file?

I though the best way (and easiest way) was to create one log file per execution. Since Blackbird is supposed to run many days in a row, the size of a single log file can end up being hundreds of MB.


I wanted to just let it run for awhile and at a point, I started running into problems when it tries to execute trades.

It might be an issue with Kraken. I just uploaded a new version on GitHub that will give more details about the issue. Also, could you please open an issue on the issue page and we can continue from there? Thanks.


Max Iteration - means how long the bot should run right (in seconds?)

Yes that's correct, but not in seconds. DebugMaxIteration represents the number of market analysis loops. So Blackbird will run for approximately {DebugMaxIteration * GapSec} seconds.

frankenmint
Legendary
*
Offline Offline

Activity: 1456
Merit: 1018


HoneybadgerOfMoney.com Weed4bitcoin.com


View Profile WWW
January 22, 2016, 11:06:28 AM
 #84

I got the bot working...Thanks for your help on github!  So I notice that the console doesn't pipe out data - I could only determine it was running by taking a peek at the logfile - is that expected behavior or should I see output in the console window running blackbird?   

Yes this is the expected behavior. We decided to output everything to a log file rather than the console.

You can just tail the log file in a separate screen though, if you like to watch it run. I'm guilty of doing this.  Grin

you sir....are da real mvp....this is now my favorite command in the world. 


siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 22, 2016, 11:39:57 AM
 #85

I got the bot working...Thanks for your help on github!  So I notice that the console doesn't pipe out data - I could only determine it was running by taking a peek at the logfile - is that expected behavior or should I see output in the console window running blackbird?   

Yes this is the expected behavior. We decided to output everything to a log file rather than the console.

You can just tail the log file in a separate screen though, if you like to watch it run. I'm guilty of doing this.  Grin

you sir....are da real mvp....this is now my favorite command in the world. 



Ha! glad you like it, I love to watch my trades scroll after I have got a new setup working. Simple and effective. Smiley


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
enigma969
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 26, 2016, 07:20:38 PM
 #86

Hey,

your project sounds very nice! Too bad I just can write in Java, would be very interested to contribute. I am very looking forward to use your software and so I would be very happy if you can answer some questions:

Let's say I have 3000$ available to invest, what exchanges would you recommend? Should I split money up over all exchanges that are currently supported? 

What hosting solution do you recommend? You said something about a Google Server?

I always get warnings like "WARNING: 2 second(s) too late at 01/26/2016 19:47:51" - It's because of latency right?


Thanks a lot in advance!
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 26, 2016, 07:29:05 PM
 #87

Hi guys,

did anybody test it with OSX 10.10? I am getting segfaults with the current git master when i disable demoMode.

Thanks for your work!

██  ███  nope ██  ███
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 26, 2016, 07:37:06 PM
 #88

Hi guys,

did anybody test it with OSX 10.10? I am getting segfaults with the current git master when i disable demoMode.

Thanks for your work!

I haven't tested it on OSX but did manage a BSD build, which is similar. I'll see if I can find a friend using osx to test, never used it xD.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 26, 2016, 07:58:12 PM
 #89

Hi siameze,

thanks for the fast feedback. Tested current master with a clean Ubuntu 14.04 VM and had the same effect (Segfault).

Quote
root@ubuntu:~/trader/blackbird# ./blackbird
Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK

Log file generated: blackbird_log_20160126_204710.log
Blackbird is running... (pid 10118)

Segmentation fault (core dumped)

Quote
root@ubuntu:~/trader/blackbird# cat blackbird_log_20160126_204710.log
--------------------------------------------
|   Blackbird Bitcoin Arbitrage Log File   |
--------------------------------------------

Blackbird started on 01/26/2016 20:47:10

[ Targets ]
   Spread Entry:  0.80%
   Spread Target: 0.30%
[ Current balances ]

Quote
Starting program: /root/trader/blackbird/blackbird
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK

Log file generated: blackbird_log_20160126_205556.log
Blackbird is running... (pid 11317)

[New Thread 0x7ffff1808700 (LWP 11321)]
[Thread 0x7ffff1808700 (LWP 11321) exited]
[New Thread 0x7ffff1808700 (LWP 11322)]
[Thread 0x7ffff1808700 (LWP 11322) exited]
[New Thread 0x7ffff1808700 (LWP 11323)]
[Thread 0x7ffff1808700 (LWP 11323) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff64af54c in __GI_____strtod_l_internal (nptr=0x0, endptr=0x0, group=<optimized out>, loc=0x7ffff682d060 <_nl_global_locale>) at strtod_l.c:608
608   strtod_l.c: No such file or directory.
(gdb) bt
#0  0x00007ffff64af54c in __GI_____strtod_l_internal (nptr=0x0, endptr=0x0, group=<optimized out>, loc=0x7ffff682d060 <_nl_global_locale>) at strtod_l.c:608
#1  0x000000000040cfc5 in atof (__nptr=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:28
#2  Bitstamp::getAvail (params=..., currency=...) at src/bitstamp.cpp:51
#3  0x0000000000404add in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:250

EDIT: As it is pretty obvious that there is a problem with the bitstamp configuration, i removed it.

Works now, but now i am curious what leads to this crash ;-)

██  ███  nope ██  ███
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 28, 2016, 04:59:38 AM
Last edit: January 28, 2016, 05:16:24 AM by butor
 #90


Hi enigma969, thank you for your interest.

Let's say I have 3000$ available to invest, what exchanges would you recommend? Should I split money up over all exchanges that are currently supported?

Yes, if you want to maximize your exposure you should put $1,500 on Bitfinex and $1,500 on one of the other supported exchanges. But please first test with a small amount of money!


What hosting solution do you recommend? You said something about a Google Server?

I don't have any specific recommendation. I personally use a laptop for programming and troubleshooting and a Google Cloud server (Compute Engine Micro) to run Blackbird 24/7.
The CPU and memory consumptions are usually low (C++ helps here) but you need a correct Internet connection.


I always get warnings like "WARNING: 2 second(s) too late at 01/26/2016 19:47:51" - It's because of latency right?

Yes this is probably due to the latency of your Internet connection. See a workaround here (issue #39).
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 28, 2016, 08:02:53 AM
 #91

Resolved it by activating the Bitstamp API Key. Yes, my bad. Obviously, Bitstamp does not activate new API Keys by default. A documentation for the setup of all supported exchanges and better error handling would be great.

I can take care of the documenation part if there is enough interest.

PS.: I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?

██  ███  nope ██  ███
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 28, 2016, 11:00:00 AM
 #92

Resolved it by activating the Bitstamp API Key. Yes, my bad. Obviously, Bitstamp does not activate new API Keys by default. A documentation for the setup of all supported exchanges and better error handling would be great.

I can take care of the documenation part if there is enough interest.

PS.: I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?


Just checked this thread, but glad you got your API key working. I haven't tried 796 integration myself but it is most likely possible. Perhaps dev will add it in the future.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 28, 2016, 12:40:32 PM
 #93

Thank you for the feedback siameze!

Ok, i will try to integrate a new provider as PoC then and also add documentation about how to actually create / activate API keys for the existing ones. Will take a couple of days, especially since i am currently on the road for a couple of days.

██  ███  nope ██  ███
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
January 30, 2016, 11:15:14 PM
Last edit: January 30, 2016, 11:25:46 PM by butor
 #94


I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?

A first implementation of 796.com has been done (link to cpp file here) but has never been tested. The getLimitPrice() function has to be rewritten to match the other exchanges.

Note that 796.com only trade Bitcoin futures contracts.
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
January 31, 2016, 01:20:42 AM
 #95


I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?

A first implementation of 796.com has been done (link to cpp file here) but has never been tested. The getLimitPrice() function has to be rewritten to match the other exchanges.

Note that 796.com only trade Bitcoin futures contracts.



Hey thanks for this! I will compile it in tommorow and report my experience later on. Nice work!  Smiley


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 31, 2016, 07:35:02 AM
 #96


I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?

A first implementation of 796.com has been done (link to cpp file here) but has never been tested. The getLimitPrice() function has to be rewritten to match the other exchanges.

Note that 796.com only trade Bitcoin futures contracts.

I contacted their support and they will enable BTC/USD trading after chinese new year  Wink

██  ███  nope ██  ███
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 31, 2016, 05:12:05 PM
 #97


I am currently trying to get 796 working, but struggling. Does anybody have a working 796 integration?

A first implementation of 796.com has been done (link to cpp file here) but has never been tested. The getLimitPrice() function has to be rewritten to match the other exchanges.

Note that 796.com only trade Bitcoin futures contracts.

I am running off master for a week now, does definitely not work for me. Segfault on start if 796 is enabled. Will look into it tomorrow afternoon.

██  ███  nope ██  ███
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
January 31, 2016, 06:17:38 PM
 #98

For the reference:
Quote from: 796 support
Yes you can do margin trading with bitcoin here, we offer bitcoin futures and a variety of CFD products (indices, commodities, Forex) that trade with bitcoin.
We will launch Bitcoin spot trading soon after the Chinese New Year then you can sell your coins for US dollars.
But we don't have plans to accept US dollar deposit though you would be able to withdraw US dollar from our platform.
Hope that helps ;-)

██  ███  nope ██  ███
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 02, 2016, 05:08:08 AM
 #99


Thanks mxnsch and siameze!

Hopefully it will be possible to programmatically short sell on 796.com. For the moment, we still only have Bitfinex that offers that feature.

PS: the Chinese New Year is next Monday (February 8th).
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 02, 2016, 11:30:55 AM
 #100


Thanks mxnsch and siameze!

Hopefully it will be possible to programmatically short sell on 796.com. For the moment, we still only have Bitfinex that offers that feature.

PS: the Chinese New Year is next Monday (February 8th).


Awesome news, and I like how the project keeps moving forward in a positive direction. Hopefully this weekend I will be able to see if I can look closer into the 796 code, did mxnsch get his issue resolved?


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
February 02, 2016, 03:16:57 PM
 #101

I got it resolved by removing 796.com for the moment and also opened an issue with them as i
* suspected it is an issue with their API
* wanted to know if they will enable short sells via API

;-)

██  ███  nope ██  ███
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 02, 2016, 04:19:57 PM
 #102

I got it resolved by removing 796.com for the moment and also opened an issue with them as i
* suspected it is an issue with their API
* wanted to know if they will enable short sells via API

;-)

I will probably go ahead and patch it into mine tonight, but leave it commented out until after New Year. Exciting times though, 796 support is very nice.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 03, 2016, 02:59:56 AM
 #103

I got it resolved by removing 796.com for the moment and also opened an issue with them as i
* suspected it is an issue with their API
* wanted to know if they will enable short sells via API

;-)

I will probably go ahead and patch it into mine tonight, but leave it commented out until after New Year. Exciting times though, 796 support is very nice.

Fingers crossed their API will allow short selling. We would double the arbitrage opportunities!

mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
February 03, 2016, 05:29:39 AM
 #104

Good news:
Quote
Original Message -----Hi there, yes we will launch bitcoin spot trading soon but API might need later development.

██  ███  nope ██  ███
carlo__
Full Member
***
Offline Offline

Activity: 222
Merit: 100

Margin Call


View Profile
February 03, 2016, 09:31:43 AM
 #105

Hello dudes

Sorry for the dumb question but i am not properly a linux experericend user.

How to upgrade the jansson lib to 2.7 version?

I am getting the error message "json_boolean_value was not delcared in this scope"


I used apt-get install to download the previous version


Thanks for the support
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 03, 2016, 12:23:36 PM
 #106

Hello dudes

Sorry for the dumb question but i am not properly a linux experericend user.

How to upgrade the jansson lib to 2.7 version?

I am getting the error message "json_boolean_value was not delcared in this scope"


I used apt-get install to download the previous version


Thanks for the support


Build from sources: http://jansson.readthedocs.org/en/2.7/gettingstarted.html or provide someone with a little more system information please.  Smiley


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
carlo__
Full Member
***
Offline Offline

Activity: 222
Merit: 100

Margin Call


View Profile
February 03, 2016, 01:03:01 PM
 #107

Hello dudes

Sorry for the dumb question but i am not properly a linux experericend user.

How to upgrade the jansson lib to 2.7 version?

I am getting the error message "json_boolean_value was not delcared in this scope"


I used apt-get install to download the previous version


Thanks for the support


Build from sources: http://jansson.readthedocs.org/en/2.7/gettingstarted.html or provide someone with a little more system information please.  Smiley

Thanks siameze

I run Linux Mint Rosetta, on a Vbox. What's the proper terminal command?
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
February 03, 2016, 06:12:11 PM
 #108

Hello dudes

Sorry for the dumb question but i am not properly a linux experericend user.

How to upgrade the jansson lib to 2.7 version?

I am getting the error message "json_boolean_value was not delcared in this scope"


I used apt-get install to download the previous version


Thanks for the support


Build from sources: http://jansson.readthedocs.org/en/2.7/gettingstarted.html or provide someone with a little more system information please.  Smiley

Thanks siameze

I run Linux Mint Rosetta, on a Vbox. What's the proper terminal command?
Read the thread and the document on Github. Your error and the solution are documented there. Ask in the Mint / ubuntuforums to get a backport of the package.

██  ███  nope ██  ███
Bobba12
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
February 03, 2016, 10:09:10 PM
 #109

Hello Butor,

I am really impressed by the project you are working on, using short selling is definitely a good idea to avoid fund transfer between exchanges (and the associated fees that would make arbitrage unprofitable).
But I have a few questions regarding how you tackle the inner risks of short selling. First of all, the potential loss while using short selling is (theoretically) infinite since the price has not an upper bound. Of course, since you are also buying, the winning would be as important as the loss. But this is true only if you strategy is perfectly market neutral, in other words: ONLY IF YOU BUY EXACTLY AT THE SAME TIME AS YOU SHORT SELL WITH EXACTLY THE SAME AMOUNT OF BTC. Your algorithm probably does not guarantee these two points so my question is did you try to assess the delay between short selling and buying? Did you assess the gap between them (in terms of btc amount)?

My second question is: you advise to use only small amounts to begin arbitraging (which is clearly prudent if we do not want to be ruined in a few minutes !). But if I run your algo, is my maximum loss really equal to my investment? Assume the algorithm goes crazy and order 1000btc for short selling! (The algo does need any money for that!) Assume the trend goes up... I could end up with 100000 dollars of debt due to the guys who borrowed me the btc even if I started to trade with 10$!!
How do you prevent this to happen, did you take this in account in your project or does the exchanges doing short selling prevent us from this event by rejecting too large short selling orders? If so what is the limit? 

Thank you in advance for the clarification Smiley
wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 05, 2016, 11:36:47 PM
 #110

Is BTC-E currently working? I see it's implemented
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 07, 2016, 02:41:18 PM
 #111


Is BTC-E currently working? I see it's implemented

No BTC-e is not yet implemented. From the README file:

The following exchange should be implemented soon:
  • BTC-e

I will post something here when the implementation is done.

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 07, 2016, 02:57:46 PM
 #112


I am really impressed by the project you are working on, using short selling is definitely a good idea to avoid fund transfer between exchanges (and the associated fees that would make arbitrage unprofitable).
But I have a few questions regarding how you tackle the inner risks of short selling. First of all, the potential loss while using short selling is (theoretically) infinite since the price has not an upper bound. Of course, since you are also buying, the winning would be as important as the loss. But this is true only if you strategy is perfectly market neutral, in other words: ONLY IF YOU BUY EXACTLY AT THE SAME TIME AS YOU SHORT SELL WITH EXACTLY THE SAME AMOUNT OF BTC. Your algorithm probably does not guarantee these two points so my question is did you try to assess the delay between short selling and buying? Did you assess the gap between them (in terms of btc amount)?

Thanks. The potential loss while using short selling is indeed infinite ...in theory. In reality, if your loss gets close to a defined amount of your account, you will get a margin call from the exchange. So you will never lose more than what you have on your margin account: if you only deposited $20 and you don't want to meet the margin calls then $20 will be your maximum loss.

That being said, Blackbird sends the two long and short orders at the same time. But if one is fully executed and not the other one (i.e. the market moved away from one order) then yes you won't be market neutral, that's correct. A solution would be to divide every order into child orders, e.g. a $50,000 order becomes 500 * $100 child orders. When you send your child orders you make sure than the number of already filled long orders is similar to the number of already filled short orders until all the orders are sent and fully filled. So the long/short unbalance would be $100 maximum at any time. That would be a nice implementation for Blackbird.

Meanwhile, note that to make sure the orders are almost instantly fully executed we do the following:

  • we always cross the spread
  • before we send an order we make sure that there is at least 3 times (by default) the liquidity in the order book than what we need for that order.


My second question is: you advise to use only small amounts to begin arbitraging (which is clearly prudent if we do not want to be ruined in a few minutes !). But if I run your algo, is my maximum loss really equal to my investment? Assume the algorithm goes crazy and order 1000btc for short selling! (The algo does need any money for that!) Assume the trend goes up... I could end up with 100000 dollars of debt due to the guys who borrowed me the btc even if I started to trade with 10$!!
How do you prevent this to happen, did you take this in account in your project or does the exchanges doing short selling prevent us from this event by rejecting too large short selling orders? If so what is the limit? 

Again, you will get a margin call from the exchange if your potential loss is above the limit. If you don't meet the margin call then the exchange will close your BTC position, usually at market price, and their loss will be covered by your margin account. So yes, you could entirely lose your margin account, but not more.

Note that as for now, Blackbird doesn't deal with margin calls.

siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 07, 2016, 03:01:35 PM
 #113


Is BTC-E currently working? I see it's implemented

No BTC-e is not yet implemented. From the README file:

The following exchange should be implemented soon:
  • BTC-e

I will post something here when the implementation is done.



No rush, the best things come to those who wait. I love the project as it is now, each new implementation is exciting. Cheesy


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 07, 2016, 07:09:23 PM
 #114

Do any implemented exchanges other than Bitfinex support short selling?
mxnsch
Sr. Member
****
Offline Offline

Activity: 471
Merit: 252



View Profile
February 07, 2016, 08:54:19 PM
 #115

Do any implemented exchanges other than Bitfinex support short selling?
Your attention span is shorter than 4 posts, isnt it?

██  ███  nope ██  ███
wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 08, 2016, 01:19:09 AM
 #116

Do any implemented exchanges other than Bitfinex support short selling?
Your attention span is shorter than 4 posts, isnt it?

It'd be a lot more productive use of everyone's time if you'd just answer the question...
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 08, 2016, 05:45:29 PM
 #117


Do any implemented exchanges other than Bitfinex support short selling?

For the moment, only Bitfinex offers an API to short sell. We hope that 796.com will offer a similar API soon.

wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 08, 2016, 06:19:57 PM
 #118

796.com has an option to sell short? I see this when I go to their trading page:

nuffsaid420
Member
**
Offline Offline

Activity: 86
Merit: 10


View Profile
February 08, 2016, 10:16:53 PM
 #119

I haven't input any API info yet, but I got it working fine. I'm using tails -F to output the log file at the moment. Is there a way to change the polling rate(refresh)? It seems to be doing it every second.
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 08, 2016, 10:31:29 PM
 #120

I haven't input any API info yet, but I got it working fine. I'm using tails -F to output the log file at the moment. Is there a way to change the polling rate(refresh)? It seems to be doing it every second.

Just do this:

Code:
watch -n (x) tail -n 15 <path/to/logfile>

Replacing x with number of seconds you want to poll, and path to your logfile of course.


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 20, 2016, 02:33:00 AM
 #121

Any thoughts on adding https://www.poloniex.com/ ? They allow margin trading
siameze
Legendary
*
Offline Offline

Activity: 1064
Merit: 1000



View Profile
February 20, 2016, 01:24:37 PM
 #122

Any thoughts on adding https://www.poloniex.com/ ? They allow margin trading

Quoting this to add to my project queue. Seems poloniex has a decent API: https://poloniex.com/support/api/

perhaps OP will add it, I am still waiting to see what happens on the chinese exchange now it is after New Years.  Smiley


                     ▀▀█████████▀████████████████▄
                        ████▄      ▄████████████████
                     ▄██████▀  ▄  ███████████████████
                  ▄█████████▄████▄███████████████████
                ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████
                                               ▀▀███▀
    ▄█▀█       ▄▀  ▄▀▀█  ▄▀   █████████████████▄ ██▀         ▄▀█
   ▄█ ▄▀      ▀█▀ █▀ █▀ ▀█▀  ███████████████████ █▀ ▀▀      ▄▀▄▀
  ▄█    ▄███  █     █   █   ████████████████████  ▄█     ▄▀▀██▀ ▄███
███▄▄▄  █▄▄▄ █▄▄ ▄▄▀   █▄▄ ██████████████████▀▀   █▄▄ ▄▄ █▄▄█▄▄▄█▄▄▄
                           ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
                            ▀▀█████████████▄
                                █████████████▄
                                  █████████████▄
                                    ▀███████▀▀▀▀▀
                                      ▀████▀
                                        ▀█▀
LetItRideINNOVATIVE ▬▬▬
DICE GAME
                        ▄███████████▄
                       ██  ██████████▄
                     ▄█████████████  ██▄
            ▄▄▀█▄▄▄▄▄████████████████████▄
        ▄▄█▀   ███████████  █████  ████  █
    ▄██████ ▄▄███████████████████████████▀
 ▄▀▀ ██████████████████████████  ████  █
█  ▄███████████▀▀▀█████████████████████
██████████████    ████████▀▀██████  █▀
██████████████▄▄▄██████████   ▀▀▀▀▀▀▀
███▀ ▀██████████████████████
██    ███████████████████████
██▄▄██████████████████████████
██████████████▀   ██████████
  █████████████   ▄██████▀▀
     ▀▀██████████████▀▀
         ▀▀██████▀▀
PROVABLY
F A I R
▄█████████████▀ ▄█
██            ▄█▀
██          ▄██ ▄█
██ ▄█▄    ▄███  ██
██ ▀███▄ ▄███   ██
██  ▀███████    ██
██    █████     ██
██     ███      ██
██      ▀       ██
██              ██
▀████████████████▀
BUY  BACK
PLANS
[BTC]
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 20, 2016, 04:54:22 PM
 #123

Any thoughts on adding https://www.poloniex.com/ ? They allow margin trading

Quoting this to add to my project queue. Seems poloniex has a decent API: https://poloniex.com/support/api/

perhaps OP will add it, I am still waiting to see what happens on the chinese exchange now it is after New Years.  Smiley

Yes thanks, Poloniex sounds indeed promising as their API covers short selling with marginBuy and marginSell.

Unfortunately, I am not authorized to open an account on Poloniex since I live in New York. But I already created the generic files poloniex.h and poloniex.cpp if anyone wants to implement the functions.

wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 20, 2016, 06:13:46 PM
 #124

I opened one even though I live in NY. They didn't ask for any confirmation whatsoever.
wormat22
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
February 23, 2016, 01:33:47 PM
 #125

Anyone know if you can margin trade on Bitfinex if you're in New York state? I can't exchange trade, but I can fund my margin account via wire transfer....so?

Does anyone know?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
February 26, 2016, 03:36:38 PM
 #126


Anyone know if you can margin trade on Bitfinex if you're in New York state? I can't exchange trade, but I can fund my margin account via wire transfer....so?

Does anyone know?

I have the same problem as you. This is due to the BitLicense license issued by the NY State Department of Financial Services.

Bitfinex decided to avoid having to comply to that license by imposing limitations to NY residents: we can no longer hold BTC on our accounts, among other things. More info here on their FAQ.

Fortunately, I opened an account on Bitfinex before the license so I can still margin trade to test Blackbird.

netmonk
Full Member
***
Offline Offline

Activity: 219
Merit: 100


View Profile WWW
May 22, 2016, 08:27:41 AM
 #127

Good morning Butor,
Impressive work.

I see you only trade USD/BTC

Is it possible to change settings to do for exemple BTC/ETH on poloniex/kraken ?

Or is it only due to lake of short selling on both marketplace for such pair ?

butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
May 23, 2016, 11:33:13 PM
 #128

Good morning Butor,
Impressive work.

I see you only trade USD/BTC

Is it possible to change settings to do for exemple BTC/ETH on poloniex/kraken ?

Or is it only due to lake of short selling on both marketplace for such pair ?

Hi netmonk, thanks.

The structure of the code should allows programmers to (relatively) easily add new exchanges and new cryptocurrencies. Basically you "just" need to change the API calls from BTC to ETH. For example, the bid/ask information call on Bitfinex would change from:

https://api.bitfinex.com/v1/ticker/btcusd

to:

https://api.bitfinex.com/v1/ticker/ethbtc

And yes, at least one exchange needs to offer short selling on ETH and be implemented in Blackbird to do BTC/ETH arbitrage.

Warning: if you do BTC/ETH arbitrage you will be hedged against the market risk on ETH but not on BTC anymore. USD/BTC and USD/ETH would be safer, unless you are willing to accept BTC risk.

gcride
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
May 24, 2016, 01:51:39 AM
 #129

very interesting project, will be keeping check. cheers
lightpuma
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
May 26, 2016, 05:04:37 PM
 #130

Hi!

Interesting project. Have you considered adding checks for triangular arbitrage opportunities? For example, coincheck.jp offers margin trading (so does okcoin.cn for that matter) meaning that the bot could work for a triangular arbitrage between JPY/BTC/USD or CNY/BTC/USD. Also opens up plenty more exchanges.

The only forseeable problem is that you'd have to find a reliable website to convert USD<->JPY/CNY for the initial deposit into the balance, but that shouldn't be a problem considering the wealth of money exchange platforms out there (OFX, TransferWise, etc.)

Anyway, seriously interesting venture and I'll keep checking back on this.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
May 26, 2016, 08:54:51 PM
 #131

Hi!

Interesting project. Have you considered adding checks for triangular arbitrage opportunities? For example, coincheck.jp offers margin trading (so does okcoin.cn for that matter) meaning that the bot could work for a triangular arbitrage between JPY/BTC/USD or CNY/BTC/USD. Also opens up plenty more exchanges.

The only forseeable problem is that you'd have to find a reliable website to convert USD<->JPY/CNY for the initial deposit into the balance, but that shouldn't be a problem considering the wealth of money exchange platforms out there (OFX, TransferWise, etc.)

Anyway, seriously interesting venture and I'll keep checking back on this.

Thanks. Yes this is something we've already considered (see previous posts on this thread). Adding this extra layer of currency conversion (e.g. USD/CNY) would generate more inefficiencies that can be captured as arbitrage opportunities. We will need to add the real-time currency rate into the spread calculation and the currency risk will need to be hedged.

netmonk
Full Member
***
Offline Offline

Activity: 219
Merit: 100


View Profile WWW
May 31, 2016, 08:33:15 PM
Last edit: May 31, 2016, 09:29:51 PM by netmonk
 #132

And yes, at least one exchange needs to offer short selling on ETH and be implemented in Blackbird to do BTC/ETH arbitrage.

Warning: if you do BTC/ETH arbitrage you will be hedged against the market risk on ETH but not on BTC anymore. USD/BTC and USD/ETH would be safer, unless you are willing to accept BTC risk.


Does it still need to short dealing with only cryptocurrency ?
Time for transfert a far lower between market when dealing with cryptocurrency only but still need one or more hours to confirm transaction.

But i understand it's totally out of bot's strategy to perform any transfer between markets.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 01, 2016, 02:00:39 AM
 #133

Does it still need to short dealing with only cryptocurrency ?
I don't think I understand the question. Can you elaborate?

Time for transfert a far lower between market when dealing with cryptocurrency only but still need one or more hours to confirm transaction.
But i understand it's totally out of bot's strategy to perform any transfer between markets.
Yes that's correct. Since we want to be hedged against the market, the two orders (long and short) need to be executed as fast as possible. If we need a USD/CNY conversion before it will also have to be exectued as fast as possible. As you mentioned there is no money or bitcoin transfer in this project so the hours needed to confirm a transaction don't apply here.

lightpuma
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 02, 2016, 06:47:51 AM
 #134

Okay, since my last post I've had a bit of a think about this, and there are a few things I'd like to clear up - and also a few ideas I'd like to suggest.
Thank you very much for bearing with me for the following noobish questions.

1) What is your method for quantifying liquidity?
1a) Do you check for the bid/ask spread within an exchange?  If this is the case isn't this counter intuitive, since the more illiquid the market the more volatile it is? How then do you strike a balance between liquidity risk and potential volatility profits?

1b) A way to ensure 0% liquidity risk that I can see is by buying at the lowest ask price at Exchange 1 and selling at the highest bid price at Exchange 2. Of course this is a smaller spread, but if the markets are as volatile as they've been in the past few days then there should be a few opportunities.

2) For exchanges that offer short-selling/margin-trading but with no API to do so, have you considered pure web automation, with something like Selenium?  Of course this would be much slower than an API call. However if your polling timeframe is 5 seconds then generally speaking using a web automation framework would be well within those bounds.

Thank you!
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 14, 2016, 12:58:26 AM
 #135


1a) Do you check for the bid/ask spread within an exchange?  If this is the case isn't this counter intuitive, since the more illiquid the market the more volatile it is? How then do you strike a balance between liquidity risk and potential volatility profits?

No, we only check the bid/ask difference between separated exchanges: bid on exchange A vs. ask on exchange B, ask on exchange A vs. bid on exchange B. We don't need to look at the bid/ask spread within an exchange to do arbitrage.


1b) A way to ensure 0% liquidity risk that I can see is by buying at the lowest ask price at Exchange 1 and selling at the highest bid price at Exchange 2. Of course this is a smaller spread, but if the markets are as volatile as they've been in the past few days then there should be a few opportunities.

This is exactly what Blackbird does. Once the spread threshold SpreadEntry is reached the system will buy at the ask and sell at the bid. This is called crossing the spread and helps ensuring an immediate execution.


2) For exchanges that offer short-selling/margin-trading but with no API to do so, have you considered pure web automation, with something like Selenium?  Of course this would be much slower than an API call. However if your polling timeframe is 5 seconds then generally speaking using a web automation framework would be well within those bounds.

I know Selenium a little bit and I don't think speed would be an issue as the tasks can be executed at a pretty fast pace. I'm sure that it might be possible to implement, but could be rather complex (credentials, order generation, waiting until the order is 100% filled, verification, etc) and not as robust as the REST calls we are using now. But technically yes I think it's definitely possible.

lightpuma
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 24, 2016, 12:05:20 PM
 #136

Thank you for your reply. You seem very knowledgeable about all this Smiley
Could you explain the idea behind "OrderBookFactor"? How does the number have a correlation with the liquidity? If I set it at 3.0, is it 3x the spread, or?

Thank you! I'm probably not ready to start contributing much however I'm learning quite a fair amount and hopefully I'll be able to add something in the future.
cointabo
Sr. Member
****
Offline Offline

Activity: 477
Merit: 250



View Profile
June 25, 2016, 10:28:59 PM
 #137

Is there people here who are using Blackbird and profiting from it? Please share your reviews, comments here so others can read.
Very interested in this project, thanks for investing your time in this, OP.
lightpuma
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 26, 2016, 07:32:55 AM
 #138

Is there people here who are using Blackbird and profiting from it? Please share your reviews, comments here so others can read.
Very interested in this project, thanks for investing your time in this, OP.
There are some reviews on google and generally speaking the response has been mixed. I think the general consensus is that the bot works smoothly however could be tweaked a little for consistency of returns.

You can read a blog post here: http://honeybadgerofmoney.com/blackbirdarbbot/

Still it's an amazing idea and can only benefit the community.
netmonk
Full Member
***
Offline Offline

Activity: 219
Merit: 100


View Profile WWW
June 27, 2016, 12:33:08 PM
 #139

Any plan to fully support poloniex soon  ?
yudy
Full Member
***
Offline Offline

Activity: 252
Merit: 100


View Profile
June 27, 2016, 09:01:48 PM
Last edit: July 22, 2016, 02:12:03 AM by yudy
 #140

very low profit
only 2% every month, high risk profit only 2% is very low
iam only smile is high risk profit only 2% is every month
if one lost accident profit not cover
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 30, 2016, 01:06:18 AM
 #141


Could you explain the idea behind "OrderBookFactor"? How does the number have a correlation with the liquidity? If I set it at 3.0, is it 3x the spread, or?

As you've probably understood, to stay market neutral the two orders that you send to the exchanges have to be both executed immediately. Since Blackbird sends limit orders (and not market orders because it would be too risky), you have to make sure that the orders can be fully executed at the price you defined. Indeed, if there is not enough liquidity the orders will only be partially executed, and you won't be market neutral anymore.

To prevent that situation, Blackbird makes sure that there is at least 3 times (parameter OrderBookFactor) the liquidity in the order book at the limit price that was defined before executing a trade. So before sending a trade of 2.0 BTC at $500 for example, Blackbird will make sure that there is at least 6.0 BTC at $500 available. Actually it's not exactly $500 but the value defined by the parameter PriceDeltaLimit to give a little bit of margin. But let's ignore that to keep the example simple.

Now, what happens if you don't check the liquidity first? You detect an arbitrage opportunity at $500 (ask price) and you directly send a buy limit order 2.0@$500 to the exchange. But here is the order book of the exchange at that time:

Ask_Price
Size
$500.00
0.5
$502.00
3.2
$503.00
5.4

Your order will be filled for 0.5@$500 and will stay open for the remaining 1.5. If the other order that you send to the other exchange was completely executed, you will have an imbalance: 0.5 BTC vs. 2.0 BTC.

Note: we use 3 times the liquidity because we need some margin in case of slippage: this occurs when the price changes between the time you send the order and the time the exchange processes it.

lightpuma
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
July 02, 2016, 07:55:55 PM
 #142

Ah, right. I understand now. If that's the case, would it be easier to send the maximum amount available (without slippage) on one exchange to both exchanges?
Ie: exchange 1 has ask price 550 with amount 5, exchange 2 has bid price 600 with amount 10. You then place buy/sell orders for an amount of 5 on both exchanges. Ensuring no slippage.

Out of curiosity do you only examine the order book prices to a depth of 1? Seems like by doing so there'd be a few missed opportunities. However to examine with a depth of two the maths is much more involved.
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
July 09, 2016, 02:44:28 PM
 #143


Ah, right. I understand now. If that's the case, would it be easier to send the maximum amount available (without slippage) on one exchange to both exchanges?
Ie: exchange 1 has ask price 550 with amount 5, exchange 2 has bid price 600 with amount 10. You then place buy/sell orders for an amount of 5 on both exchanges. Ensuring no slippage.

That would be a possibility yes, but usually a discrepancy between prices tends to last a little bit. So it would be better to wait until you have enough liquidity to match your exposure. For example you don't want Blackbird to trade for $24 when the exposure you set is $5,000. I think it's better to wait until you have enough liquidity to send $5,000 orders.


Out of curiosity do you only examine the order book prices to a depth of 1? Seems like by doing so there'd be a few missed opportunities. However to examine with a depth of two the maths is much more involved.

During the liquidity check, Blackbird reads the order book in depth until it reaches a price that would cover its liquidity needs. So it doesn't just examine the first depth but the following ones as well, if necessary.


bitcoinisfurture
Hero Member
*****
Offline Offline

Activity: 700
Merit: 500



View Profile
July 09, 2016, 03:24:59 PM
 #144

2% monthly return is quite low profit.  There is a thread which says 400% profit on brexit. So 2% is nothing .
ramsestom
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
September 01, 2016, 10:47:05 PM
Last edit: September 01, 2016, 11:01:43 PM by ramsestom
 #145

2% monthly return is quite low profit.  There is a thread which says 400% profit on brexit. So 2% is nothing .


2% riskless (or with a real low risk to be more precise) is far from being nothing. Tell me what other method can bring you a 25% "guaranteed" annual profit and I give you the management of an edge found....
The arrival of short sells possibilities on some bitcoins/altcoins platforms is a real opportunity to make easy profit with arbitrage (which is pretty much impossible on traditional forex now, unless you take a high leverage and/or trade really high volumes, with the associated risks if anything goes wrong...)
I am planning on making a program similar to blackbird but in java (java has many advantages over C++ for this kind of application I think. Appart from the fact that I am more comfortable with coding in java Wink , java also has many bitcoins/altcoins related libs already implemented (like https://github.com/timmolter/XChange), which should ease the development and maintenance of the program. Also, java can easily be multi-threaded (important to make simultaneous api requests on all platforms) and run on pretty much any platform. Finaly, making a UI in java is really easier than in C++. As for the "performances" concern, I can tell you that java can be more efficient than C++ in many cases (anyway performance must not be an issue in this use case where there is no computational intensive tasks. So any language would fit here...))
I don't know if anyone would be interested into helping and I haven't decided if I would make it open source or not yet (would mainly depends whether other people want to contribute or not) but if you are interested to join, you can send me a PM.
  
Lanzador
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 02, 2016, 01:48:33 PM
 #146

2% per month, compounded probably nets you over 30% per year, that's a great great return. Especially in this day and age where even hedgefunds are having trouble meeting their required rates of return. 2% per month is nothing to sneeze at.
DasPferd
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
October 17, 2016, 01:43:11 PM
Last edit: October 17, 2016, 07:32:46 PM by DasPferd
 #147

Is the 2% still a recent number? I'm seeing arbitrage options which open but seem to take too long too close. e.g. currently there is a diff. between bitfinex and bitstamp for days of 0.9%. This means in return that while you keep it open you also pay interest on the short position of approx. 0.01% / day which can diminish your opportunity if the close takes too long.

What I also don't quite understand, why this gap seems to be so persistent, sure the gap is too small to be closed by a regular arbitrage trader with the normal fees but there should be still buyers/seller who buy/sell btc for the purpose of speculation.
https://www.weforum.org/agenda/2016/04/why-bitcoin-exchanges-arent-as-straightforward-as-they-seem
TheFridge
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


View Profile
April 14, 2017, 04:20:46 AM
 #148

Is there plans for OKCoin  Shorting to be implemented?
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 01, 2017, 02:03:21 PM
 #149


Is there plans for OKCoin  Shorting to be implemented?

A first implementation is work in progress (link here). but hasn't been finished yet.

WarrEagle
Hero Member
*****
Offline Offline

Activity: 663
Merit: 501



View Profile
June 01, 2017, 02:33:19 PM
 #150

I'm also curious how this is working with small amounts of exposure. The current lag time in transfers makes me think that this might be a lesson in futility if it takes 24 to 48 hours for a transaction to process with low fees. Or if the fees to process a transaction, makes the 2% return much smaller.

How about an update from the OP?

DELETED
Razzoel
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile
June 02, 2017, 07:58:45 AM
 #151

This has a lot of potential. 2% monthly return is very high. I think you might be able to squeeze out higher numbers if you optimize it!
butor (OP)
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile WWW
June 13, 2017, 03:19:42 AM
 #152

I'm also curious how this is working with small amounts of exposure. The current lag time in transfers makes me think that this might be a lesson in futility if it takes 24 to 48 hours for a transaction to process with low fees. Or if the fees to process a transaction, makes the 2% return much smaller.

Besides rebalancing the accounts, there is no money transfers involved in the long/short strategy. So the transaction latency is not a concern.

The 2% return is net of exchange fees.
Dasher76
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
June 20, 2017, 04:36:37 PM
 #153

Any new updates here? How is it working in the current market conditions?
Any new pairs added?
Would appreciate the feedback from both the author & users who are using it.
Thank you
searchacc
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
October 19, 2017, 08:52:59 AM
 #154

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless
tf2addict
Full Member
***
Offline Offline

Activity: 675
Merit: 100


View Profile
November 07, 2017, 03:45:06 AM
 #155

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless

Agreed, 2% monthly in crypto markets is horrible.  Bitcoin is up 1000% in the last year lol

That said, the 2% figure was specified in 2015, a lot has changed since then.  Is anything using this bot now?
Talenter
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
November 24, 2017, 08:18:12 AM
 #156

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless

Agreed, 2% monthly in crypto markets is horrible.  Bitcoin is up 1000% in the last year lol

That said, the 2% figure was specified in 2015, a lot has changed since then.  Is anything using this bot now?

Is Blackbird still running? Some experience with it? Thx for your report.
ScIEnC
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
December 18, 2017, 12:28:34 AM
 #157

Hello

I am testing blackbird and found the issue below when trying to place orders:

[ ENTRY FOUND ]
   Date & Time:       12/17/2017 22:21:15
   Exchange Long:     QuadrigaCX (id 1)
   Exchange Short:    Bitfinex (id 0)
   Fees:              0.50% / 0.20%
   Price Long:        19,300.00 (target)
   Price Short:       19,149.00 (target)
   Spread:            -0.82%
   Cash used:         40.00 on each exchange
   Exit Target:       -2.72%

<QuadrigaCX> Trying to send a "buy" limit order: 0.002073 @ $19,300.00...
<QuadrigaCX> order failed: {"error": {"code": 22, "message": "Incorrect amount 0.0020725388601036"}}
<Bitfinex> Trying to send a "sell" limit order: 0.002090@$19,149.00...
<Bitfinex> Done (order ID: 6246148575)

Waiting for the two orders to be filled...
<QuadrigaCX> Error: failed to get order status for id: Order Failed:[{"id": "Order Failed", "error": {"code": 106, "message": "Cannot perform request - not found"}}]
Rubiwane
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 10, 2018, 09:37:32 AM
 #158

Does someone can explain this?
Since 3 days all opportunities are in minus
[ 01/10/2018 09:25:06 ]
Bitfinex: 13,587.00 / 13,588.00
Kraken: 13,764.50 / 13,770.00
ItBit: 13,681.43 / 13,685.10
QuadrigaCX: 13,569.08 / 13,999.26
Kraken/Bitfinex:   -1.33% [target 0.80%, min -3.25%, max 1.15%]
ItBit/Bitfinex:   -0.72% [target 0.80%, min -2.27%, max 0.24%] info only
QuadrigaCX/Bitfinex:   -2.94% [target 0.80%, min -10.88%, max -0.29%]
Pages: 1 2 3 4 5 6 7 8 [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!