Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications if possible? #7

Closed
mvthul opened this issue Sep 22, 2022 · 8 comments
Closed

Modifications if possible? #7

mvthul opened this issue Sep 22, 2022 · 8 comments

Comments

@mvthul
Copy link

mvthul commented Sep 22, 2022

Is it possible to post the leverage and percentage used of available wallet balance through the POST request itself?

Also can in change the config so we don’t need to use password and subaccount but the key and secret also in POST reqeust?

Like:

{
"ticker": "BTCPERP",
"exchange": "FTX",
"time": "2021-05-20T20:36:22Z",
"action": "sell",
"price": 35800,
"message": "exit",
“risk”: 20%,
“leverage”: 25,

"short SL": 37200.00,
"short TP": 0,
"long SL": 38000.00,
"long TP": 40000.00,
"APIKEY": "abcdefg",
"APISECRET": "abcdefg"

},

@lth-elm
Copy link
Owner

lth-elm commented Sep 24, 2022

Hello, the leverage is calculated according the risk and the position (enter price & SL price) so you don't have to define it since it will calculate itself, but indeed it is possible to write the risk inside the POST request, then in your flask application you would need to consider it instead of the ENV variable defined.

Regarding the APIKEY and APISECRET it's a bad idea to put it there, security wise.

@mvthul
Copy link
Author

mvthul commented Sep 24, 2022 via email

@lth-elm
Copy link
Owner

lth-elm commented Sep 24, 2022

Wow great yeah I'd love to see what you can build around

@mvthul
Copy link
Author

mvthul commented Sep 24, 2022 via email

@lth-elm
Copy link
Owner

lth-elm commented Sep 24, 2022

size = (free_collateral * self.risk) / abs(payload['price'] - stop_loss)

This is already coded, the risk variable initially retrieved within the environment variable should just be replaced by the one inside the POST request.

@mvthul
Copy link
Author

mvthul commented Sep 26, 2022 via email

@lth-elm
Copy link
Owner

lth-elm commented Sep 28, 2022

Hi you made the images that's cool.

I'm actually quite busy with other projects right now however I can share with you some knowledge.

First like I told you you don't need to specify the leverage if you are already specifying the risk you want to take. If you want to buy BTC with 250 USDT at 20000$ and cut your losses so that you lose 62.50 USDT if the price hit 19000$ that would require you to trade with a leverage of 5, not 50, not 25. This calculation is made automatically inside the code and does not need to be changed. A trader doesn't adjust his leverage according to his desires but according the risk he want to take per trade.

If you're new to trading and this concept of leverage is not clear I advise you to learn first about trading as you will also encounter many (bad) surprises if not.

If you want to use testnet or livenet through payload keys you don't need to change anything since it is already the case. Your subaccount key is either linked to a testnet or a livenet account.

@mvthul
Copy link
Author

mvthul commented Sep 28, 2022 via email

@lth-elm lth-elm closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants