TradingView-Webhook-Trading-Bot icon indicating copy to clipboard operation
TradingView-Webhook-Trading-Bot copied to clipboard

Modifications if possible?

Open mvthul opened this issue 3 years ago • 5 comments
trafficstars

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" },

mvthul avatar Sep 22 '22 22:09 mvthul

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.

lth-elm avatar Sep 24 '22 09:09 lth-elm

Hi thanks for ur fast response. I’m gonna recode some bits to fit my needs.

If ur interested im creating a Kubernetes and Docker image to make this build easier to deploy. And scalable of course.

Slowly gonna spend some time to build a web GUI around it.


Van: L41TH @.> Verzonden: Saturday, September 24, 2022 11:49:20 AM Aan: lth-elm/tradingview-webhook-trading-bot @.> CC: mvthul @.>; Author @.> Onderwerp: Re: [lth-elm/tradingview-webhook-trading-bot] Modifications if possible? (Issue #7)

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.

— Reply to this email directly, view it on GitHubhttps://github.com/lth-elm/tradingview-webhook-trading-bot/issues/7#issuecomment-1256926864, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM3SRPTDGLVMOOXQ7GVMWJ3V73FCBANCNFSM6AAAAAAQTPBFYE. You are receiving this because you authored the thread.Message ID: @.***>

mvthul avatar Sep 24 '22 09:09 mvthul

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

lth-elm avatar Sep 24 '22 10:09 lth-elm

I will send links when finished! First I need to code how much % off available balance needs to be used with % risk. Want a variable for it.


Van: L41TH @.> Verzonden: Saturday, September 24, 2022 12:20:11 PM Aan: lth-elm/tradingview-webhook-trading-bot @.> CC: mvthul @.>; Author @.> Onderwerp: Re: [lth-elm/tradingview-webhook-trading-bot] Modifications if possible? (Issue #7)

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

— Reply to this email directly, view it on GitHubhttps://github.com/lth-elm/tradingview-webhook-trading-bot/issues/7#issuecomment-1256932582, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM3SRPVWOOJ5WL4LOJDLCJDV73IVXANCNFSM6AAAAAAQTPBFYE. You are receiving this because you authored the thread.Message ID: @.***>

mvthul avatar Sep 24 '22 10:09 mvthul

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.

lth-elm avatar Sep 24 '22 13:09 lth-elm

Hii I made a Docker image and a kubernetes deployment. Under my development branch.

Trying to code the following: -Use testnet or livenet through payload keys -Use % off available wallet USDT balance through payload keys -Risk % of the % were using from our available balance through payload keys -leverage through payload keys

Example: { "ticker": "BTCUSDT", "exchange": "Bybit", "time": "2022-09-26T16:37:59Z", "action": "Buy", "price": 20000, "message": "entry", "long SL": 19000.00, "long TP": 40000.00, "testnet": "True", "leverage": 50, "percentage_use_balance": 25, "percentage_risk_used_balance": 25, "passphrase": "abcdefg", "subaccount": "MYBYBITACCOUNT" }

Total Wallet: 1000 USDT Use from balance: 250 USDT Risk from Trade: 62.50 USDT Leverage x50 Entry 20000 Stoploss 19000

Same way:

Trying to code the following: -Use testnet or livenet through payload keys -Use % off available wallet USDT balance through payload keys -Risk % of the % were using from our available balance through payload keys -leverage through payload keys

Example: { "ticker": "BTCUSDT", "exchange": "Bybit", "time": "2022-09-26T16:37:59Z", "action": "Buy", "price": 20000, "message": "entry", "long SL": 19000.00, "long TP": 40000.00, "testnet": "True", "leverage": 25, "percentage to use from balance": 25, "risk percentage of the trade": 25, "passphrase": "abcdefg", "subaccount": "MYBYBITACCOUNT" }

Total Wallet: 1000 USDT Use from balance: 250 USDT Risk from Trade: 62.50 USDT Leverage x25 Entry 20000 Stoploss 19000

Same way as in de image of kites risk reward calculator.

https://github.com/mvthul/tradingview-webhook-trading-bot

Python is new for me maybe u got some spare time help me code this?

Greeting,

Michael


Van: L41TH @.> Verzonden: Saturday, September 24, 2022 3:21:49 PM Aan: lth-elm/tradingview-webhook-trading-bot @.> CC: mvthul @.>; Author @.> Onderwerp: Re: [lth-elm/tradingview-webhook-trading-bot] Modifications if possible? (Issue #7)

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.

— Reply to this email directly, view it on GitHubhttps://github.com/lth-elm/tradingview-webhook-trading-bot/issues/7#issuecomment-1256967585, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM3SRPSN2T2WTFYGEKVBNALV73563ANCNFSM6AAAAAAQTPBFYE. You are receiving this because you authored the thread.Message ID: @.***>

mvthul avatar Sep 26 '22 16:09 mvthul

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.

lth-elm avatar Sep 28 '22 16:09 lth-elm

Hi I’m not new hehehe to trading xD just trying to create trading bot similar to the paid versions.

If edited ur version with the following: (if there not in json post message default account config will be used) Amount/risk to use in the payload json Leverage to use in the payload json (if leverage NOT in json when post it uses ur auto calculation method) Marginmode isolated or cross in the payload json Use testnet in payload json

I wanna create all options when posting entry position. May not use it but then it’s there when I want

My strategytradingview script already calculate the risk and leverage to use so I was realy I need of these functions in the post method.


Van: L41TH @.> Verzonden: Wednesday, September 28, 2022 6:04:45 PM Aan: lth-elm/tradingview-webhook-trading-bot @.> CC: mvthul @.>; Author @.> Onderwerp: Re: [lth-elm/tradingview-webhook-trading-bot] Modifications if possible? (Issue #7)

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.

— Reply to this email directly, view it on GitHubhttps://github.com/lth-elm/tradingview-webhook-trading-bot/issues/7#issuecomment-1261130123, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM3SRPQR74XPA5C3A7U4FRLWARUB3ANCNFSM6AAAAAAQTPBFYE. You are receiving this because you authored the thread.Message ID: @.***>

mvthul avatar Sep 28 '22 16:09 mvthul