Dev Blog #1 – July 2022
Dear Early Birds, as well as everyone who follows the development of our product!
Starting July, the Biqutex team will be publishing a monthly blog that will give you invaluable insights into all the inner workings and processes of project development and design, as well as our plans for the near future.
Hi, everyone, It’s Alex on the line, the head of the Biqutex development team. I am delighted to welcome everyone to this blog, as I will be in touch all the time to delight our dear readers with tidbits about life on the other side of the development process, and the operation of such a complex system as a derivative crypto exchange. Still, I will be refraining from any zeal and excessive technical details, since we are not writing these texts for diehard programmers.
Pure mathematics lies behind asset prices and each of the trading indicators that a trader focuses on when building their strategies. Many calculations are involved, which, in the end, reflect some unique vision of a particular exchange. But the bulk of these calculations is concentrated around a system of indices.
An index is a kind of integrated mathematical indicator, a value that reflects the state of an asset, or its parameter, at the time of calculation. Most importantly, it is a derived value from the measured entity itself. The simplest real-life example is the body mass index (BMI), which calculates the ratio of body’s weight to the square of its height. Once the simple mathematical aspect fades away, what remains is an abstract figure. And although the formula itself is extremely simple, you can work with it in very different ways. For example, you can weigh yourself in the morning or in the evening. Or at noon. Or at a certain external temperature. What about pressure? The clothes you wear and whether their weight is constant is also in question. For instance, your black T-shirt or a white one, even if its produced by the same manufacturer, may have a different composition and different weight under varying conditions. All of these minute factors lead to the fact that trading with the same contract is profitable and straightforward on one platform, but may not be that straightforward, or even negative, on another.
Finance involves even more variables. In addition, an index obtains its final value only after the compilation of its history. The actual meaning it bears here and now is not that important.
Traders often focus on changing the values of the index, and not its actual value.
In addition to formulas used for deriving the index, the most important criterion is the continuity of the calculation and the interval. When it comes to derivatives, different indices are calculated according to their intervals that range from seconds to minutes, to hours. At Biqutex, we had initially decided to focus on a calculation interval of 1 second. In cases when such short measurements were not required, a 1 minute was selected. The given minute is collected as a weighted average from a series of second calculations, so, in fact, all of the indicators are calculated at the same pace, or once per second.
Thus, derivatives are evaluated based on indices, which form a group or family of indices for each contract:
- The Spot Price is a spot market index consisting of some nominal price for an asset when buying “here and now”. I would like to note that not everything is as straightforward in this regard, since once cannot follow layman logic by just “going to Binance” and seeing how much Bitcoin costs right now. We will definitely delve deeper into the subtleties of building spot indices in a separate article.
- The Mark Price (Fair Price) is the so-called marking price, or fair price, at which the trader’s positions are evaluated at each moment in time. Traders rely on it when calculating the uPnL (Unrealized Profit and Loss).
- The Impact Price is the price of influence. This is quite an interesting and underestimated indicator. In a nutshell, this is the average buy/sell price of an asset if you were currently buying/selling a large order. The name itself implies that such a transaction will lead to an impact on the market and shift current prices.
This term is one to mark truly active DeFi participants who conduct exchanges on platforms like Uniswap (AMM-based), where each transaction shifts the price due to the very algorithmic nature of such a market.
If you are focused on trading liquid contracts, such as BTC / USD or ETH, then it is appropriate to consider that the Impact Price is simply the current market price. Indeed, there is so much liquidity in such markets that any large order put up by any individual trader, even if it is $100,000 or even $1 million in volume, will be absorbed by the liquidity at the best price in the order book (Best Bid / Ask or Top-of-Book in terms of the exchange).
But the market is not made up of just chocolate or vanilla ice cream (for those who do not understand the analogy, this is a reference to one of the most striking scenes in the cult film “Thank You for Smoking”). For contracts that do not have as much market activity as BTC and ETH, the Impact Price will already be significantly and unpredictably different from the current market price. Therefore, exchanges consider this indicator for all indices and all contracts, even though this is the most resource-intensive and complex indicator in terms of the mechanics of the underlying calculations. But if you have to do it, you just have to do it.
- The interest rate, or to be more precise, the difference in interest rates on the underlying asset of the contract and the currency in which it is rated. To put it in even more precise terms, it is rated in the currency or basket of currencies in which the contract margin is denominated. This is one of the most interesting and challenging of indicators.
As in the previous case, the essence of the indicator is simple when it comes to top currencies, since the current market rates can be observed on a variety of resources. However, the rates may not be available for some more exotic contracts. It is possible that there is no credit market at all for some obscure token X, and the contract X / USD – PERP needs to be calculated manually.
At Biqutex, we have taken an original approach to using real interest rates that are updated constantly, or once every 15 minutes, to be precise. Given the contracts we apply, we use a whole range of different rates.
When it comes to tokens and coins, if markets for them exist, we take the average rate (APY). Contracts for coins that are not stablecoins are marked in “nominal USD”. In these cases, we rely on the rates of Federal Reserve Treasury bonds (U.S. Treasury interest rate) for a period of 2 years as the base interest rate. There is a lot to explore in this regard from the standpoint of financial engineering, as one can choose other rates, introduce correcting factors, etc.
For stablecoins (for example USDT / USD – PERP or USDJ / USD – PERP contracts), a basket of stablecoins is used as a margin currency, which includes all listed stablecoins. Interest rates in DeFi are constantly changing, depending on different factors, so we have decided to limit the sample to fairly reliable sources. For example, the TLV must be at least $1 million, and the interest rate itself is not just an average, but a TLV weighted average between all projects. We will not be disclosing the intricacies of the algorithm at the given time.
- The Premium Index is, in fact, an index that indicates how much the current fair price of a position’s valuation (mark price) is different from the market spot price. That’s right, it calculates the premium at which current futures are valued against the cash market.
- The Funding Rate is probably the main indicator for which all of these calculations are made in the first place. In the world of Perpetual contracts, this is the most important parameter that indicates the size of the periodic payment of one of the parties, like the holders of a short position to long positions or vice versa, which is designed to conduct such a “pseudo” contract settlement, since perpetuals do not have time limits. This payment is a kind of encouragement to those who follow the market trend, or vice versa, acting as a reward for holding a position when everyone else rushed headlong in the wrong direction.
Each index depends on the previous one, as well as on its own history. Most often, the averaging of previous values is used instead of the instantaneous value. We at Biqutex use the EMA, an exponential moving average, to balance possible short-term market fluctuations. You can read more about the ways of calculating the EMA indicators (with formulas and illustrations) at the following link: https://www.metatrader5.com/ru/terminal/help/indicators/trend_indicators/ma
Still, the most important aspect in this entire conundrum is that we do not have the time for making all these calculations. We just don’t have it, that’s it. After all, we calculate all these indices. Indeed, we calculate not just one of them, but all of them, and there are dozens of the indices for all traded and planned contracts, and there hundreds and even thousands of them every second! Further still, this very second cannot be spent just on making calculations, since the exchange must have some time left to do something with these numbers. And there are many contracts in the pipeline.
So far, our first index engine system produces final indexes in less than 1 millisecond. To be precise, the typical timeframe is 0.625ms. We manage to get the actual values necessary for calculations within this timeframe, including the historical data, and then calculate all the numbers, display the final indices, and write the corresponding data to several different special storages so that other exchange modules can continue working with it.
Theoretically, the upper limit is 1,600 contracts. We can complete the calculations for such a number of traded instruments within 1 second. However, this task is very well parallelized, which makes it easy and simple to scale by adding servers and dividing the workflow between them. The first server counts for the first thousand contracts, the second server counts the thousand, and so on. Our internal metrics and future optimization are aimed at reading and writing indexes as quickly as possible. Ideally, the timeframe is 0.2ms for calculating all the necessary indices for one contract.
And there you have it. It turns out that there are many individual tasks hiding behind the simple numbers that the trader sees on the screen, and any figure is the result of multiple studies, optimizations, and tricks applied to make the processes run fast and smoothly. Our calculation process consists of 17 intermediate steps. And despite such complexity, everything actually does run very fast!
Thank you all for reading and see you again soon.
P.S. Here is a live screenshot from the test server, a live log that is visible on the developer’s side
We also have a section for those who feel that the provided material is insufficient. A so-called Advanced Level. Here are some of the coolest articles that will help you understand the different aspects of crypto finance in greater detail. It will be Difficult. You have been warned!
- A Mathematical View of Automated Market Maker (AMM) Algorithms and Its Future (https://medium.com/anchordao-lab/automated-market-maker-amm-algorithms-and-its-future-f2d5e6cc624a#18c4)
- Understanding DeFi: flash loans explained (https://medium.com/monolith/understanding-defi-flash-loans-explained-1a5928a4a612)
- Death of the Degen – Trading Basis for Yield! (https://www.paradigm.co/blog/death-of-the-degen-trading-basis-for-yield)
Introduction to Early Birds Program From The CEO
My name is Pavel and I am the CEO of Biqutex. Today, I would like to tell you about the Early Birds program, probably one of the most advanced loyalty programs provided by any cryptocurrency exchange. I can tell you at the very least that when we conducted market research, we could not find anything like this among any of our competitors:) As a rule, exchanges start attracting users after they are launched on standard terms with full commissions without offering new traders any preferences or bonuses. However, we decided to take a different approach by giving our future users the opportunity to take part in the creation of the exchange and allow them to shape in the way they wish to see it. That includes giving voting rights for decision-making on key issues, which are usually taken by project teams behind closed doors.
In addition to personal discounts, the program also provides bonus USDT, coupons for paying trading commissions, free withdrawal packages, and many other rewards!
Thus, by helping our team, you will be receiving discounts and bonuses all throughout the Early Birds period. This will allow you to trade with zero commissions, use bonuses as margin, and withdraw profits to your wallet without incurring any additional fees.
Here is a short list of topics that will be discussed with Early Bird program participants:
- The types of tools you need. These include instruments in addition to the standard perpetual/term futures and options. Our team plans to implement exotic tools, such as Calendar spreads swaps, interest rate swaps, Index Futures, NFT price floor Perpetuals and more;
- Composition and balancing of spot indices used for settlements of derivative instruments on Biqutex;
- Designs for the trading terminal, personal account, mobile application, and other interface elements. The design team will be putting up several concept layout options up for discussion by the community;
- An algorithm for liquidating positions in case of lack of collateral. Our goal is to make liquidations as fair and transparent as possible;
- Options for voting on asset listings, etc.
In the future, we will introduce a referral system and a program for ambassadors. You will be able to share your registration link with your friends and followers. We have also prepared a welcome bonus for invitees, and you can receive up to 3,000 USDT for each referral after the launch of the exchange, subject to minimum deposit and trading volume conditions.
What About The Design?
Hi there! I’m Dima, the designer at Biqutex. Let’s get to know each other a bit better. I’m responsible for the UX / UI at Biqutex. The goal of the exchange’s design team is to make the interface as convenient as possible and visually striking. That is why we are working on one of the activities right now, where you, our dear users, will be able to express your feedback about the platform, share your experience of interacting with it, and act as an art director for the exchange.
However, in addition to providing convenience, I will also be doing everything within my power to make sure the project remains engaging for users and keeps on surprising them with creative ideas. For example, before the release of the main platform, you will be guided down you user journey by 2 wonderful ladies symbolizing bulls and bears. They are the main characters of the exchange and our muses. They have been waging war for quite a long time, and epic battles will unfold between them across different markets on the Biqutex exchange. What do you think of them? What’s your take on these femme fatales? Write your feedback on Twitter and I will definitely read it!
We have assembled a small but powerful team and are working on releasing a truly unique product in the near future, one that will be attractive in terms of its functionality, capabilities, and visual appeal. Creative events, great prizes and many captivating characters with their own backstories are waiting for you. And the opportunity of each Early Bird to vote for the preferred interface design of the products in the ecosystem will be a key selling point of the exchange.
Registration for Early Birds will open this month. VIP levels and cash prizes will be drawn for the first 100 registrants. Subscribe to our accounts in social networks to become one of the first participants!