Sandro Silva
4 min readMay 28, 2018

--

Python for Cryptocurrencies (absolutely beginners)— How to find penny cryptos and small caps

By the first time I saw a cryptocurrency spreadsheet, I couldn’t identify anything. Plenty of coins, symbols, market caps, prices, volumes and so on. The best way I found to understand all those numbers was discovering a pattern. And that’s one thing I can do for sure just observing them. Slowly but certainly. I did note top300 cryptos in April 2017 and found a little pattern: when cryptocurrencies with 1) penny prices (US$), 2) market capitalizations over US$1M, 3) small circulating supplies (under 50–70M) and 4) frequent trading volume (I mean good marketable assets), they could suddenly suffer a strong demanding pression and it made their prices really skyrocketing for a while. In a single week, $KMD reached 235.71% up as $EMC (127.71%), $RLC (170.96%) and $SJCX (169.23%). Some months later (August), $ADX jumped from US$0.11 to US$2.50 and I was in (crypto info: https://coinmarketcap.com/). After December 2017, I decided to code it in Python 3 and here goes the debut Jupyter Notebook…

Importing Python libraries and scraping data

We use Pandas library to scrape data from web. It’s THE crucial 4 lines of code, specially the red arrow marked line. Web sites have their data restructured over an over and over again. We can use API or .csv docs too. No problem. But the way I did above on https://coinmarketcap.com/ is faster than API calls (paginations can stop running the code). If you want to work with .csv docs, go to https://www.coingecko.com/en and download them. CoinGecko gives you a lot of great (also free) information about cryptos like community and developer scores. At the end, no matter the way to scrape data, you must have a pandas.DataFrame to be happy in sequence.

Slicing, cleaning and transforming data

By this time, we must slice data to pick cryptocurrencies with consistent values in each column. As you could see at df.tail(), so much info was missed by ‘?’ signs. As usual, we have to clean all ‘$’, ‘*’ and ‘,’ inside the cells to get finally float values, not strings (object). We only want to use here ‘Price’, ‘Circulating Supply’, ‘Symbol’ and ‘Market Cap’ columns. ‘Volume (24h)’ can be a good financial indicator if you like to trade the trend. ‘%1h’, ‘%24h’ and ‘%7d’ show us how healthy a crypto is if you are a buy-the-dip/sell-the-rip trader. When I pass to a dataframe column [0, 900].astype(float), I’m searching for crypto market caps around US$1M (small caps at .tail()), while getting float numbers. Cryptocurrency markets are ascending I guess to US$1TRI very soon. Each day, many cryptos hit US$1M at market capitalization values. So, [0, 1200].astype(float) will be possible this year.

I know I can eliminate one line of code above while I’m cleaning data. And I like Zen Python too. But, let’s try to improve some coding pedagogy. Sometimes, an absolutely beginner shines to a non-object oriented programming better than classes or def (x): or even math formulae, statistical thesis, etc. A person thinks: “if that guy did it, sure I can also do”. That’s it!!! I feel rewarded if it happens. Another coder starts to help us seeing different perspectives of Python. What about an app? Ok, go to OOP.

Putting respectfully everything together

Any sliced, cleaned and transformed column I called df(1,2,3 and 4), concatenated them in a new dataframe — crypto_op so that I can apply filters for selecting rows. There is no more inconsistent cells. The filters can be adjusted by what we are looking for. For example, I passed a less or equal US$0.01 price filter. You can try ≤ 0.10 and get much more cryptos. Change the filters and see what shows up. New conditions are still possible above 100M circulating units. See $TRX today. Over 65BI coins in circulation and a fast growth in prices as well (it’s not a #pumpmycoin).

Well, we got 3 cryptocurrencies with the same initial key features I found in 2017. Better saying, I climbed to 100M our ‘Circulating Supply’. If you want to trade them, you must check their technical analysis out first. The momentum chart. Create machine learning models (linear regression) to understand price possibilities. Why not TensorFlow experiences? Python for Cryptocurrencies (1,2,3 and 4). Coming soon… That’s NOT an investment advice here, please, I must repeat. Just call it our primary steps to underline some trading hypothesis. Yes, I’m in $PROC. I mean I used to be until Cryptopia hacking event.

Play my crypto game: Game Jolt

See my App Store: Google Play

Also see my GitHub.

--

--

Sandro Silva

Economist, Lawyer and MScPolicy. Google dev. Android. Flutter. Games.