Drift Protocol v2

โŒ˜K
๐Ÿ‘พWelcome to Drift Protocol
๐ŸงฎDrift DEX
๐Ÿ‘‹Getting Started
๐Ÿ“ˆPerpetual Futures
๐Ÿ“ŠSpot Margin Trading
๐ŸฆBorrow & Lend
๐Ÿ›๏ธStaking
๐Ÿ”ฌTechnical Explanations
๐Ÿ“Accounting and Settlement
โž—Borrow Interest Rate
๐Ÿ“œDelisting Process
โ›ฒDrift AMM
๐ŸƒJust-In-Time (JIT) Auctions
๐Ÿ“šKeepers & Decentralised Orderbook
โ˜ ๏ธLiquidators
๐Ÿ’งLiquidity Providers (LPs)
๐Ÿ“‹Protocol Guard Rails
๐Ÿ“Risks
๐Ÿ–ฅ๏ธDeveloper Resources
๐Ÿ“”Overview
โŒจ๏ธSDK Documentation
โŒจ๏ธTutorial: Bots
โš ๏ธTroubleshooting
๐Ÿ› ๏ธKeeper Bots
๐Ÿ› ๏ธTrading Bots
โŒจ๏ธHistorical Data (v1)
โŒจ๏ธAPI
๐Ÿ›ก๏ธSecurity
๐Ÿ›ก๏ธAudits
๐Ÿ›ก๏ธBug Bounty
โš–๏ธLegal and Regulations
๐Ÿ“Terms of Use
๐Ÿ“Disclaimer
๐Ÿ“Privacy Policy
๐Ÿ“Competition Terms and Conditions
๐Ÿ“šGlossary
Docs powered byย archbeeย 
9min

Tutorial: Order Trigger Bot

Introduction

Order Trigger Bots (Trigger Bots) are responsible for marking orders that satisfy the trigger condition, including:

  • Trigger Market Orders - Stop Market and Take Profit
  • Trigger Limit Orders - Stop Limit and Take Profit Limit

Trigger Bots receive a small compensation for each successfully marked order.

See ๏ปฟ๏ปฟ๏ปฟ๏ปฟKeepers & Decentralised Orderbook for a technical explanation of how the decentralised orderbook (DLOB) and matching incentives work.

Trigger Bots are similar to Matching Bots in that they:

  • also maintain a local copy of the Decentralised Limit Orderbook (DLOB);
  • do not require the operator to manage collateral; and
  • receive a small reward for performing their duties.

Getting Started

The reference implementation of a Trigger Bot is available here.

Follow the instructions at ๏ปฟ๏ปฟKeeper Bots to set the required environment variables and make sure a ClearingHouseUser is initialised.

Start the Trigger Bot:

Shell
|

๏ปฟ

Technical Explanation

1. Get nodes from the DLOB that are ready to be triggered

๏ปฟ

The DLOB implementation includes a method for getting orders ready to be triggered:

TypeScript
|

๏ปฟ

2. Call trigger_order on ClearingHouse

TypeScript
|
Updated 20 Oct 2022
Did this page help you?
Yes
No
UP NEXT
Tutorial: Liquidation Bot
Docs powered byย archbeeย 
TABLE OF CONTENTS
Introduction
Getting Started
Technical Explanation
1. Get nodes from the DLOB that are ready to be triggered
2. Call trigger_order on ClearingHouse