Key Definitions
API Key: An API key is an alphanumeric string that is used to identify and authenticate an application or user to interact with API/WS endpoints. This is required for almost ALL endpoints covered in this documentation except
/marketREST and/ws/marketWS endpoints. This key is NOT used for signing; that is done using your Private/Secret key.Private/Secret Key: A private key is a cryptographic code that's used to sign transactions and to prove ownership of your Hibachi Account. NOTE: This is NOT your crypto wallet’s private key. You will ONLY use this key to generate
signaturesfor a subset of endpoints you are interacting with.Trustless Account: A trustless account is a Hibachi Account you created via directly connecting to your crypto wallet. You will generate a signature with your
ECDSA Private Keyusing the ECDSA method.Exchange Managed Account: An exchange managed account is a Hibachi Account you created via email or social login. You will generate a signature with
HMAC Secret Keyusing the HMAC method.Asset Quantities: All quantities on Hibachi are represented internally as 64-bit numbers. In order to enable trading fractional quantities (e.g. 0.01 BTC), each asset on Hibachi has a specific fixed number of decimals.
Example
BTC may be represented with 10 decimals
This means 1 BTC is stored as 1 x 10^10 = 10,000,000,000 quantity on the exchange
When making trades, querying positions and similar, Hibachi will still expose and expect numbers as "real" float strings (e.g. "quantity: 1.0" for 1 BTC).
This way, users don't need to constantly convert numbers in order to be able to reason about them. However, this quantity notation is important when:
Signing any operations (trades, withdrawals, etc) since we want the traders to specify exactly what they want to trade and not leave room for misinterpretations.
Interacting with the Hibachi smart contracts
The number of decimals is exposed for each contract in the
/market/exchange-infoendpoint response under theunderlyingDecimalsfield.
Asset Prices: Like quantities, asset prices are also 64-bit numbers that conform to decimals. Prices are used when converting between underlying and the settlement token in a market.
For example, on BTC/USDT-P a price of 100,000 may be used in a limit order to indicate that somebody is willing to sell BTC for 100,000 USDT per BTC. Price is always denoted in units of the settlementAsset.
Since both the underlying and settlement assets have unique quantity decimals, the price is stored in the difference between both decimals (settlementDecimals - underlyingDecimals).
In order to support higher resolution of prices, an additional price multiplier of 2^32 is used to represent prices as fixed-point decimals with 32 bits after the decimal point.