Venue Data

Credora leverages, amongst other libraries, the CCXT library to pull data from exchange venues, as well as other custom libraries to pull data privately from custody solutions, bank accounts, wallets and more. The libraries have been ported inside Gramine-SGX.

Architecture

The secure enclaves used by Credora have a Puller and Aggregator structure (as per the diagram here). Credora has implemented a system of venue-specific data pullers. Each venue interfaces with a unique puller that is responsible for retrieving data from the venue, performing necessary adjustments, and normalizing the data into a unified format. This approach ensures that data from various venues can be integrated seamlessly into aggregation logic.

Venue Pullers

The purpose of venue-specific data pullers is outlined as follows:

  • Unique Data Handling: Each venue has its own data structure and API requirements. The unique pullers are designed to handle these peculiarities, ensuring that data is fetched and processed correctly for each specific venue.

  • Data Normalization: These pullers standardize the data into a consistent format, essential for integrating multiple sources into our core aggregator logic.

  • CCXT Integration: Many venues are interfaced through the CCXT library, which provides a unified way of interacting with a wide range of venues. However, the data returned by CCXT sometimes requires further adjustments for consistency.

Additional venues: DYDX, Bit, Fireblocks, Copper, DeFi wallets and more

  • For venues such DYDX and Bit, which were not supported by CCXT at the time of development, Credora built custom libraries. These custom libraries are tailored to the unique API specifications of these venues and ensure that their data is aligned with the unified format used across our platform.

Aggregator Logic

  • Unified Data Representation: After the data is fetched and normalized by the pullers, it is represented in a unified format, which is crucial for the aggregation process.

Aggregator

The Aggregator class serves as a central component for aggregating and processing financial data from various exchanges. It utilizes specialized pullers (BasePuller instances) for fetching data and a public data handler (PublicDataHandle) for accessing real-time market prices. The aggregator computes key financial metrics such as equity, assets, liabilities, and the absolute delta of positions in USD, without revealing any of the underlying sensitive data.

Data Handling

  • The Aggregator processes data from multiple sources, ensuring consistency in financial calculations.

  • Real-time market prices are used to convert asset and liability values into USD.

  • The delta calculation takes into account the position side (long/short) and the market type (linear or inverse).

  • Exception handling is incorporated to manage errors during data fetching and processing.

DeFi Aggregator

The DeFi Aggregator class is designed to aggregate decentralized finance (DeFi) data across multiple wallets. It utilizes a combination of a puller to fetch wallet data and a Haruko Client for querying wallet balances from DeFi protocols.

Haruko Data

  • Primary Data Source: Haruko serves as the main data provider for the DeFi Aggregator, offering access to a wide range of blockchain networks.

  • Blockchain Coverage: It covers a diverse array of blockchain platforms, as indicated in the Blockchain enum, including major, emerging, and test networks.

  • Data Consistency: Haruko ensures consistent and reliable data across various blockchains, crucial for accurate aggregation.

Supported Blockchains

The Blockchain enum includes a comprehensive list of blockchain platforms supported by Haruko at present. These names are used as standardized identifiers across the system when fetching data specific to a blockchain.

  • Major Blockchains: Includes well-known blockchains like ETHEREUM, BITCOIN, SOLANA, and BNB_CHAIN.

  • Layer 2 and Sidechains: Networks like ARBITRUM, OPTIMISM, and POLYGON that offer scalability solutions.

  • Test Networks: Includes testnets like ETHEREUM_RINKEBY for development and testing purposes.

  • Emerging Networks: Represents newer networks such as CANTO, AURORA, and SECRET. Full List: AKASH, ARBITRUM, AURORA, AVALANCHE, AVALANCHE_X, BITCOIN, BNB_CHAIN, CANTO, COSMOSHUB, ETHEREUM, ETHEREUM_RINKEBY, FANTOM, KAVA, OPTIMISM, OSMOSIS, POLYGON, RIPPLE, SECRET, SOLANA, STACKS, STELLAR, TERRA

Last updated