This provides a template for Telegram trading bot on X Layer Mainnet that uses and Wallet APIs, and Dex APIs from OKX OS
It stores wallet data in a the local Replit database.
NOTE: This sample app is for demonstration purposes only. Make sure to persist your private keys, and deposit only small amounts of ETH to reduce the risk of losing your funds.
If there is specific functionality you'd like to see in OKX OS that is missing, please file it as an issue, and we will get back to you as soon as possible.
You can also contact us via the OKX OS Discord Channel.
-
Click "Use Template" to fork this repl.
-
Provision a OKX OS API Key.
-
Provision a Telegram Bot Token and register your Bot.
-
Generate a 32-byte encryption key using OpenSSL:
openssl rand -hex 32 # Save the output to use as the encryption key in Step 5.
- Set the following environment variables via a
.env
file or the Replit Secret Manager:
TELEGRAM_BOT_TOKEN="Your Telegram Bot Token"
OKX_PROJECT_ID="Your OKX API Project ID"
OKX_API_KEY="Your OKX API Key"
OKX_API_SECRET_KEY="Your OKX API Key Private Key"
OKX_API_PASSPHRASE="Your OKX API Key Passphrase"
ENCRYPTION_KEY="Your hex-encoded encryption key"
- Run the project:
npm install
npm run start
-
Send the
/start
message to the Bot you provisioned in Step 3 on Telegram, and start trading! -
Optionally deploy the project to keep it running.