# 6. Technical Architecture

<figure><img src="https://718049331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkOmpZnhLCrdaptEDr3uA%2Fuploads%2FWTIry19jdI3p0bHEAC2b%2FTrivex%20Tech.png?alt=media&#x26;token=3fffaa91-9bd3-48d9-8878-15cd31388f8f" alt=""><figcaption><p>6<em><strong>-1 System Overview</strong></em></p></figcaption></figure>

Trivex consists of a frontend system called Trivex Web, smart contracts known as Trivex Contracts, a bot named Titan, and a backend API system called Strategy API. These components work together to provide smooth order execution and a strategy marketplace for users.

## 6.1 Trivex Web

Trivex Web is the main application of the platform, built using React.js along with various component libraries to deliver a seamless trading experience. It is deployed via Cloudflare, ensuring fast and secure access for users worldwide. The platform consists of four main sections: the trade page, the strategy page, the settings page, and the stake page. The trade page features a TradingView widget for market visualization, an open order section for placing trades, and a close order section for managing and closing existing positions. The strategy page allows users to configure and monitor algorithmic trading strategies, while the settings page provides account management options. Lastly, the stake page allows users to deposit funds to provide the liquidity needed by the Trivex system.

## 6.2 Smart Contract

The smart contract is the first point of interaction between the client side and other components. Orders and strategies are verified through the smart contracts, which update the corresponding storage values based on their functionalities. This is where Trivex implements the AMB and IOB systems. The Automated Market Balancer (AMB) considers various factors to determine trading fees and lender reward APY. The Internal Order Book (IOB) is checked first to find any opposing internal matches for an order. Any unmatched orders are stored in the external order book and handled by the Titan bot.

## 6.3 Titan Bot

The Titan bot enables Trivex to hedge risks from unmatched orders in the external order book. When an update occurs in the external order book within the smart contract, it triggers Titan to place a corresponding order with an external broker. This bot operates 24/7 to continuously monitor and manage changes in the order books.

## 6.4 Strategy & Trade API

The Strategy API, also written in Python, enables automated trading by processing user-defined parameters. Upon receiving strategy configurations from Trivex Web, the API triggers the relevant trading algorithm, retrieves historical and real-time market data, and analyzes price trends. The results are then sent back to Trivex Web, allowing users to review the strategy's performance and make informed decisions. The Trade API only fetches the latest prices and database values for the points system. Actual order execution is handled by the smart contract and Titan, not the APIs.

## 6.5 Azure Integration

Trivex’s backend relies on an SQL database to store and manage user data, which currently consists of points. The structured data storage ensures efficient querying, transaction integrity, and scalability.\
As part of its scalability plans, Trivex will integrate with Azure to enhance performance, security, and reliability. User data will be stored in the cloud to support scalability, while APIs will be hosted on Azure for improved efficiency and secure communication. This integration will provide a robust infrastructure capable of handling increased platform usage while maintaining high security standards.
