Types

Generic units used in data models used in Capitalgram.

Types aliases are used to give human-readable meaning for various arguments and return values. These are also used to hint Pyarrow schemas to make Parquet files more compact.

TODO: Clean up after Explicit Type Aliases have been merged and is widely supported https://www.python.org/dev/peps/pep-0613/

class tradingstrategy.types.CapitalgramType

Market class for our internal type definitions.

class tradingstrategy.types.PrimaryKey

64-bit integer based primary key.

Alias to int.

class tradingstrategy.types.NonChecksummedAddress

Ethereum address that does not use EIP-55 checksumming.

Alias to str.

class tradingstrategy.types.USDollarAmount

Express USD monetary amount.

Used in exchange rates, volumes and prices in candle data. Normally you should not use float for pricing, but because we are already losing a lot of accuraty in float conversion and our price data is not for exact transactions, but for modelling, this is ok.

class tradingstrategy.types.UNIXTimestamp

Seconds since 1.1.1970 as UTC time as integer.

class tradingstrategy.types.BlockNumber

EVM block number from 1 to infinity

class tradingstrategy.types.BasisPoint

Multiplier as 1/10000 or 0.01%