Skip to content

Small nodejs Tool for auto trading STRK vs ETH on Starknet

Notifications You must be signed in to change notification settings

mauser001/stark-eth-trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Stak-Eth Trader

This tool is open source. Feel free to use / copy / modify it.

Disclaimer

Use at your own risk! This is not a financial tool, you can loose all your coins! It is just an experimental tool and should not be used to to try to gain money!

Description

This tool tries to trade Strk vs Eth on Starknet via the Avnu Dex aggregator . It tries to gain the amount of tokens.

Used tech / Prerequisites:

Installation

  • clone git repo
  • run script npm install
  • copy the .env.example to .env and set the Private and Public key
  • in th package.json change the path's of the .env and data file to your liking (and also name and place the related files accordingly)
    "prod": "npm run build && node --env-file=prod.env dist/app.js"
  • then run script npm run prod (if you first want to try it on Testnet you can run 'npm run dev', but at creation of this Sepolia was not yet supported by Avnu and Görli was about to die)

.env file

  • USE_TESTNET - true/false
  • ETH_TOKEN - eth token address
  • STARK_TOKEN - strk token address (in theory you could also use another supported token address to trade against eth)
  • WALLET - your public wallet address
  • X - your private key
  • SELL_PERCENT - percent of your total amount that should be traded within one trade
  • MIN_GAIN_ETH - How much ETH should be gained when selling STRK
  • MIN_GAIN_STRK - How much STRK should be gained when selling ETH
  • TRADE_FILE - relative path to the trading data file, make sure it exists and has the initial content:
[
	{
		"hash": "initial",
		"status": "SUCCEEDED",
		"matchedBy": "initial"
	}
]

Program logic

  • Initially it gets your token balances
  • It then get the trading quotes from Avnu
  • If the ratio is good enough the trade is concluded
  • Then in the future if the price goes in the other direction it then tries to sell the stack back to gain coins.

Reporting

Run script npm run report-prod to get a short summary of your trades

Cleanup

Run script npm extract-prod to to extract already matched trades in ha separate file

Releases

No releases published

Packages

No packages published