Reset CountDown

Client Library:

The method resetCancelOnDisconnectTimer allows users to reset the timer for Cancel On Disconnect All Open Orders (dead-man-switch) feature.

You can set, reset, and delete countDown for all of the markets, using this method. Only the whitelisted sub-accounts and the parent can reset countdowns on behalf of the parent.

Once the system receives a countdown request from the user, it will reset the countdown time (or set if this is the first time). After the timer has been set once, in the absence of a reset countdown request, the system will interpret this as the user getting disconnected from the server. It will carry out cancellations on all specified markets. Note that If the countdown time parameter is inputted as 0, the countdown will be disabled for that market.

Examples:

import { 
  Networks,
  FireflyClient,
  MARKET_SYMBOLS
} from "../index";

async function main() {
  const dummyAccountKey =
    "a182091b4d5a090b65d604e36f68629a692e3bf2aa864bd3f037854034cdd676";

  const client = new FireflyClient(true, Networks.TESTNET_ARBITRUM, dummyAccountKey); //passing isTermAccepted = true for compliance and authorizarion
  await client.init()

  client.addMarket(MARKET_SYMBOLS.BTC);

  const response = await client.resetCancelOnDisconnectTimer({
    countDowns: [{ symbol: MARKET_SYMBOLS.BTC, countDown: 10 * 1000 }]
  });
  
  console.log(response.data);
}

main().then().catch(console.warn);

import json
from config import TEST_ACCT_KEY, TEST_SUB_ACCT_KEY, TEST_NETWORK
from firefly_exchange_client import FireflyClient, MARKET_SYMBOLS, ORDER_SIDE, ORDER_TYPE, Networks, OrderSignatureRequest
import asyncio

from firefly_exchange_client.interfaces import PostTimerAttributes



async def main():

  client = FireflyClient(True, Networks[TEST_NETWORK], TEST_ACCT_KEY)
  await client.init(True)

  print("User: ", client.get_public_address())
  client.add_market(MARKET_SYMBOLS.BTC)
  client.add_market(MARKET_SYMBOLS.ETH)

  countDownsObject: PostTimerAttributes = dict()
  countDowns = list()
  countDowns.append({
            'symbol': MARKET_SYMBOLS.BTC.value,
            'countDown': 3 * 1000
          }
         )
  
  countDowns.append({
            'symbol': MARKET_SYMBOLS.ETH.value,
            'countDown': 3 * 1000
          }
         )

  countDownsObject["countDowns"] = countDowns
  try:
    # sending post request to reset user's count down timer with MARKET_SYMBOL for auto cancellation of order
    postResponse = await client.reset_cancel_on_disconnect_timer(countDownsObject) 
    print(postResponse)
 
  except Exception as e:
    print(e)
 
  await client.close_connections() 


if __name__ == "__main__":
     event_loop = asyncio.get_event_loop()
     event_loop.run_until_complete(main())

HTTPs

Alternatively, if you have obtained your API auth token, you may use this to reset CountDown by making an HTTPs call to the POST /dms-countdown by using the tool on the right or locally from any other language supporting HTTPs network calls.

Language
Click Try It! to start a request and see the response here!