Coding a Poloniex Trading Bot

in #trading7 years ago

I'm terrible at trading. I admit it. Every time I buy a coin, it seems to lose about 25% of it's value almost immediately.

Now I know trading, whether it's Forex, Stocks, Cryptos or whatever, is a skill that can be learned. It's also something where some people have a natural ability, they just seem to know when to enter and exit a particular trade.

Coding is also a skill that can be learned and again some people have a natural ability here.

There are plenty of theories on these natural abilities and it would be an interesting area of research but not today.

Today, I want to leverage one ability to compensate for a lack in another.

We've already established I don't have a natural ability in trading. I don't have a natural ability in coding either. What I do have, is a learned ability. I developed an interest in programming as a teenager and it's never left me. The interest is what is needed to develop the ability.

I'm still interested!

Having recently started learning Python this is all part of my learning experience and I hope to have you all along for the ride. :-)

The naive approach

As an experiment, I recently wrote a small script to test a theory I had that even picking trades randomly would be more profitable than me trying to pick good trades.

  • take list of all available coins
  • order by trade volume
  • randomly buy coin from top 10
  • place sell order just high enough to make a profit
  • repeat

The assumption was that a coin with high volume will also have high volatility. Hopefully high enough volatility that the sell order gets met and you make a profit.

For the most part, this works. The danger is, if the volume is there because the coin is getting dumped you're likely to lose. However if you wait long enough, the coin will almost always be pumped at some point and you eventually get your profit.

Better approaches

The simple naive experiment above was enough to pique my interest and prompted me to begin developing code to allow for more sophisticated approaches.

I will start with simple technical indicators and from there, move on to machine learning techniques, neural networks, sentiment analysis and whatever else I can think of or is suggested.

My primary target is to develop an app that will be able to use a multitude of methods and be able to fully backtest and paper trade, all within an easy to use GUI frontend.

If I also end up with a profitable trading strategy, that would be great!

As I develop this code, I intend to document the progress here on Steemit and have the latest version always available, at my GitHub, for anyone to try for themselves.

Progress so far

I'm still at an very early stage of development here but I am making some progress.

I have just learned about threading in Python so I've used this to set up some background threads that pull in live price & volume data from Poloniex. It also keeps historical price data and continually updates these and stores them locally in .CSV files.

Plan of attack

The next step is to develop a framework to use the historical data to backtest some simple strategies using moving averages.

Once the backtesting framework is working, I'll add more technical indicators such as MACD, RSI, CCI etc. I also want to have a crack at implementing this.

With all that in place, I want to setup paper trading and live trading.

The GUI will likely be added round about this stage.

Then the fun really begins. Bring on the Artificial Intelligence

Want to help?

As I mentioned above, this is all part of a learning experience for me so I welcome any help, advice or ideas and would encourage anyone with any skills in coding or trading to get involved.

Download the code from GitHub and have a play with it. I'm not using any license or anything so if you find it useful, want to use it in your own project, or whatever else, there are no restrictions.

That's it for now. I'll be back soon.

Sort:  

Good man. Have fun and keep in touch. :-)

Sure thing not really gone deep in Python tho but I would follow closely and hopefully help where I can

Here's a good library for Technical Analysis you can use: https://github.com/mrjbq7/ta-lib
It's a python wrapper for the famous and well tested TA-lib. Have fun with your bot :)

Cheers, I'll be including TA-Lib at some point for some of the more complicated indicators but for now, pandas can cope.

Trading in general is hard, criptos is even harder, because there isn't much you can look at when It comes to fundamentals. It's all technical analysis, which is very subjective. Personaly I'm holding coins for the long run (months, years). Even with any other instrument, I wouldn't look to the intraday charts, I made that mistake before. Diary, weekly or monthly is the way to go.

I've already discovered trading cryptos is beyond me, that's why I'm going to have the computer do it. I'm pretty sure a neural network will be able to handle it - just hope I can handle the neural network. ;-)

I don't even have a clue how you are going to attempt this, looking forward to see it develop :)

One strategy you could try is to trade into the direction of a break out after two (or three) consecutive inside days. Some are day trading this pattern with different variances. Inside day is when today's open and close is inside yesterday's open and close. It means indecision, consolidation. Then sometimes you get strong move out of it and you can try to capture it. Three straight inside days should be stronger, a little bit more reliable pattern, but also less often.
I would guess, just tracking and comparing three days ago open/close to two days ago and to yesterdays probably shouldn't be too hard to program. Especially since historical data is already saved.

First link shows good example with two inside days:

http://www.investopedia.com/terms/i/inside_day.asp

https://www.dailyfx.com/forex/education/trading_tips/chart_of_the_day/2012/02/22/Inside_Bars_and_How_to_trade_them.html

http://priceaction.com/price-action-university/strategies/inside-bar/

Thanks for that, It shouldn't be to hard to code that up. In fact I think I'll try that next. :-)

Excellent article! I've been delving into coding trading bots lately, and it's truly fascinating.

Speaking of strategies, have you heard about the 'inside bar' pattern? I came across a resource that provides practical insights and a different perspective on it: https://profitfluent.com/inside-bar/ . You may check it out and Thanks for the great content!!

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.030
BTC 59204.66
ETH 2526.28
USDT 1.00
SBD 2.52