Pages:
Author

Topic: Bitcoin arbitrage on GitHub: ~2% monthly return, market-neutral long/short - page 5. (Read 38305 times)

newbie
Activity: 49
Merit: 0
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
newbie
Activity: 5
Merit: 0
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?
newbie
Activity: 49
Merit: 0
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

newbie
Activity: 5
Merit: 0
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
Looking for a limit price to fill 0.04 BTC...
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.

newbie
Activity: 3
Merit: 0
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...
 
newbie
Activity: 49
Merit: 0


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;
  }
}

legendary
Activity: 1456
Merit: 1018
HoneybadgerOfMoney.com Weed4bitcoin.com
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?
newbie
Activity: 3
Merit: 0
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?
newbie
Activity: 49
Merit: 0

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!

legendary
Activity: 1064
Merit: 1000
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.
newbie
Activity: 3
Merit: 0
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
newbie
Activity: 49
Merit: 0

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.
legendary
Activity: 1064
Merit: 1000
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.
newbie
Activity: 2
Merit: 0
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".


full member
Activity: 222
Merit: 100
Margin Call
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
newbie
Activity: 49
Merit: 0

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.
newbie
Activity: 2
Merit: 0
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
legendary
Activity: 1456
Merit: 1018
HoneybadgerOfMoney.com Weed4bitcoin.com
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.
sr. member
Activity: 323
Merit: 250
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.
hero member
Activity: 658
Merit: 500
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
Pages:
Jump to: