[ad_1]
Apex Pro is a decentralized non-custodial trading Platform that provides cross-margined perpetual contracts. Apex Pro is based on the order-book model with multi-chain support (for deposits and withdrawals), to provide seamless CEX like experience with the Security of a DEX. Read more about the platform here : https://apex-pro.gitbook.io/apex-pro?lang=en-US
Pre-requisites for making trades from TV via API
1.) A TradingView Pro account (atleast), we’ll be needing Webhooks to send alerts in order to execute trades on Apex Pro
2.) A Listener on a cloud service (recommended for maximum uptime) or a local PC. We’ll be using Render (https://render.com) for all the demonstration purposes in this guide. (A guide to setup on local PC will be shared later )
3.) An Apex Pro account (use this link for 5% off on trading fees: affiliates.pro.apex.exchange/b/deja or you can use the code “deja” in the referral section).
4.) Your API keys and Stark key and User ID (I’ll be showing you how to extract these in this guide).
Extracting your API and Stark keys from Apex Account
What are Stark Key? Apex users are identified within the exchange by their Stark Key which is a public key defined over a Stark-friendly elliptic curve that is different from the standard Ethereum elliptic curve.
In order to extract your Keys:
Step 1) Login to your Apex account on your PC browser then go to the trade section of the Apex pro website.
Step 2) Right click anywhere on the page then click inspect from the dropdown menu (You can also access this by pressing F12).
Step 3) A panel will open on the browser, in that panel find the tab that says “Application”, then find “Local Storage” on the left-side of the panel, then click “https://pro.apex.exchange/”
Step 4) In the “Key” column locate and select “keyPair” (This section contain your Stark Keys), note down both “publickey” and “privatekey”.
Step 5) Locate and select “userinfo” (This section contain your API Keys and User ID), note down “key, passphrase and secret” from the “apiKey” also note down “id” from “account”.
Now that we got your User ID, API and Stark Keys we can move on to installing the Tradingview Alert Listening service on the cloud service.
Setting up TradingView listening service on cloud
We’ll be using this listener service https://github.com/cj2094/apexpro-tradingview-connect.
What it does is simply listen for commands coming from TradingView alerts webhook to execute trades on Apex Pro exchange.
Since we’ll be using Render make sure to Sign Up if you haven’t already.
Step1) Go to the Render Dashboard, click “New +” in the top right then select “Web Service” from the drop down menu.
Step 2) Paste “https://github.com/cj2094/apexpro-tradingview-connect” in the Public Git repository section, click Continue.
Step 3) Name the service to your preference, make sure the “Branch and Runtime” are set to “main and Docker” respectively.
Select “Starter” from the Instance Type since we want the maximum uptime on our Listener .
Step 4) Click “Advance” then click “Add Secret File”, name the file “.env” then paste and edit the following in the File Contents section
# Required variables for apexpro
ETH_ADDRESS=
STARK_PUBLIC_KEY=
STARK_PRIVATE_KEY=
API_KEY=
API_PASSPHRASE=
API_SECRET=
ACCOUNT_ID=# Optional variables
TRADINGVIEW_PASSPHRASE=
SENTRY_DNS=
Step 5) Click “Add Disk”, name the disk then set the Mount Path to “/app/data” and Size to 1GB.
Step6) Disable the Auto-Deploy then click “Create Web Service” and wait for Render to deploy script.
Step 7) Once Render has deployed the script, click and copy the link under name of your web service, if you see this message “apexpro Account Ready: true” in the newly opened tab that means the listener is connected to your Apex Pro account and working properly.
apexpro Account Ready: true
Now we can move on to the TradingView section of this guide.
Connecting TradingView Strategy alert to Render web service
I’ll be using a simple RSI strategy in this guide to demonstrate on how to connect the Strategy alert to the listener we just created on Render.
Step1) Login to your TradingView account.
Step2) Go to Binance:BTCUSDT.P on the Tradingview chart.
Step3) Click “Strategy Tester” then “Load your strategy”.
Locate and select RSI Strategy.
Step4) Go to the Strategy setting then setup the Properties like Initial capital and Order Size.
Step5) Go to “Add Alert”
Paste the following in the Message Section:
{
“exchange”: “apexpro”,
“strategy”:”testStrategy”,
“market”:”BTC-USDC”,
“size”:”{{strategy.order.contracts}}”,
“reverse”:false,
“order”:”{{strategy.order.action}}”,
“position”:”{{strategy.market_position}}”,
“price”:”{{strategy.order.price}}”
}
Now go to the notification tab, enable “Webhook URL” and paste the Render webservice link then click Create.
All done! Now every time TradingView strategy triggers an alert, it’ll go to the Render Webservice Listener which will execute the trade on Apex Pro exchange.
Please Join Apex Pro discord (https://discord.gg/pcyrxBwF), if you have any query regarding API .
New to trading? Try crypto trading bots or copy trading on best crypto exchanges
Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News
[ad_2]
Source link