Steemit Learning Club S23W6 || Enhancing and Adding Features in Web based TradingDashboad to set marin mode, Laverage and modify SL and TP

header.jpg

Hi everyone! How are you doing all ? I hope that all of you are fine and happy in your life and hope you have a delighful movements for Eid-ul-Fitr. As we know that it is the last week of our tech club participation, and at this I would like to show you my fully working TradingBoard Project with enhanced features and fully user controll master client model. Let's dive into the detail of upto date Dashboard of TradingBoard.

Previous Summary

This summary of previous posts in which we see a trading dashboard project built with the use of Flask and the Bitget API. The application separate the master account from multiple client accounts to display the real time balances, maste trades, and positions. It replicate trades from the master to client accounts by automate the order placement, SL/TP replication to all client accounts, and even the closing positions for better risk management. The system use the secure HMAC signatures to authenticate the API calls, ensure that the accurate and up to date account insights. I work for future enhancement including add features to change the margin mode, and adjust leverage, and modify stop loss (SL) and take profit (TP) orders.

01.PNG

Enhanced Margin & Leverage Management

TradingBoard is now offer the control over the margin modes and leverage setting where user can adjust the wanted laverage, it is provide the help to optimize risk and strategy execution.

New Features:

To update the margin mode we can switch between isolated and the cross margin modes with single click, adapt to market condition instantly. Search & Select pairs is used for quickly locate trading pair using the search bar, ensure the precise adjustment without manual scrolling. Adjusting Leverage dynamically, user can customize leverage settings for each pair directly from dashboard, with real time validation to prevent the possible errors.

How It Works:

  1. Search box for a trading pair in update table.
  2. Select the desire margin mode between isolated and crossed.
  3. Input your prefer leverage value.
  4. Click on "Update Settings" button to apply change across master and client accounts.

02.PNG

Granular TPSL Control

User can manually adjust StopLoss and Take Profit levels for single trades and entire portfolios, ensure to tailore the risk management for both master and client accounts.

Manual Adjustments for Precision

I can update both SL and TP prices for specific trading pairs by enter the precise value into the dedicated input fields. Real time validation and prevent errors, allow to users to refine exit strategy with confidence, even in the volatile markets.

Bulk Replication for Efficiency

To perform operations, the platform enable the bulk application of SL/TP setting across all link client accounts in single action. This eliminate the repetitive manual updates, ensure that uniformity in risk parameter while save time for large scale portfolio.

Real-Time Feedback & Transparency

The system alao provide instant alert, such as “No TPSL replication results available,” to keep user inform about the status of their adjustment. This transparency ensure to traders can verify action and troubleshoot immediately.


How it's work logically ??

This modification shows that how to securely send command to Bitget API into two main steps, firstly setting the margin mode and adjust the leverage for trading positions. Here is the details of what happens in this terms:

1. Setting the Margin Mode

firstly it's start with the usser input by asking the user which margin mode to use, liokie "crossed" or "isolated". It create the JSON body that include details such trading symbol from user input, product type, choose margin mode, and margin coin. The given script get the current time in milliseconds as it required according to Bitget APIs decumentation.

It build string by combining the timestamp, HTTP method like POST, endpoint URL, and the JSON body. Using secret API key, it generate the secure signature using the HMAC algorithm, then encode this signature in base64. It set up header that include API key, passphrase, the timestamp, and the generated signature. and a POST request is send to Bitget API endpoint to set the margin mode.

2. Setting Leverage for Long and Short Positions

Next, it will ask for two leverage value one for the long position and other one for short positions. Here is a helper function, set_leverage, is define to handle sending this request. It takes basically two parameters: the side of position like long and short and the desire leverage.

Inside this function, it create a JSON body that include the trading symbol, and product type, and margin coin, and the desired leverage, and whether it is for a long and short position. It then repeat the process of generating the timestamp and create the "prehash" string. As again, it use HMAC with SHA-256 and base64 encode it to generate a secure signature. then it send a POST request to Bitget leverage setting endpoint /api/v2/mix/account/set-leverage with the headers containing the credentials and the signature.

Overall Logic

Authentication:

Each request to Bitget is secure by generating the unique signature with the use of API secret, ensure that the server can verify the request authenticity.

User Interaction:

The program interact with the user by ask for necessary parameter margin mode or leverage values before sending a request.

Secure Communication:

Include the current timestamp, method, and endpoint, and body in signature, the server can ensure that the request has not been alter and is coming from a trust source.

this provided code securely communicate with Bitge API by gathering the user input, construct the detail request with security measure like a signatures, and then send this request to update trading account settings.

How it's work functionally ?

Here is the quick overview in which how the we can change the laverage and margin mode of a specific pair, and then we can manage our risk for all master and clients model, and it will change for all connected acounts before placing the trades.

GIF2.gif

Here is the another approach on the app of bitget where we can analysis the changing of margin mode and then the laverage.

gif222.gif

here when the user change the margin mode and the laverage, it has ben changed in all accounts, firstly, it will change the margin mode on all connected accounts and then it will change the laverage, at this gif we can see the firstly, it changed the margin mode from "Crossed" to "Isolated". and then change the laverage for both long and short. And after this i wanna talk about the another feature of my tradingboard is that to modify both stoploss and target, because as we know that the trailing stoploss is really important to secure our earned profit and so i add this into my dashboard. as It is necessary that user have already the sl and tp order because if he has this then he will be able to modify it.

I need some more time to complete my this section because it is working from the general program but it was not working from my embanded feature from my tradingboard, but i wanna describe the general idea of this as how it can be worked.


5757.PNG

In this we can put new prices for stoploss and target to modify this, as it will update both on all accounts include master and clients. Here is the all updated files in the GitHub Repository where user can see how it will work and get the basic idea of that program.

Now i invite my friends @suboohi, @sualeha, @ulfatulrahmah, @sdutaskitchen, @chant, @seh-rish, @josepha and @wilmer1988 to participate in this challenge. Special thanks to the mentors @kafio @mohammadfaisal @alejos7ven.

Regards,
Faran Nabeel

faran.png

Sort:  

Upvoted! Thank you for supporting witness @jswit.


💦💥2️⃣0️⃣2️⃣5️⃣ This is a manual curation from the @tipu Curation Project

@tipu curate

This is different project from last week?

yeah, this is my first and complete project that is totally functional from now, through this now i easily manage my trades.

yeah, now i can work on my new project and only focus on it, that is my previous week project.

hola,

Has desarrollado un proyecto bastante completo para este desafío, la verdad es que creo que es bastante complejo porque no estoy 100% metido en el mundo del Trading, por lo que puedo ver la interfaz es bastante elegante y ofreces un montón de funciones que pueden ser de mucha utilidad para las personas conocedoras de la materia.

Gracias por participar te deseo exitos

Thank you so much for your support and love

New to Steemit?