How to use the command line interface

Query Trade

Note: This page describes how to use the 'mtcli' command line executable. This binary is currently available for Linux only

To use mtcli from the command line, you must have a synced Microtick node and you need to set the MTROOT environment variable to the same directory your synced node is using, for example:

$ export MTROOT=$HOME/testnet

Usage

$ mtcli query microtick trade <trade_id>

$ mtcli query microtick trade 4159
Trade Id: 4159
Long: cosmos1z0d007g5z6jll9fyflcczhku0dy9add3l82ge4
Market: ETHUSD
Duration: 1hour
Type: call
Start: 2019-10-03 18:11:28.528657103 +0000 UTC
Expiration: 2019-10-03 19:11:28.528657103 +0000 UTC
Filled Quantity: 17.734606000000000000quantity
Backing: 41.595235522540384000fox
Cost: 3.875548114997291099fox
Commission: 0.025000000000000000fox
Settle Incentive: 0.025000000000000000fox
Balance: 1013.716365532439226967fox
Counterparties: [
   Short: cosmos1a5ylxkr2gu7dz0aj6dpe7ly0c3t70rm73md5p3
       Quoted:
           Id: 4084
           Premium: 0.234542766400000000premium
           Quantity: 21.318073785625818388quantity
           Spot: 174.326924806600000000spot
       Backing: 41.595235522540384000fox
       Cost: 3.875548114997291099fox
       Filled Quantity: 17.734606000000000000quantity
       Balance: 6907.122412368672709421fox]
Strike: 174.358949813217767240spot
Current Spot: 173.957288782974033412spot
Current Value: 0.000000000000000000fox

Description

Returns the trade parameters for a particular active trade ID. This command does not return historical trades, those must be queried using Tendermint search.

Output

Name

Description

Trade ID

Unique trade ID being queried.

Long

Account address of the buyer of the trade (the account paying the premium to the quote provider on trade initiation).

Market

The market identifier of the market the trade was placed on.

Duration

The order book duration the trade was placed on. This parameter determines the trade expiration time based on the time the trade was placed.

Type

Whether the trade is long (call) or short (put) the consensus price.

Start

The block timestamp when the trade was created.

Expiration

Trade start + trade duration gives the trade expiration.  The trade can be settled by any market participant sending a transaction after the expiration time. The market participant who settles a trade collects the trade settle incentive tokens.

Filled Quantity

The quantity of the trade. The value of the trade goes up with the consensus spot price according to quantity - more quantity gives a greater token profit per consensus spot price change.

Backing

The token backing for this trade. This is the maximum amount the trade can pay out. Backing is transferred from the quotes the trade was placed against into the trade contract at the time the trade starts. If the quote is left with no more backing after a trade, the quote is deleted.

Cost

Total token amount the long account paid to the short account(s) at the time the trade was placed.

Commission

Token amount paid to validators in commission by the long account when creating the trade.

Settle Incentive

Token amount paid by the long account and set in escrow used to pay the trade settler at or after expiration. Anyone can settle a trade and collect the settle incentive.

Balance

Account balance of the long account after placing the trade and paying the commissions. Used for account history queries.

Strike

Strike price of the trade.  Equal to the consensus spot of the market when the trade was initiated.

Current Spot

Convenience return value giving the current consensus spot of the market.

Value

Current value of the trade. Varies dynamically as the market consensus spot changes block-by-block. For calls, value goes up as the current spot rises above the strike price. For puts, value goes up as the current spot drops below the strike price. Value can never be negative.

The output contains an array of counter party information structures, one for each counter party to the trade. A trade can have as many counter parties as it takes to fill the requested quantity for a market trade, or the max fill for a limit trade. The counter party structures each contain the following information.

Name

Description

Short

Counter party account address for this counter party. This matches the provider of the quote used to fill the trade.

Quoted ID

Quote ID used to fill the trade.

Quoted Premium

The premium the quote provider asked for when placing or updating the quote.

Quoted Spot

The spot price the quote provider specified when placing or updating the quote.

Quoted Quantity

Total quote backing / (leverage * quoted premium) at the time the trade was placed.

Backing

Amount of backing transferred from the quote into this trade.

Cost

Portion of the total trade cost paid to this counter party.

Filled Quantity

The quantity filled from this quote. If Filled Quantity = Quoted Quantity, then the quote is left with no backing and is removed.

Balance

Account balance of the counter party account after filling the trade. Used for account history queries.