SoleTrader (Name TBC)
Over the last month I decided I wanted to do a few things.
- Start a new Programming Project that taught me a new framework and enhanced my python programming skills.
- Enhance the predictability of trading my Cryptocurrency Stocks and limit missed opportunities.
- Practice Working with API’s
- Practice on Web Development.
- Long Term, Lean on the BTC Markets API but Do away with their Website and use my own Console.
As a result of this I have decided to build a Flask Application. Flask being a Python framework for the Web. I know nothing about it. At least when I started I knew nothing. By the time I am done I want to be competent in writing basic Flask and Python Applications for the Web.
The project is Simple and has the following phases:
- [Phase #1] Build a Python Flask Web Application that gives me a complete view of cryptocurrency portfolio on BTC Markets.
- [Phase #2] Develop a User interface that is of a quality for which I would happily show consumers on the web.
- [Phase #3] Secure the Web Application in such a manner that it can be deployed to the internet for public consumption with no risk to the Digital Assets it is presenting data for.
- [Phase #4] Build Back End DB to support Persistent backend data. (Configuration, Goals, Historical Trade Data.
- [Phase #5] Enhance the Web Application to allow View Only Access to Multiple BTC Markets Accounts and allow for this to work simultaneously
- [Phase #6] Introduce Basic Trading.
- [Phase #7] TBC
I expect this to be a long term personal project. The goals, boundries and deliverables will constantly be changing thats one thing I know for sure. But for now. This is my geeky project.
I will post Simple occasional Developer Updates here along the way.
The only thing remaining is a Name. I don’t know what to call this thing…
Update #1 (December 4th):
- So its been about a week and half of working and I have the API connected up to the Python Flask Backend. I have also built a very rudimentary GUI for general consumption on the local host.
- The GUI is HTML with JS calling for refreshing dynamic data within the front end.
- The Backend runs a function to update all the core data components and feeds them to a JSON structure which is passed and processed by the front end.
- The JSON structure currently holds the following information groups (Wallets, Market Rates, General Configuration Information, Recent Trades).
- The Front End currently Exposes Wallets and Market Rates as well as Portfolio Value in AUD.
- I have provided a simple screenshot of it running.
Update #2 (December 6th):
- The backend and front end have been enhanced to calculate the portfolio profit and loss both as a value and a percentage.
- The front end has also been enhanced to determine if when a value changes it is up or down from the previous value this is now represented by cell changing color for a few seconds on update.
- I have changed the backend to front end refresh time from every 30 seconds to ever 15. Then from every 15 seconds down to every 5 seconds. At this time it appears to be holding up. It is highly likely that I will need to introduce Multi Threaded programming to the Python backend so that the backend processes quicker for a more real time solution in the long run. At this time the backend is Sequential. For example. It Gets the Rates, Then the Wallets, then Calculates values. Where as in the future it could get the Rates and Wallets at the same time to speed up the process.
- I have also introduced a Kanban board on Trello so that I note down all my ideas for future work. I am not great at maintaining it but I am trying hard. (The Board can be found here)
Development Update Video:
Update #3 (December 8th):
- New Learning experience. Deploying a Flask app and all its dependancies to Heroku. Went through the process of opening up an account configuring the Heroku CLI and loading up the project to the Heroku container.
- Had issues with deploying initially. Was running Python 2 Dependancies. Had to generate a “Runtime.txt” file to point Heroku to a Python 2 version.
- Also had to secure up the app a little
- Removed Keys from within the Code before pushing to GIT.
- Replaced with Environment Variables.
- Removed the Key from the JSON payloads.
- Spent a lot of time trying to learn about environment variables. Couldn’t get anything to work at first.
- Minor Updates to GUI include removing infinate row creation for Both Wallets and Rates. The JS code was executing new row creation for every single recall to the sever. Every time the data updated it created a new table row for each returned data set but updated the values in the original table. So the HTML page was growing massively but not actually adding new rows.
- Introduced rowID naming for both the rows in the Rates and Wallets tables. These were until this time Blank.
- Did some Minor Multi-Device testing with the App now on Heroku
- Ultimately it still looks and behaves the same. But now it is online!