Qt Bitcoin Trader - a program for trading Bitcoin for Windows, Mac and Linux

    In this article I will show you how the Qt Bitcoin Trader program works, and tell the story of its development.
    This open source program allows you to quickly place bets on BTC-e and Mt.Gox, set rules for automated trading.
    It was written in pure Qt 4 using OpenSSL, and, in my opinion, it has interesting features from the development side, which I also want to talk about.


    During the April jumps in the Bitcoin exchange rate , I, and my friend Dybik , like many on the hub, became interested in this wonderful cryptocurrency. We, like, I think, many of those who read this article, decided to try ourselves on the stock exchange. As it turned out, the most popular exchange for trading Bitcoin is Mt.Gox. We registered there and started making first bets.

    The course was constantly growing, the excitement was growing. The whole Internet was buzzing about this, and I remember that even on TV then they talked about Bitcoin. We traded on the site Mt.Gox, and the site often crashed. Annoyed when you place orders, but can’t cancel. Rather, it turns out, but the cancel button did not give any confirmations or responses. It was unclear whether the order was canceled or not.

    Even then, I thought: “Why is there no way on the site to set the rules for creating orders?” You cannot follow the course around the clock; it would be nice to leave the rules for the night. I looked for programs and found python bots and some paid clients for the desktop that were incomprehensible to me then. “Edit file to correct the rule?” This is inconvenient, ”I thought. We need a program that will not allow us to make mechanical errors, skip zero or a comma.

    The course was constantly jumping, and we managed to profitably buy and sell. I tried to benefit at small jumps. In the order log of Mt.Gox, a separate item was clearly displayed with the amount of the purchase commission, but there was no item for sale. Commission only for the purchase, I thought. And when he counted, he realized that I was losing. There is also a commission for the sale, it is built into the amount. In my opinion, it would be more logical to do the same display of the commission for both sale and purchase. But maybe Mt.Gox specifically wants to confuse us? I do not know. I found out and started to trade further.

    It turned out a good amount and we realized that it was not in vain that we spent so much time. And then, well, you yourself remember, then came the complete collapse of the course, and we, too, came under attack. The site freezes, it was impossible to sell Bitcoin, and then Mt.Gox completely froze trading for a day. The course has plummeted. So I lost half the amount invested.

    What to do next? Surrender and withdraw the remaining amount? I didn’t doubt for a minute and started thinking about the strategy; it didn’t leave my mind. Looking for python bots? No, it became interesting to me to realize something of my own. When I just started trading on Mt.Gox, I already had a simple program before my eyes that I could not find anywhere and then I started developing Qt Bitcoin Trader.

    Meet - Qt Bitcoin Trader

    After the first launch, you will be greeted by the profile creation window.

    You need to choose a stock exchange, get an API key with the Info and Trade parameters, enter it into the program, then come up with a strong password.
    All data is stored in the user profile folder, encrypted using OpenSSL with AES256 encryption.

    In the login window you can enable the check for updates.

    For Mac and Windows users, there is an automatic update.
    Checking for new versions is carried out by downloading a file from GitHub , in which the checksum of the binary file encrypted using RSA2048 is saved. Therefore, there is no risk of malicious file spoofing.

    When the new version comes out, you will see a window like this:

    I tried to develop the interface simple, and so that everything was in sight. No offense to users with low screen resolutions, but I will optimize the interface for them later.

    On the left you see a list of open orders updated in real time.
    You can create buy and sell orders, but so that their amount does not exceed your balance. Recently, Mt.Gox immediately removes orders that exceed the balance.
    Finally, you can cancel the order, and immediately see its status “Canceled”, even if it still hangs on the site, the API receives a delivery confirmation.

    All market data is updated with one request, except for the latest price. It is also updated from the prices of recent transactions.

    The commission calculator is available by a small button in the upper left. I received feedback, and I made it the way users of online calculators are used to.

    It works the same way, except that the balance and the latest prices are automatically loaded, which is convenient.
    You can open as many calculators as you like.

    You can easily create a rule for automatically creating orders:

    Now you can create rules in two modes: “By turns” and “Parallel”.
    In parallel mode, when changing values, all rules are checked for similarity, and any of them can be executed. In the "In turn" mode, the second line of the rule will be checked only if the first is executed. You can change the order of the rules and edit them.

    For some values ​​there is a sound alert. The speaker icon is a switch button.

    It is possible to detach groupboxes, making them separate windows, which is undoubtedly convenient using multiple monitors.

    For Windows users, it is possible to enable portable mode. You need to create the QtBitcoinTrader folder in the same folder as the exe file, and all encrypted data will be stored in it.

    What is expected in future versions of Qt Bitcoin Trader?

    Now supported exchanges BTC-e and Mt.Gox. If possible free time, I will finish the support for the remaining most popular exchanges in turn.
    Maybe websocket api and http api work at the same time.
    Next is the display of graphs in real time.
    It will be possible to add the API of different exchanges and different currencies in one profile, for simultaneous monitoring.
    Scripting language, as an addition to the rules by which it will be possible to write a strategy analyzing prices on different exchanges in a few lines.

    How can you help me improve Qt Bitcoin Trader?

    At the moment, the program has been translated into English, German, Russian, Ukrainian, Spanish, Dutch and Norwegian.
    You can help translate the program into your native language. The program has a built-in translation engine. Click the “About program” button, and you will see the instruction:

    Press the “Translate program” button, and see the dialog:

    Here are all the fields that need to be translated. Fields with red text are fields that match the English translation.
    By pressing the “Apply” button, you will immediately see your translation in the program and you can correct texts that are too long. When you finish the translation, save the file and send it to the email address specified in the instructions. After checking the transfer, I will add it to the next version of Qt Bitcoin Trader.
    And do not forget to leave your contact information and Bitcoin address for donations in the "Translator:" field.

    You can also help in the development of the program financially, since the program lives only on donates.
    Support Bitcoin Address: 1d6iMwjjNo8ZGYeJBZKXgcgVk9o7fXcjc

    Official Qt Bitcoin Trader Resources

    GitHub source

    Download for Windows and Mac (SourceForge.net)
    Download from Softpedia for Windows
    Download from Softpedia for Mac

    BitcoinTalk RUS Forum
    BitcoinTalk ENG Forum
    BtcSec Forum



    As soon as my program appeared on the Internet, duplicates with a description of my program immediately began to appear.
    But, instead of links to the Qt Bitcoin Trader download, it is proposed to download the virus. I was surprised why there are so many Qt Bitcoin Trader fakes on the Internet. And even qtbitcointrader.com is a fake with a link to the virus, and www. qt-TRADAR.RU is also a fake. If I knew that the program would be so popular, I would immediately score these domains. I think this is a lesson for me and for everyone who reads this article.
    Be careful, if you do not know if the link is reliable, then google by name.
    I recommend using the secure update built into the program.

    Features of the development of Qt Bitcoin Trader

    Built-in translator mechanism

    Perhaps you are wondering why I did not choose the standard Qt Linguist for translating the program?
    I don’t like it, it can be convenient to edit the form, but to translate the file, you need Qt Linguist itself, and probably only 5% of all users of the program have it.
    Therefore, I decided to write my own engine, and make it convenient not only for developers, but for all users of the program.
    You can see the source code for the JulyTranslator class on GitHub. This is the base class that stores all word associations in QHash. This class can load and save translation files, as well as translate individual interface objects and load text from the interface into a file.
    For each interface object to be translated, I set a unique text identifier through setAccessibleName ().
    The translateUi (QWidget * parent) function of the JulyTranslator class bypasses all child widgets of the parent from the function parameter. Each widget that needs to be translated must itself call translateUi () in the constructor or by signal.
    For example, we bypass all the QPushButton buttons, check if there is an accessibleName () value, and if so, we get the association of this value from the JulyTranslator QHash class
    foreach(QPushButton* curButton, par->findChildren())

    The result is a class that loads a language from a file and applies it to the interface.

    Since I don’t always like the way QLayout works, after applying the translation, I go through each widget, calculate the minimum size to ensure a suitable view of the widget, and set the minimum width for it.

    Example for a button:
    foreach(QPushButton* pushButtons, par->findChildren())

    As a result, we save space in the interface, and the texts do not go beyond widgets.

    The second stage is to make the creation of a translation user-friendly.
    The TranslationDialog class is designed to generate a list of fields. It pulls out the entire array of texts from JulyTranslator and generates a QTextEdit for each field.
    Since I do not always like what the layout does with QTextEdit, I wrote a TranslationLine widget that, when changed, perfectly wraps text around to save space.
    You can observe this in the translator when you add something or put enter into text fields. The field automatically increases and decreases.

    Secure automatic updates only with GitHub and SourceForge

    The update principle is simple: the program at startup loads the raw.github.com/JulyIGHOR/QtBitcoinTrader/master/versions.txt file , which lies on GitHub in the clear.
    An SHA binary checksum encrypted using RSA2048 is saved in the file.
    Public.key is embedded in the program’s resource, and Private.key is securely stored and password protected, and only I have.
    When checking for updates, the program downloads the file from the specified link from the file to the RAM, if the file is larger than 15 mb, the download is canceled.
    Next, the checksum SH1 of the downloaded data is calculated, and compared with the decrypted information from the update file.
    If the checksum matches, then the program saves the file from the RAM to disk called QtBitcoinTrader.upd. After the verification check, it reads it back, and checks whether the file is well preserved. After successful verification, renames itself to * .bkp, and the * .upd file to the original file name.
    After restarting, the extra files will be deleted.
    This principle works the same for both Windows and Mac OS X.


    Remember, the program does not trade for you, it is only a tool to help you trade.
    I hope I did not drag out too much and the article was interesting to you.
    I will be glad to support, feedback and recommendations.

    Also popular now: