
Show HN: Bitcoin investing using Dollar Cost Averaging strategy - hidiegomariani
https://github.com/0x13a/bitcoin-trading-dca
======
gtrubetskoy
The re-balancing system (of which dollar averaging is a variant) is described
in the Fortune's Formula book [1] as something that Claude Shannon [2] would
demonstrate in his lectures at MIT as a mathematically proven guaranteed
winning strategy. At the end of the talk there was a Q and A, and the first
question always was "do you yourself use this system", to which he replied
"Naw, the commissions alone would kill you".

[1] [https://www.amazon.com/Fortunes-Formula-Scientific-
Betting-C...](https://www.amazon.com/Fortunes-Formula-Scientific-Betting-
Casinos/dp/0809045990)

[2]
[https://en.wikipedia.org/wiki/Claude_Shannon](https://en.wikipedia.org/wiki/Claude_Shannon)

~~~
AgentME
The transaction fees at Kraken and many other cryptocurrency exchanges are
percentage-based, so that issue shouldn't apply here.

~~~
Buge
It would still apply. Them taking a percent of my money every trade hurts me.
Is there any guarantee that my profit per trade is larger than their fee per
trade?

~~~
AgentME
You pay the same amount in fees for buying a lump sum of $100 in Bitcoin or
for buying $100 in Bitcoin over a week using dollar cost averaging. If dollar
cost averaging with no fees is better than a lump sum with no fees, then I'm
not sure how adding the same fee to both strategies could make dollar cost
averaging any worse relatively.

------
nfriedly
I wrote a bot that did something similar on the cryptsy exchange - it didn't
pull in any new cash, it just tried to re-balance every time it ran.

It was making a small profit until cryptsy got hacked and lost all of my coins
:(

Here's the source if anyone is interested though:
[https://github.com/nfriedly/Coin-Allocator](https://github.com/nfriedly/Coin-
Allocator)

------
fiatjaf
Some years ago everybody involved with the cryptocurrency universe had a
relatively good understanding of economics, markets, agent incentives, game
theory and so on -- even if these people didn't mention any of these terms,
they seem to have a natural, logical, grasp of everything that was needed (not
much).

Now it seems that people come to cryptocurrencies without knowing a thing,
misunderstanding the way people act and the incentives involved, but at the
same time making heavy usage of the terms "cryptocurrency game theory",
"cryptocurrency economics" etc.

Not to say that this DCA thing is wrong or anything, but I've seen people here
trying to create speculation strategies using charts and correlations produced
by Python scripts, and lots the new cryptocurrencies and tokens are deadly
wrong on their assumptions and incredibly poor in their features, like Bancor
or Tezos.

~~~
trophycase
What's wrong with Tezos?

~~~
fiatjaf
Nothing wrong, I just think it is silly. It's only feature is on-chain voting
on protocol changes, something that wouldn't have prevented the Bitcoin hard-
fork, for example. It also assumes hard forks are always bad and that
everything can be agreed upon with votes, as if everybody were always
satisfied with election results.

~~~
relyio
>It's only feature is on-chain voting on protocol changes

>It also assumes hard forks are always bad and that everything can be agreed
upon with votes

Those two statements are incorrect. If you want to understand what it brings
to the table, then you should read the position paper:
[https://www.tezos.com/static/papers/position_paper.pdf](https://www.tezos.com/static/papers/position_paper.pdf)

Or watch a presentation by the lead about Governance:
[https://www.youtube.com/watch?v=6OWxGqbknFQ](https://www.youtube.com/watch?v=6OWxGqbknFQ)

------
netinstructions
The example says they want to invest $1000 over the course of 3 months, so
1000 / (3 * 30) = 1000 / 90 = ~11$ / day.

But aren't the transaction fees (at least for Bitcoin) something like ~$2 per
transaction? So you'd end up only investing ~$820 instead of the target of
$1000 and losing the rest. Am I missing something?

~~~
brndnmtthws
Another problem with DCA is that it's a classic case of "timing the market".
If, over the course of those 3 months, the value of the asset you're
purchasing consistently increases, you'll 'lose' money in the sense that your
dollar will have less and less purchasing power toward the end of the period.

There's a good discussion of this strategy on the Bogleheads wiki:
[https://www.bogleheads.org/wiki/Dollar_cost_averaging#Dollar...](https://www.bogleheads.org/wiki/Dollar_cost_averaging#Dollar_cost_averaging_versus_lump_sum)

tl;dr: If you think the market will continue to go up in the short term, lump
sum will always beat DCA. A better rule, however, is: _do not_ try to time the
market. Just invest when you can.

~~~
yamaneko
Thank you, this is a great insight.

> A better rule, however, is: do not try to time the market. Just invest when
> you can.

I'm not sure if I understood this one correctly. Is it like, instead of trying
to find the best time to invest, like waiting for something huge to happen,
just invest every now and then when you are able to do it. Is that it?

~~~
brndnmtthws
That's right. If you have $100 sitting in your chequeing account to invest,
better to invest it now.

Most people get paid biweekly or twice per month, so it would make sense to
just invest when you get paid.

~~~
rothbardrand
Which means, taking say $100 out of each paycheck and investing all of it on
that day. You're not timing the market then, the money wasn't available prior
to that. You're not paying attention to the price, you're just getting the
price on that day.

This is what dollar cost averaging usually means... assuming prior money was
already invested.

But when you have a lump sum, instead of putting it all in on that exact day
you can DCA over a short period of time, like 2-5 days or 3 weeks. This is
basically averaging over that period which is better than the chance of just
happening to pick the wrong day to buy.

------
bkolobara
> The investor purchases more shares when prices are low and fewer shares when
> prices are high.

If you never sell you never lose.

~~~
empath75
If you didn't sell on mtgox you lost everything.

~~~
byproxy
I bought 4 BTC on Mt.Gox when they were ~$25 each. Naturally, after I bought
it crashed to the ~$1 territory. Thought to myself "Figures..." and decided
might as well hold. Cut to a year (or two?) later and the prices hit the ~$30
territory. I decide to sell and reap a nice little ~$20 profit. Lucky me, eh?

------
fiatjaf
Well, I recommend buying everything at the moment you decide you want to buy,
no matter the price.

Anything different than that is likely to give you headaches.

------
thanatropism
It requires some maths (and some faith in the Black-Scholes model, but it
works okay in historical simulations), but you can do this instead. To lock in
a price for some stock or foreign currency for a given delivery date:

\- Buy an European call and write an European put at this value. This
neutralizes your exposure to fluctuations in price; OR \- Helpfully calculate
that the "delta" for delta-hedging this portfolio is 1/[present stock price]
and replicate the put/call combo: when the market goes up 1%, you buy 1/S
stock; when it goes down 1%, you sell 1/S stock.

To see why, look at
[https://en.wikipedia.org/wiki/Greeks_(finance)](https://en.wikipedia.org/wiki/Greeks_\(finance\))

Otherwise: try it with a spreadsheet program.

~~~
danmaz74
Ok, but where are you going to trade those derivatives?

------
ucaetano
There is plenty of empirical evidence showing that DCA doesn't work, and only
provide a psychological value. Why are people still using it? And for Bitcoin?

~~~
ericb
Sources?

~~~
ccleve
[https://www.google.com/search?q=dollar+cost+averaging+empiri...](https://www.google.com/search?q=dollar+cost+averaging+empirical+evidence&ie=utf-8&oe=utf-8)

Dollar cost averaging doesn't work because it makes an assumption that doesn't
hold in the real world. It assumes that stocks trade in a range, and revert to
a "true" price over time. If there were a true price, then you would in fact
buy more when the price was low and less when it was high and DCA would work.

But stock prices look more like a random walk, and they display no tendency to
revert to a mean.

Here's an article I just found:
[http://www.crossingwallstreet.com/archives/2010/11/dollar-
co...](http://www.crossingwallstreet.com/archives/2010/11/dollar-cost-
averaging-the-myth-that-wont-die.html)

------
rothbardrand
FWIW, this is a feature on coinbase-- you can just have them ACH charge your
bank account a fixed amount each day, each week, each month, etc (each hour
maybe?).

Unfortunately the better deal is moving that money to GDAX and buying there...
which is a bit hard to do at $11 a day.

------
gnaritas
Trading != investing, dollar cost average is an investing strategy, not a
trading strategy; you have an investing bot, not a trading bot.

~~~
metroidfan832
No, they have neither. This is just a script to purchase an amount of bitcoin.
It has to be run manually for each purchase. It is easier I think to just
login to the exchange every day and make the purchase. Not sure why this is so
high on HN.

~~~
shreve
Pieter Levels wrote pretty much the same thing a few days ago, but most people
that know about Pieter know he likes to automate things. I'm pretty sure he
set his up as a cron job.

[https://gist.github.com/levelsio/ee9539134035492ba77a7be1b49...](https://gist.github.com/levelsio/ee9539134035492ba77a7be1b49ed832)

~~~
hidiegomariani
yes you should add a cron to automate it daily

~~~
fiatjaf
How do you automate money transfers?

~~~
kccqzy
Simple. Just add your bank account details to your exchange account and then
your exchange can draw money from there automatically.

~~~
fiatjaf
Sorry, I live in a country where that is unthinkable.

------
pdog
A better approach with an extremely volatile asset like Bitcoin is a simple
tactical asset allocation strategy.

For example, the following system significantly outperforms both buy-and-hold
and dollar-cost averaging strategies.

    
    
        1. Buy when the monthly price of Bitcoin is greater than its 10-month simple moving average (SMA).
        2. Sell (and move to cash) when the monthly price is less than its 10-month SMA.
    

That's it. Market timing improves the risk-adjusted returns with minimally
increased transaction costs versus a buy-and-hold strategy.

~~~
Poiesis
Am I reading this right? It seems to be advocating “Buy high, sell low”.

~~~
otp124
This is exactly how I read it. I think the OP flipped the two.. This, and the
fact there is zero evidence to back up the claim is enough for us to
confidently ignore it and move on.

~~~
gnaritas
No, the OP said it correctly, it's a momentum strategy, you presume the market
will keep going in the direction it's already going. This is a simple trend
trading strategy. It doesn't actually work anymore, but anything that ever
worked once will continue to live and be promoted by people who don't grasp
that markets aren't static.

What the strategy ignores is that it gets eaten alive in ranges, when the
market isn't trending, this strategy buys high and sells low over and over
until you're broke. Works great when the market is trending though.

Bitcoin for example last crossed its 10 month moving average around $246, it's
now trading over 4k; $246 would have been a hell of a price to get in at. So
yes, buying the "high" works well in a trending market. It's have to drop to
$1827 to trigger that same sell signal so you'd lose well over half the
floating profit, and then it'd probably cross back and forth a few times when
it's near the average trigger many failed entries and exits eating up all the
profit you just made.

Moving average strategies don't work except in hindsight when you can see the
trend and decide which MA would have worked (something you can't know
beforehand), but they're great teaching aids in understanding and learning
about trading strategies because they're nearly as simple as a strategy can
get.

------
simo7
"Bitcoin investing" sounds a bit like an oxymoron to me (more like
speculating).

Anyway, dollar-cost-averaging looks like a great strategy if you are very
bullish on a asset which also happens to be quite volatile.

------
qmachu
I am sorry to say that but this script is quite laughably naive. It even
includes storing your exchange API keys on plain-text on disk. Yum!

------
popman
When I saw this initially, I thought this'd be a bunch of graphs detailing how
you would have done to invest using DCA at different times in the past, and at
different amounts.

I'd be interested in seeing that as well.

------
politician
Is it true that the vast majority of all Bitcoin mining happens near hydro
plants in China? If so, regardless of anything else, doesn't that expose
Bitcoin users to significant state actor risk?

~~~
rtkwe
The only state action that poses a huge risk is if Chinese miners totally have
>50% of the hashrate and the Chinese government took control of the miners to
mess with transactions. Other than that the worst risk is them shutting down
all the miners which would mainly just slow down transaction clearance which
would drop the price but not catastrophically.

~~~
Slartie
Nope, actually the most significant risk to Bitcoin specifically from the
Chinese government would be an effective block of all Bitcoin-related traffic
between China and the rest of the world. This would lead to about 50% of
mining power being in China and about 50% being outside of China, both
"networks" happily continuing to mine blocks (albeit a lot slower) without
knowing about each other, thus confirming entirely different transactions. The
market would effectively be crushed by such an event, since the whole point of
the blockchain is to have a stable, worldwide consensus about the ownership of
every single Bitcoin, which isn't the case anymore if there are two
independent networks which both claim to be the "real Bitcoin" (important to
note that this is entirely different to the situation between BCH and BTC,
where the forked BCH chain is clearly considered to be a "different" chain
from BTC by all relevant market actors and also by the software due to
different rules for block validation).

If the resulting havoc doesn't let Bitcoin prices fall to zero, the chaos
produced by the inevitable blockchain reorganization after the government
lifts the traffic block would definitely kill it. Depending on which chain was
lucky enough to get more blocks, one or the other suddenly becomes irrelevant,
and thus all transactions approved within it are purged from history. If the
traffic block is timed intelligently, people and/or organizations that rely on
the immutability of the chain have already performed actions as a result of
Bitcoin transfers, such as crediting user accounts on an exchange, which
effectively enables double-spending of these coins on a large scale. This
could only be prevented by immediate ceasing of all Bitcoin-related action in
case of such a "net split" event, which isn't easy to do and which in itself
is a huge market disruption.

I consider the likelihood of such an event to be rather small, as I assume the
Chinese government to have a vested interest in Bitcoin (indeed I assume that
certain parts of it have been active participants in the game of cryptos for
quite a while, and even without this, there are the proven interests of the
Chinese mining economy, whose participants hold large sums of coins and
physical values tied to their mining operations). But nevertheless this is a
possible threat with much worse consequences than simply having a little bit
slower block times.

~~~
dave7
If this were to happen, wouldn't one or both of the newly isolated mining
collectives very quickly hard fork making the situation near-identical to the
recent BCH fork?

------
thedangler
Your link to Electrum is giving a 404. Thought you should know.

~~~
hidiegomariani
thanks fixed

------
test6554
Just buy Bitcoin Today and hold it for a year. Then hold it for another year.
Buy it with money that you don't ever need again. Don't do so much that you
feel like you woud be in trouble if you lost it all and don't do it with so
little that doubling that money in a year would not be worth the rollercoaster
that is bitcoin ownership.

The week after I bought mine, it dropped nearly 30% and now it's up nearly
90%. There was a series of emotions because I probably bought enough to be
very very engaged but not enough to be in big trouble if it went south.

~~~
rb808
Yeah that's a good sign that Bitcoin is not an investment its a lottery
ticket, or more realistically an entry in a pyramid scheme.

~~~
rothbardrand
Bitcoin is the first technological form of money. This means it is going thru
the normal technology adoption cycle like a high tech startup does, yet its' a
form of money. It's a new thing.

Every time the user base expands a bit as more people become aware of it, then
the price goes up.

At the same time, every 4 years the rate of emission is being cut in half...
so, more people want bitcoins but there are less new bitcoins being made.

That's not a pyramid scheme but it's also not going to produce a perfect %0.2
appreciation per day type schedule.

It is an investment. With a lottery ticket your odds of winning are very small
and you will likely lose almost all the money. With a pyramid scheme, the
early entrants are paid with money from the later entrants as part of a scam--
and it's unsustainable-- but bitcoin is perfectly sustainable, it's simply an
asset that happens to be appreciating.

What is it when you buy an asset whose demand is going up and you think it's
going to appreciate?

Investing.

At worst you could call it "speculating" but speculation is just a word for
"high risk investments" and risk is in the eye of the beholder.

~~~
rb808
>It is an investment. With a lottery ticket your odds of winning are very
small and you will likely lose almost all the money. With a pyramid scheme,
the early entrants are paid with money from the later entrants as part of a
scam-- and it's unsustainable-- but bitcoin is perfectly sustainable, it's
simply an asset that happens to be appreciating.

I think its pretty clear that the early entrants are getting paid with money
from the later entrants. The question left is is BTC sustainable. Etherium
shows BTC is easily replaced. Currently yes it is an asset that happens to be
appreciating - do you think anyone wants to own it when it starts going down?

------
mrosseel
a few years back I made a similar DCA website, you can find it at:
[https://coinsavers.net](https://coinsavers.net)

The site has helped me to take the timing anxiety out of buying; it was
initially made as a SAAS, but I've abandoned that idea. Please don't sign up
with too many ;)

------
atemerev
DCA is just the way of periodically buying some bitcoin at the fixed dollar
amount.

------
techaddict009
I follow this manually. Buy 100$ worth top 30 crypto every week on bittrex.

~~~
quantdev
Manually? So every week you do 30 separate trades on Bittrex? Seems like a lot
of work and also you have 30 transaction fees (including the spread cost) for
only $100.

I like this idea, but only if it's scripted and for more than $100 per run.

~~~
jstanley
Transaction fees (including the spread cost) on cryptocurrency exchanges are
typically a percentage rather than a fixed amount. So it doesn't matter if you
do $100 every week or $400 every four weeks.

~~~
quantdev
Yes, you're correct -- my mistake. Bittrex's fees are 0.25% of each trade.

My point about doing 30 trades every week manually is a lot still stands
though. Maybe I'll try scripting this with Bittrex's API. It would be cool to
have an option to scale each trade size by the current relative market cap, so
you can have your own crypto index fund.

~~~
charlespwd
That's exactly what I did. I'm doing it on poloniex, but I'm pretty sure you
could do the same for bittrex too. However, they are a bit limiting on the
kind of orders you can make (I believe it's limit orders only). Poloniex has
fill or kill orders, which makes some things easier to handle.

[https://github.com/charlespwd/crypto-
trader](https://github.com/charlespwd/crypto-trader)

------
shreve
levels did it
[https://gist.github.com/levelsio/ee9539134035492ba77a7be1b49...](https://gist.github.com/levelsio/ee9539134035492ba77a7be1b49ed832)

