A crypto trading bot for Backpack Exchange. It trades perpetual futures automatically using custom strategies and real-time market data. Use at your own risk – bugs may exist, and the logic won't always yield profits. But if you know what you're doing, it might save you some time.
In order to run the script you need to:
- Install nodejs - https://nodejs.org/pt/download
- Create an subaccount in backpack exclusive for bot (low fund for risk)
- Create API Key for backpack exchange subaccount
- Configure the file .env with your setup, Save file.
- Run in terminal npm start
BACKPACK_API_KEYYour Backpack Exchange API key.BACKPACK_API_SECRETYour Backpack Exchange API secret.VOLUME_BY_POINTYour average volume per point on Backpack. For example:600. The bot will understand that for every $600 traded, 1 point is gained, estimating progress.PREVIEW_FARM_LAST_HOURSNumber of past hours to preview bot activity. For example:5will return the last 5 hours of performance.LOGEnables visible logs in the terminal when set totrue; disables whenfalse.TRADING_STRATEGYChoose your preferred strategy. Available options:DEFAULT,AUTOMATIC_STOP, andGRID.
Find market opportunities and open limit long or short positions with stop loss and take profit. Stop loss can be enabled optionally.
AUTHORIZED_MARKETMarkets allowed for trading. If set to'[]', all markets will be used. To restrict to specific markets, use something like:
'["BTC_USDC_PERP", "SOL_USDC_PERP", "ETH_USDC_PERP"]'CERTAINTYMinimum certainty level required by the algorithm to open an order. Higher values will result in fewer trades. Range:0 to 100.VOLUME_ORDERDefault order volume in USD.ENABLE_STOPLOSSEnables stop loss from theAUTOMATIC_STOPmodule when set totrue; disables whenfalse. Can be used together withDEFAULT.MAX_ORDER_OPENMaximum number of orders that can be open simultaneously (includes untriggered orders).UNIQUE_TRENDIf set to'', both LONG and SHORT positions are allowed. To restrict only LONG, use"LONG"; for SHORT only, use"SHORT".
Monitors open orders and attempts to update stop losses based on profit gaps.
TRAILING_STOP_GAPMinimum acceptable gap in USD between the current stop loss and the next one. Example: If profit increases by$1, the stop will be updated.MAX_PERCENT_LOSSMaximum acceptable loss percentage, e.g.,1%. This is calculated based on order volume — be cautious when using leverage.MAX_PERCENT_PROFITMaximum profit target percentage, e.g.,2%. Also based on order volume — leverage applies.
Places orders above and below the current price to create volume in sideways markets.
-
GRID_MARKET
Market pair to be used in grid mode.
Example:"SOL_USDC_PERP" -
NUMBER_OF_GRIDS
Total number of grid levels the bot will create betweenLOWER_PRICEandUPPER_PRICE.
Example:100creates 100 evenly spaced orders within the defined price range. -
UPPER_PRICE
Highest price where the grid will place orders. No orders will be created above this value.
Example:185 -
LOWER_PRICE
Lowest price where the grid will place orders. No orders will be created below this value.
Example:179 -
UPPER_FORCE_CLOSE
If the market price reaches or exceeds this value, all open grid positions will be force-closed (top trigger).
Example:185.5 -
LOWER_FORCE_CLOSE
If the market price hits or drops below this value, all open grid positions will be force-closed (bottom trigger).
Example:178 -
GRID_PNL
Estimated profit target for the grid. Once reached, all positions are closed at market and the grid is rebuilt.
Example:10
npm install
npm start-
@MBFC24
Suggested a strategy using neutral delta with collateral in the native token. I’m considering integrating this with real-time funding rates to enable shorting — this will be implemented soon as theLOOP_HEDGEmode. -
@Coleta_Cripto
Suggested a mode to simplify the process of earning Backpack’sAchievements. Coming soon! -
pordria
Created a Backpack grid bot. This project is based on their logic. -
@owvituh - GitHub
Forked my bot and added multi-account and multi-strategy support. I’ve taken several ideas from it for this version.
LOOP_HEDGEMode – Neutral delta with funding-based shortingAchievementsMode – Automates collection of Backpack achievementsFRONT RUNMode – Reacts to new token listings in real-time
If this bot has helped you, consider buying me a coffee!
SOL Address:
8MeRfGewLeU419PDPW9HGzM9Aqf79yh7uCXZFLbjAg5a